Commit 7e456138 authored by Robert Menzel's avatar Robert Menzel

updated GLM to 0.9.4.6

parent 29d22745
The MIT License The MIT License
Copyright (c) 2005 - 2012 G-Truc Creation Copyright (c) 2005 - 2013 G-Truc Creation
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
...@@ -445,7 +445,14 @@ namespace detail ...@@ -445,7 +445,14 @@ namespace detail
# define GLM_RESTRICT __declspec(restrict) # define GLM_RESTRICT __declspec(restrict)
# define GLM_RESTRICT_VAR __restrict # define GLM_RESTRICT_VAR __restrict
# define GLM_CONSTEXPR # define GLM_CONSTEXPR
#elif((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) #elif(GLM_COMPILER & GLM_COMPILER_INTEL)
# define GLM_DEPRECATED
# define GLM_ALIGN(x) __declspec(align(x))
# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
# define GLM_RESTRICT
# define GLM_RESTRICT_VAR __restrict
# define GLM_CONSTEXPR
#elif(((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) || (GLM_COMPILER & GLM_COMPILER_CLANG))
# define GLM_DEPRECATED __attribute__((__deprecated__)) # define GLM_DEPRECATED __attribute__((__deprecated__))
# define GLM_ALIGN(x) __attribute__((aligned(x))) # define GLM_ALIGN(x) __attribute__((aligned(x)))
# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
......
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
......
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
......
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
...@@ -36,7 +36,7 @@ namespace detail ...@@ -36,7 +36,7 @@ namespace detail
template <typename genFIType> template <typename genFIType>
struct Abs_<genFIType, true> struct Abs_<genFIType, true>
{ {
static genFIType get(genFIType const & x) GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
{ {
GLM_STATIC_ASSERT( GLM_STATIC_ASSERT(
detail::type<genFIType>::is_float || detail::type<genFIType>::is_float ||
...@@ -49,7 +49,7 @@ namespace detail ...@@ -49,7 +49,7 @@ namespace detail
template <typename genFIType> template <typename genFIType>
struct Abs_<genFIType, false> struct Abs_<genFIType, false>
{ {
static genFIType get(genFIType const & x) GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
{ {
GLM_STATIC_ASSERT( GLM_STATIC_ASSERT(
detail::type<genFIType>::is_uint, "'abs' only accept floating-point and integer inputs"); detail::type<genFIType>::is_uint, "'abs' only accept floating-point and integer inputs");
...@@ -275,7 +275,7 @@ namespace detail ...@@ -275,7 +275,7 @@ namespace detail
//// Only valid if (INT_MIN <= x-y <= INT_MAX) //// Only valid if (INT_MIN <= x-y <= INT_MAX)
//// min(x,y) //// min(x,y)
//r = y + ((x - y) & ((x - y) >> (sizeof(int) * //r = y + ((x - y) & ((x - y) >> (sizeof(int) *
//CHAR_BIT 1))); //CHAR_BIT - 1)));
//// max(x,y) //// max(x,y)
//r = x - ((x - y) & ((x - y) >> (sizeof(int) * //r = x - ((x - y) & ((x - y) >> (sizeof(int) *
//CHAR_BIT - 1))); //CHAR_BIT - 1)));
...@@ -420,93 +420,87 @@ namespace detail ...@@ -420,93 +420,87 @@ namespace detail
} }
// mix // mix
template <typename genTypeT, typename genTypeU> template <typename genType>
GLM_FUNC_QUALIFIER genTypeT mix GLM_FUNC_QUALIFIER genType mix
( (
genTypeT const & x, genType const & x,
genTypeT const & y, genType const & y,
genTypeU const & a genType const & a
) )
{ {
// It could be a vector too GLM_STATIC_ASSERT(detail::type<genType>::is_float , "'genType' is not floating-point type");
//GLM_STATIC_ASSERT(
// detail::type<genTypeT>::is_float &&
// detail::type<genTypeU>::is_float);
//return x + a * (y - x); return x + a * (y - x);
return genTypeT(genTypeU(x) + a * genTypeU(y - x));
} }
template <typename valTypeA, typename valTypeB> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valTypeA> mix GLM_FUNC_QUALIFIER detail::tvec2<valType> mix
( (
detail::tvec2<valTypeA> const & x, detail::tvec2<valType> const & x,
detail::tvec2<valTypeA> const & y, detail::tvec2<valType> const & y,
valTypeB const & a valType const & a
) )
{ {
return detail::tvec2<valTypeA>( GLM_STATIC_ASSERT(detail::type<valType>::is_float , "'genType' is not floating-point type");
detail::tvec2<valTypeB>(x) + a * detail::tvec2<valTypeB>(y - x));
return x + a * (y - x);
} }
template <typename valTypeA, typename valTypeB> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valTypeA> mix GLM_FUNC_QUALIFIER detail::tvec3<valType> mix
( (
detail::tvec3<valTypeA> const & x, detail::tvec3<valType> const & x,
detail::tvec3<valTypeA> const & y, detail::tvec3<valType> const & y,
valTypeB const & a valType const & a
) )
{ {
return detail::tvec3<valTypeA>( return x + a * (y - x);
detail::tvec3<valTypeB>(x) + a * detail::tvec3<valTypeB>(y - x));
} }
template <typename valTypeA, typename valTypeB> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valTypeA> mix GLM_FUNC_QUALIFIER detail::tvec4<valType> mix
( (
detail::tvec4<valTypeA> const & x, detail::tvec4<valType> const & x,
detail::tvec4<valTypeA> const & y, detail::tvec4<valType> const & y,
valTypeB const & a valType const & a
) )
{ {
return detail::tvec4<valTypeA>( return x + a * (y - x);
detail::tvec4<valTypeB>(x) + a * detail::tvec4<valTypeB>(y - x));
} }
template <typename valTypeA, typename valTypeB> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valTypeA> mix GLM_FUNC_QUALIFIER detail::tvec2<valType> mix
( (
detail::tvec2<valTypeA> const & x, detail::tvec2<valType> const & x,
detail::tvec2<valTypeA> const & y, detail::tvec2<valType> const & y,
detail::tvec2<valTypeB> const & a detail::tvec2<valType> const & a
) )
{ {
return detail::tvec2<valTypeA>( return x + a * (y - x);
detail::tvec2<valTypeB>(x) + a * detail::tvec2<valTypeB>(y - x));
} }
template <typename valTypeA, typename valTypeB> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valTypeA> mix GLM_FUNC_QUALIFIER detail::tvec3<valType> mix
( (
detail::tvec3<valTypeA> const & x, detail::tvec3<valType> const & x,
detail::tvec3<valTypeA> const & y, detail::tvec3<valType> const & y,
detail::tvec3<valTypeB> const & a detail::tvec3<valType> const & a
) )
{ {
return detail::tvec3<valTypeA>( GLM_STATIC_ASSERT(detail::type<valType>::is_float , "'genType' is not floating-point type");
detail::tvec3<valTypeB>(x) + a * detail::tvec3<valTypeB>(y - x));
return x + a * (y - x);
} }
template <typename valTypeA, typename valTypeB> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valTypeA> mix GLM_FUNC_QUALIFIER detail::tvec4<valType> mix
( (
detail::tvec4<valTypeA> const & x, detail::tvec4<valType> const & x,
detail::tvec4<valTypeA> const & y, detail::tvec4<valType> const & y,
detail::tvec4<valTypeB> const & a detail::tvec4<valType> const & a
) )
{ {
return detail::tvec4<valTypeA>( return x + a * (y - x);
detail::tvec4<valTypeB>(x) + a * detail::tvec4<valTypeB>(y - x));
} }
//template <typename genTypeT> //template <typename genTypeT>
...@@ -525,15 +519,63 @@ namespace detail ...@@ -525,15 +519,63 @@ namespace detail
// return x + a * (y - x); // return x + a * (y - x);
//} //}
template <typename genType> template <>
GLM_FUNC_QUALIFIER genType mix GLM_FUNC_QUALIFIER float mix
( (
genType const & x, float const & x,
genType const & y, float const & y,
bool const & a bool const & a
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'mix' only accept floating-point inputs"); return a ? y : x;
}
template <>
GLM_FUNC_QUALIFIER double mix
(
double const & x,
double const & y,
bool const & a
)
{
return a ? y : x;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> mix
(
detail::tvec2<T> const & x,
detail::tvec2<T> const & y,
bool a
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
return a ? y : x;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> mix
(
detail::tvec3<T> const & x,
detail::tvec3<T> const & y,
bool a
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
return a ? y : x;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> mix
(
detail::tvec4<T> const & x,
detail::tvec4<T> const & y,
bool a
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
return a ? y : x; return a ? y : x;
} }
...@@ -552,8 +594,7 @@ namespace detail ...@@ -552,8 +594,7 @@ namespace detail
for for
( (
typename detail::tvec2<T>::size_type i = 0; typename detail::tvec2<T>::size_type i = 0;
i < detail::tvec2<T>::value_size(); i < x.length(); ++i
++i
) )
{ {
result[i] = a[i] ? y[i] : x[i]; result[i] = a[i] ? y[i] : x[i];
...@@ -575,8 +616,7 @@ namespace detail ...@@ -575,8 +616,7 @@ namespace detail
for for
( (
typename detail::tvec3<T>::size_type i = 0; typename detail::tvec3<T>::size_type i = 0;
i < detail::tvec3<T>::value_size(); i < x.length(); ++i
++i
) )
{ {
result[i] = a[i] ? y[i] : x[i]; result[i] = a[i] ? y[i] : x[i];
...@@ -598,8 +638,7 @@ namespace detail ...@@ -598,8 +638,7 @@ namespace detail
for for
( (
typename detail::tvec4<T>::size_type i = 0; typename detail::tvec4<T>::size_type i = 0;
i < detail::tvec4<T>::value_size(); i < x.length(); ++i
++i
) )
{ {
result[i] = a[i] ? y[i] : x[i]; result[i] = a[i] ? y[i] : x[i];
...@@ -803,17 +842,19 @@ namespace detail ...@@ -803,17 +842,19 @@ namespace detail
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs");
# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) # if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
return _isnan(x) != 0; return _isnan(x) != 0;
# elif(GLM_COMPILER & GLM_COMPILER_GCC) # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _isnan(x) != 0; return _isnan(x) != 0;
# else # else
return std::isnan(x); return std::isnan(x);
# endif # endif
# else # elif(GLM_COMPILER & GLM_COMPILER_CUDA)
return isnan(x) != 0;
# else
return std::isnan(x); return std::isnan(x);
# endif # endif
} }
template <typename T> template <typename T>
...@@ -858,32 +899,20 @@ namespace detail ...@@ -858,32 +899,20 @@ namespace detail
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isinf' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isinf' only accept floating-point inputs");
# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) # if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
# elif(GLM_COMPILER & GLM_COMPILER_GCC) # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _isinf(x) != 0; return _isinf(x) != 0;
# else # else
return std::isinf(x); return std::isinf(x);
# endif # endif
# else # elif(GLM_COMPILER & GLM_COMPILER_CUDA)
// http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/docs/online/group__CUDA__MATH__DOUBLE_g13431dd2b40b51f9139cbb7f50c18fab.html#g13431dd2b40b51f9139cbb7f50c18fab
return isinf(double(x)) != 0;
# else
return std::isinf(x); return std::isinf(x);
# endif # endif
/*
# if(GLM_COMPILER & GLM_COMPILER_VC)
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
# elif(GLM_COMPILER & GLM_COMPILER_GCC)
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _isinf(x) != 0;
# else
return std::isinf(x);
# endif
# elif(GLM_COMPILER & GLM_COMPILER_INTEL)
return isinf(x) != 0;
# else
return std::isinf(x);
# endif
*/
} }
template <typename T> template <typename T>
......
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
...@@ -41,16 +41,16 @@ namespace glm ...@@ -41,16 +41,16 @@ namespace glm
/// @addtogroup core_func_exponential /// @addtogroup core_func_exponential
/// @{ /// @{
/// Returns x raised to the y power. /// Returns 'base' raised to the power 'exponent'.
/// ///
/// @param x pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. /// @param base Floating point value. pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
/// @param y /// @param exponent Floating point value representing the 'exponent'.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType> template <typename genType>
genType pow(genType const & x, genType const & y); GLM_FUNC_DECL genType pow(genType const & base, genType const & exponent);
/// Returns the natural exponentiation of x, i.e., e^x. /// Returns the natural exponentiation of x, i.e., e^x.
/// ///
...@@ -60,7 +60,7 @@ namespace glm ...@@ -60,7 +60,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType> template <typename genType>
genType exp(genType const & x); GLM_FUNC_DECL genType exp(genType const & x);