Fixed CUDA issues (#169, #168, #183, #182)

This commit is contained in:
Christophe Riccio 2014-03-16 02:39:36 +01:00
parent efd4087b1c
commit 899f388921
13 changed files with 95 additions and 89 deletions

View File

@ -160,7 +160,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec1, T, P> struct compute_sqrt<detail::tvec1, T, P>
{ {
static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x)
{ {
return detail::tvec1<T, P>(std::sqrt(x.x)); return detail::tvec1<T, P>(std::sqrt(x.x));
} }
@ -169,7 +169,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec2, T, P> struct compute_sqrt<detail::tvec2, T, P>
{ {
static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x)
{ {
return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y)); return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y));
} }
@ -178,7 +178,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec3, T, P> struct compute_sqrt<detail::tvec3, T, P>
{ {
static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x)
{ {
return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z)); return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z));
} }
@ -187,7 +187,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec4, T, P> struct compute_sqrt<detail::tvec4, T, P>
{ {
static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x)
{ {
return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w)); return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w));
} }

View File

@ -120,7 +120,9 @@
#include "./gtx/rotate_vector.hpp" #include "./gtx/rotate_vector.hpp"
#include "./gtx/spline.hpp" #include "./gtx/spline.hpp"
#include "./gtx/std_based_type.hpp" #include "./gtx/std_based_type.hpp"
#include "./gtx/string_cast.hpp" #if(!(GLM_COMPILER & GLM_COMPILER_CUDA))
# include "./gtx/string_cast.hpp"
#endif
#include "./gtx/transform.hpp" #include "./gtx/transform.hpp"
#include "./gtx/transform2.hpp" #include "./gtx/transform2.hpp"
#include "./gtx/vec1.hpp" #include "./gtx/vec1.hpp"

View File

@ -44,27 +44,6 @@ namespace glm
return Result; return Result;
} }
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> translate_slow
(
detail::tmat4x4<T, P> const & m,
detail::tvec3<T, P> const & v
)
{
detail::tmat4x4<T, P> Result(T(1));
Result[3] = detail::tvec4<T, P>(v, T(1));
return m * Result;
//detail::tmat4x4<valType> Result(m);
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
//Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0];
//Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1];
//Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2];
//Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3];
//return Result;
}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> rotate GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> rotate
( (

View File

@ -194,24 +194,30 @@ namespace detail
# pragma warning(pop) # pragma warning(pop)
#endif #endif
#if((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
# define GLM_NEXT_AFTER_FLT(x, toward) glm::detail::nextafterf((x), (toward))
# define GLM_NEXT_AFTER_DBL(x, toward) _nextafter((x), (toward))
#else
# define GLM_NEXT_AFTER_FLT(x, toward) nextafterf((x), (toward))
# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward))
#endif
namespace glm namespace glm
{ {
template <>
GLM_FUNC_QUALIFIER float next_float(float const & x) GLM_FUNC_QUALIFIER float next_float(float const & x)
{ {
return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max()); # if((GLM_LANG & GLM_LANG_CXX11_FLAG))
return std::nextafter(x, std::numeric_limits<float>::max());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafterf(x, FLT_MAX);
# else
return nextafterf(x, FLT_MAX);
# endif
} }
template <>
GLM_FUNC_QUALIFIER double next_float(double const & x) GLM_FUNC_QUALIFIER double next_float(double const & x)
{ {
return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::max()); # if((GLM_LANG & GLM_LANG_CXX11_FLAG))
return std::nextafter(x, std::numeric_limits<double>::max());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafterf(x, std::numeric_limits<float>::max());
# else
return nextafter(x, DBL_MAX);
# endif
} }
template<typename T, precision P, template<typename, precision> class vecType> template<typename T, precision P, template<typename, precision> class vecType>
@ -225,12 +231,24 @@ namespace glm
GLM_FUNC_QUALIFIER float prev_float(float const & x) GLM_FUNC_QUALIFIER float prev_float(float const & x)
{ {
return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::min()); # if((GLM_LANG & GLM_LANG_CXX11_FLAG))
return std::nextafter(x, std::numeric_limits<float>::min());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafterf(x, FLT_MIN);
# else
return nextafterf(x, FLT_MIN);
# endif
} }
GLM_FUNC_QUALIFIER double prev_float(double const & x) GLM_FUNC_QUALIFIER double prev_float(double const & x)
{ {
return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::min()); # if((GLM_LANG & GLM_LANG_CXX11_FLAG))
return std::nextafter(x, std::numeric_limits<float>::min());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return _nextafter(x, DBL_MIN);
# else
return nextafter(x, DBL_MIN);
# endif
} }
template<typename T, precision P, template<typename, precision> class vecType> template<typename T, precision P, template<typename, precision> class vecType>

View File

@ -312,13 +312,13 @@ namespace glm
namespace detail namespace detail
{ {
template <typename PARAM, typename RET> template <typename PARAM, typename RET>
RET bitfieldInterleave(PARAM x, PARAM y); GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y);
template <typename PARAM, typename RET> template <typename PARAM, typename RET>
RET bitfieldInterleave(PARAM x, PARAM y, PARAM z); GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z);
template <typename PARAM, typename RET> template <typename PARAM, typename RET>
RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w); GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w);
/* /*
template <typename PARAM, typename RET> template <typename PARAM, typename RET>
@ -358,7 +358,7 @@ namespace glm
} }
*/ */
template <> template <>
inline glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y) GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y)
{ {
glm::uint16 REG1(x); glm::uint16 REG1(x);
glm::uint16 REG2(y); glm::uint16 REG2(y);
@ -376,7 +376,7 @@ namespace glm
} }
template <> template <>
inline glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y) GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y)
{ {
glm::uint32 REG1(x); glm::uint32 REG1(x);
glm::uint32 REG2(y); glm::uint32 REG2(y);
@ -397,7 +397,7 @@ namespace glm
} }
template <> template <>
inline glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y) GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y)
{ {
glm::uint64 REG1(x); glm::uint64 REG1(x);
glm::uint64 REG2(y); glm::uint64 REG2(y);
@ -421,7 +421,7 @@ namespace glm
} }
template <> template <>
inline glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z) GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z)
{ {
glm::uint64 REG1(x); glm::uint64 REG1(x);
glm::uint64 REG2(y); glm::uint64 REG2(y);
@ -451,7 +451,7 @@ namespace glm
} }
template <> template <>
inline glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w) GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w)
{ {
glm::uint64 REG1(x); glm::uint64 REG1(x);
glm::uint64 REG2(y); glm::uint64 REG2(y);
@ -482,7 +482,7 @@ namespace glm
} }
}//namespace detail }//namespace detail
inline int16 bitfieldInterleave(int8 x, int8 y) GLM_FUNC_QUALIFIER int16 bitfieldInterleave(int8 x, int8 y)
{ {
union sign8 union sign8
{ {
@ -503,12 +503,12 @@ namespace glm
return result.i; return result.i;
} }
inline uint16 bitfieldInterleave(uint8 x, uint8 y) GLM_FUNC_QUALIFIER uint16 bitfieldInterleave(uint8 x, uint8 y)
{ {
return detail::bitfieldInterleave<uint8, uint16>(x, y); return detail::bitfieldInterleave<uint8, uint16>(x, y);
} }
inline int32 bitfieldInterleave(int16 x, int16 y) GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int16 x, int16 y)
{ {
union sign16 union sign16
{ {
@ -529,12 +529,12 @@ namespace glm
return result.i; return result.i;
} }
inline uint32 bitfieldInterleave(uint16 x, uint16 y) GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint16 x, uint16 y)
{ {
return detail::bitfieldInterleave<uint16, uint32>(x, y); return detail::bitfieldInterleave<uint16, uint32>(x, y);
} }
inline int64 bitfieldInterleave(int32 x, int32 y) GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y)
{ {
union sign32 union sign32
{ {
@ -555,12 +555,12 @@ namespace glm
return result.i; return result.i;
} }
inline uint64 bitfieldInterleave(uint32 x, uint32 y) GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y)
{ {
return detail::bitfieldInterleave<uint32, uint64>(x, y); return detail::bitfieldInterleave<uint32, uint64>(x, y);
} }
inline int32 bitfieldInterleave(int8 x, int8 y, int8 z) GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z)
{ {
union sign8 union sign8
{ {
@ -582,12 +582,12 @@ namespace glm
return result.i; return result.i;
} }
inline uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z) GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z)
{ {
return detail::bitfieldInterleave<uint8, uint32>(x, y, z); return detail::bitfieldInterleave<uint8, uint32>(x, y, z);
} }
inline int64 bitfieldInterleave(int16 x, int16 y, int16 z) GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z)
{ {
union sign16 union sign16
{ {
@ -609,12 +609,12 @@ namespace glm
return result.i; return result.i;
} }
inline uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z) GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z)
{ {
return detail::bitfieldInterleave<uint32, uint64>(x, y, z); return detail::bitfieldInterleave<uint32, uint64>(x, y, z);
} }
inline int64 bitfieldInterleave(int32 x, int32 y, int32 z) GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y, int32 z)
{ {
union sign16 union sign16
{ {
@ -636,12 +636,12 @@ namespace glm
return result.i; return result.i;
} }
inline uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z) GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z)
{ {
return detail::bitfieldInterleave<uint32, uint64>(x, y, z); return detail::bitfieldInterleave<uint32, uint64>(x, y, z);
} }
inline int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w) GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w)
{ {
union sign8 union sign8
{ {
@ -659,17 +659,17 @@ namespace glm
sign_y.i = y; sign_y.i = y;
sign_z.i = z; sign_z.i = z;
sign_w.i = w; sign_w.i = w;
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u); result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u);
return result.i; return result.i;
} }
inline uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w) GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w)
{ {
return detail::bitfieldInterleave<uint8, uint32>(x, y, z, w); return detail::bitfieldInterleave<uint8, uint32>(x, y, z, w);
} }
inline int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w) GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w)
{ {
union sign16 union sign16
{ {
@ -687,12 +687,12 @@ namespace glm
sign_y.i = y; sign_y.i = y;
sign_z.i = z; sign_z.i = z;
sign_w.i = w; sign_w.i = w;
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u); result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u);
return result.i; return result.i;
} }
inline uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w) GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w)
{ {
return detail::bitfieldInterleave<uint16, uint64>(x, y, z, w); return detail::bitfieldInterleave<uint16, uint64>(x, y, z, w);
} }

View File

@ -82,10 +82,10 @@ namespace glm
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> atan2(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec3<T, P> atan2(const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> atan2(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template <typename T, precision P> GLM_FUNC_QUALIFIER detail::tvec4<T, P> atan2(const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
template <typename genType> bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template <typename genType> GLM_FUNC_DECL bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
template <typename T, precision P> detail::tvec2<bool, P> isfinite(const detail::tvec2<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template <typename T, precision P> GLM_FUNC_DECL detail::tvec2<bool, P> isfinite(const detail::tvec2<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
template <typename T, precision P> detail::tvec3<bool, P> isfinite(const detail::tvec3<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template <typename T, precision P> GLM_FUNC_DECL detail::tvec3<bool, P> isfinite(const detail::tvec3<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
template <typename T, precision P> detail::tvec4<bool, P> isfinite(const detail::tvec4<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template <typename T, precision P> GLM_FUNC_DECL detail::tvec4<bool, P> isfinite(const detail::tvec4<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension) typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension)
typedef detail::tvec2<bool, highp> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension) typedef detail::tvec2<bool, highp> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension)

View File

@ -14,16 +14,14 @@ namespace glm
GLM_FUNC_QUALIFIER bool isfinite( GLM_FUNC_QUALIFIER bool isfinite(
genType const & x) genType const & x)
{ {
# if(GLM_COMPILER & GLM_COMPILER_VC) # if(GLM_LANG & GLM_LANG_CXX11_FLAG)
return std::isfinite(x) != 0;
# elif(GLM_COMPILER & GLM_COMPILER_VC)
return _finite(x); return _finite(x);
# elif(GLM_COMPILER & GLM_COMPILER_GCC) # elif(GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _isfinite(x) != 0; return _isfinite(x) != 0;
# else # else
return std::isfinite(x) != 0; return isfinite(x) != 0;
# endif
# else
return std::isfinite(x) != 0;
# endif # endif
} }

View File

@ -142,14 +142,14 @@ namespace detail
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tdualquat<T, P> normalize( GLM_FUNC_DECL detail::tdualquat<T, P> normalize(
detail::tdualquat<T, P> const & q); detail::tdualquat<T, P> const & q);
/// Returns the linear interpolation of two dual quaternion. /// Returns the linear interpolation of two dual quaternion.
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tdualquat<T, P> lerp( GLM_FUNC_DECL detail::tdualquat<T, P> lerp(
detail::tdualquat<T, P> const & x, detail::tdualquat<T, P> const & x,
detail::tdualquat<T, P> const & y, detail::tdualquat<T, P> const & y,
T const & a); T const & a);
@ -158,7 +158,7 @@ namespace detail
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tdualquat<T, P> inverse( GLM_FUNC_DECL detail::tdualquat<T, P> inverse(
detail::tdualquat<T, P> const & q); detail::tdualquat<T, P> const & q);
/* /*
@ -175,28 +175,28 @@ namespace detail
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tmat2x4<T, P> mat2x4_cast( GLM_FUNC_DECL detail::tmat2x4<T, P> mat2x4_cast(
detail::tdualquat<T, P> const & x); detail::tdualquat<T, P> const & x);
/// Converts a quaternion to a 3 * 4 matrix. /// Converts a quaternion to a 3 * 4 matrix.
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tmat3x4<T, P> mat3x4_cast( GLM_FUNC_DECL detail::tmat3x4<T, P> mat3x4_cast(
detail::tdualquat<T, P> const & x); detail::tdualquat<T, P> const & x);
/// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion. /// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion.
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tdualquat<T, P> dualquat_cast( GLM_FUNC_DECL detail::tdualquat<T, P> dualquat_cast(
detail::tmat2x4<T, P> const & x); detail::tmat2x4<T, P> const & x);
/// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion. /// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion.
/// ///
/// @see gtc_dual_quaternion /// @see gtc_dual_quaternion
template <typename T, precision P> template <typename T, precision P>
detail::tdualquat<T, P> dualquat_cast( GLM_FUNC_DECL detail::tdualquat<T, P> dualquat_cast(
detail::tmat3x4<T, P> const & x); detail::tmat3x4<T, P> const & x);

View File

@ -35,7 +35,7 @@
namespace glm namespace glm
{ {
//! Deprecated, use packUnorm3x10_1x2 instead. //! Deprecated, use packUnorm3x10_1x2 instead.
GLM_DEPRECATED dword uint10_10_10_2_cast(glm::vec4 const & v); GLM_DEPRECATED GLM_FUNC_DECL dword uint10_10_10_2_cast(glm::vec4 const & v);
}//namespace glm }//namespace glm

View File

@ -36,6 +36,7 @@
/// @brief Setup strings for GLM type values /// @brief Setup strings for GLM type values
/// ///
/// <glm/gtx/string_cast.hpp> need to be included to use these functionalities. /// <glm/gtx/string_cast.hpp> need to be included to use these functionalities.
/// This extension is not supported with CUDA
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_string_cast #ifndef GLM_GTX_string_cast
@ -47,6 +48,10 @@
#include "../gtx/quaternion.hpp" #include "../gtx/quaternion.hpp"
#include <string> #include <string>
#if(GLM_COMPILER & GLM_COMPILER_CUDA)
# error "GLM_GTX_string_cast is not supported on CUDA compiler"
#endif
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_string_cast extension included") # pragma message("GLM: GLM_GTX_string_cast extension included")
#endif #endif

View File

@ -23,11 +23,11 @@ namespace detail
return std::string(); return std::string();
va_start(list, msg); va_start(list, msg);
#if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8)) # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
vsprintf_s(text, STRING_BUFFER, msg, list); vsprintf_s(text, STRING_BUFFER, msg, list);
#else// # else//
vsprintf(text, msg, list); vsprintf(text, msg, list);
#endif// # endif//
va_end(list); va_end(list);
return std::string(text); return std::string(text);

View File

@ -156,7 +156,9 @@ namespace detail
detail::tvec2<T, P> const & v, detail::tvec2<T, P> const & v,
T const & epsilon) T const & epsilon)
{ {
return detail::tvec2<bool, P>(
abs(v.x) < epsilon,
abs(v.y) < epsilon);
} }
template <typename T, precision P> template <typename T, precision P>

View File

@ -44,6 +44,8 @@ GLM 0.9.5.3: 2014-0X-XX
- Fixed GTX_raw_data code dependency - Fixed GTX_raw_data code dependency
- Fixed GCC instruction set detection - Fixed GCC instruction set detection
- Added GLM_GTX_matrix_transform_2d extension (#178, #176) - Added GLM_GTX_matrix_transform_2d extension (#178, #176)
- Fixed CUDA issues (#169, #168, #183, #182)
- Added support for all extensions but GTX_string_cast to CUDA
================================================================================ ================================================================================
GLM 0.9.5.2: 2014-02-08 GLM 0.9.5.2: 2014-02-08