Removed gtc and gtx namespaces

master
Christophe Riccio ago%!(EXTRA string=14 years)
parent 2b81d45719
commit 3621deaeb5
  1. 20
      doc/pages.doxy
  2. 4
      glm/core/func_common.hpp
  3. 5
      glm/core/func_common.inl
  4. 6
      glm/core/func_exponential.hpp
  5. 4
      glm/core/func_exponential.inl
  6. 4
      glm/core/func_geometric.hpp
  7. 4
      glm/core/func_geometric.inl
  8. 6
      glm/core/func_integer.hpp
  9. 5
      glm/core/func_integer.inl
  10. 6
      glm/core/func_matrix.hpp
  11. 5
      glm/core/func_matrix.inl
  12. 6
      glm/core/func_noise.hpp
  13. 8
      glm/core/func_packing.hpp
  14. 50
      glm/core/func_packing.inl
  15. 6
      glm/core/func_trigonometric.hpp
  16. 748
      glm/core/func_trigonometric.inl
  17. 6
      glm/core/func_vector_relational.hpp
  18. 2
      glm/core/hint.hpp
  19. 10
      glm/glm.hpp
  20. 3
      glm/gtc/half_float.hpp
  21. 6
      glm/gtc/matrix_access.hpp
  22. 36
      glm/gtc/matrix_access.inl
  23. 8
      glm/gtc/matrix_integer.hpp
  24. 4
      glm/gtc/matrix_inverse.hpp
  25. 50
      glm/gtc/matrix_inverse.inl
  26. 26
      glm/gtc/matrix_transform.hpp
  27. 208
      glm/gtc/matrix_transform.inl
  28. 5
      glm/gtc/quaternion.hpp
  29. 11
      glm/gtc/quaternion.inl
  30. 4
      glm/gtc/swizzle.hpp
  31. 2
      glm/gtc/swizzle.inl
  32. 6
      glm/gtc/type_precision.hpp
  33. 4
      glm/gtc/type_ptr.hpp
  34. 4
      glm/gtx/associated_min_max.hpp
  35. 726
      glm/gtx/associated_min_max.inl
  36. 4
      glm/gtx/bit.hpp
  37. 8
      glm/gtx/bit.inl
  38. 4
      glm/gtx/closest_point.hpp
  39. 2
      glm/gtx/closest_point.inl
  40. 94
      glm/gtx/color_cast.hpp
  41. 214
      glm/gtx/color_cast.inl
  42. 4
      glm/gtx/color_space.hpp
  43. 50
      glm/gtx/color_space.inl
  44. 4
      glm/gtx/color_space_YCoCg.hpp
  45. 2
      glm/gtx/color_space_YCoCg.inl
  46. 34
      glm/gtx/compatibility.hpp
  47. 4
      glm/gtx/compatibility.inl
  48. 4
      glm/gtx/component_wise.hpp
  49. 34
      glm/gtx/component_wise.inl
  50. 4
      glm/gtx/epsilon.hpp
  51. 2
      glm/gtx/epsilon.inl
  52. 4
      glm/gtx/euler_angles.hpp
  53. 2
      glm/gtx/euler_angles.inl
  54. 4
      glm/gtx/extend.hpp
  55. 2
      glm/gtx/extend.inl
  56. 4
      glm/gtx/extented_min_max.hpp
  57. 4
      glm/gtx/extented_min_max.inl
  58. 4
      glm/gtx/fast_exponential.hpp
  59. 230
      glm/gtx/fast_exponential.inl
  60. 4
      glm/gtx/fast_square_root.hpp
  61. 2
      glm/gtx/fast_square_root.inl
  62. 4
      glm/gtx/fast_trigonometry.hpp
  63. 226
      glm/gtx/fast_trigonometry.inl
  64. 4
      glm/gtx/gradient_paint.hpp
  65. 18
      glm/gtx/gradient_paint.inl
  66. 4
      glm/gtx/handed_coordinate_space.hpp
  67. 20
      glm/gtx/handed_coordinate_space.inl
  68. 4
      glm/gtx/inertia.hpp
  69. 66
      glm/gtx/inertia.inl
  70. 4
      glm/gtx/int_10_10_10_2.hpp
  71. 2
      glm/gtx/int_10_10_10_2.inl
  72. 4
      glm/gtx/integer.hpp
  73. 60
      glm/gtx/integer.inl
  74. 4
      glm/gtx/intersect.hpp
  75. 2
      glm/gtx/intersect.inl
  76. 4
      glm/gtx/log_base.hpp
  77. 2
      glm/gtx/log_base.inl
  78. 4
      glm/gtx/matrix_cross_product.hpp
  79. 2
      glm/gtx/matrix_cross_product.inl
  80. 4
      glm/gtx/matrix_interpolation.hpp
  81. 26
      glm/gtx/matrix_interpolation.inl
  82. 6
      glm/gtx/matrix_major_storage.hpp
  83. 98
      glm/gtx/matrix_major_storage.inl
  84. 6
      glm/gtx/matrix_operation.hpp
  85. 110
      glm/gtx/matrix_operation.inl
  86. 4
      glm/gtx/matrix_query.hpp
  87. 68
      glm/gtx/matrix_query.inl
  88. 4
      glm/gtx/mixed_product.hpp
  89. 11
      glm/gtx/mixed_product.inl
  90. 4
      glm/gtx/multiple.hpp
  91. 180
      glm/gtx/multiple.inl
  92. 4
      glm/gtx/noise.hpp
  93. 148
      glm/gtx/noise.inl
  94. 4
      glm/gtx/norm.hpp
  95. 124
      glm/gtx/norm.inl
  96. 4
      glm/gtx/normal.hpp
  97. 2
      glm/gtx/normal.inl
  98. 4
      glm/gtx/normalize_dot.hpp
  99. 10
      glm/gtx/normalize_dot.inl
  100. 50
      glm/gtx/optimum_pow.inl
  101. Some files were not shown because too many files have changed in this diff Show More

@ -311,11 +311,11 @@ void foo()
<dl> <dl>
<dt>glRotate[fd]</dt> <dt>glRotate[fd]</dt>
<dd>\link glm::gtc::rotate glm::rotate \endlink</dd> <dd>\link glm::rotate glm::rotate \endlink</dd>
<dt>glScale[fd]</dt> <dt>glScale[fd]</dt>
<dd>\link glm::gtc::scale glm::scale \endlink</dd> <dd>\link glm::scale glm::scale \endlink</dd>
<dt>glTranslate[fd]</dt> <dt>glTranslate[fd]</dt>
<dd>\link glm::gtc::translate glm::translate \endlink</dd> <dd>\link glm::translate glm::translate \endlink</dd>
<dt>glLoadIdentity</dt> <dt>glLoadIdentity</dt>
<dd>The default constructor of all matrix types creates an identity matrix.</dd> <dd>The default constructor of all matrix types creates an identity matrix.</dd>
<dt>glMultMatrix[fd]</dt> <dt>glMultMatrix[fd]</dt>
@ -325,24 +325,24 @@ void foo()
<dt>glMultTransposeMatrix</dt> <dt>glMultTransposeMatrix</dt>
<dd>Combine the last two.</dd> <dd>Combine the last two.</dd>
<dt>glFrustum</dt> <dt>glFrustum</dt>
<dd>\link glm::gtc::frustum glm::frustum \endlink</dd> <dd>\link glm::frustum glm::frustum \endlink</dd>
<dt>glOrtho</dt> <dt>glOrtho</dt>
<dd>\link glm::gtc::ortho glm::ortho \endlink</dd> <dd>\link glm::ortho glm::ortho \endlink</dd>
<dt>gluLookAt</dt> <dt>gluLookAt</dt>
<dd>\link glm::gtc::lookAt glm::lookAt \endlink</dd> <dd>\link glm::lookAt glm::lookAt \endlink</dd>
</dl> </dl>
\section deprecated_glu GLU function replacements \section deprecated_glu GLU function replacements
<dl> <dl>
<dt>gluOrtho2D</dt> <dt>gluOrtho2D</dt>
<dd>\link glm::gtc::ortho glm::ortho \endlink</dd> <dd>\link glm::ortho glm::ortho \endlink</dd>
<dt>gluPerspective</dt> <dt>gluPerspective</dt>
<dd>\link glm::gtc::perspective glm::perspective \endlink</dd> <dd>\link glm::perspective glm::perspective \endlink</dd>
<dt>gluProject</dt> <dt>gluProject</dt>
<dd>\link glm::gtc::project glm::project \endlink</dd> <dd>\link glm::project glm::project \endlink</dd>
<dt>gluUnProject</dt> <dt>gluUnProject</dt>
<dd>\link glm::gtc::unProject glm::unProject \endlink</dd> <dd>\link glm::unProject glm::unProject \endlink</dd>
</dl> </dl>
**/ **/

@ -31,8 +31,7 @@
#include "_fixes.hpp" #include "_fixes.hpp"
namespace glm{ namespace glm
namespace core
{ {
/// @addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
@ -367,7 +366,6 @@ namespace core
genType ldexp(genType const & x, genIType const & exp); genType ldexp(genType const & x, genIType const & exp);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_common.inl" #include "func_common.inl"

@ -38,8 +38,6 @@ namespace detail
}; };
}//namespace detail }//namespace detail
namespace core
{
// abs // abs
template <typename genFIType> template <typename genFIType>
GLM_FUNC_QUALIFIER genFIType abs( GLM_FUNC_QUALIFIER genFIType abs(
@ -728,7 +726,7 @@ namespace core
//if(x >= maxVal) return maxVal; //if(x >= maxVal) return maxVal;
//if(x <= minVal) return minVal; //if(x <= minVal) return minVal;
//return x; //return x;
return glm::max(glm::min(x, maxVal), minVal); return max(min(x, maxVal), minVal);
} }
template <typename T> template <typename T>
@ -1566,5 +1564,4 @@ namespace core
return std::frexp(x, exp); return std::frexp(x, exp);
} }
}//namespace core
}//namespace glm }//namespace glm

@ -10,10 +10,9 @@
#ifndef glm_core_func_exponential #ifndef glm_core_func_exponential
#define glm_core_func_exponential #define glm_core_func_exponential
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
//! Returns x raised to the y power. //! Returns x raised to the y power.
@ -69,7 +68,6 @@ namespace core
genType inversesqrt(genType const & x); genType inversesqrt(genType const & x);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_exponential.inl" #include "func_exponential.inl"

@ -7,8 +7,7 @@
// File : glm/core/func_exponential.inl // File : glm/core/func_exponential.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
namespace core
{ {
// pow // pow
template <typename genType> template <typename genType>
@ -349,5 +348,4 @@ namespace core
inversesqrt(x.w)); inversesqrt(x.w));
} }
}//namespace core
}//namespace glm }//namespace glm

@ -10,8 +10,7 @@
#ifndef glm_core_func_geometric #ifndef glm_core_func_geometric
#define glm_core_func_geometric #define glm_core_func_geometric
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// \addtogroup core_funcs
/// @{ /// @{
@ -92,7 +91,6 @@ namespace core
typename genType::value_type const & eta); typename genType::value_type const & eta);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_geometric.inl" #include "func_geometric.inl"

@ -7,8 +7,7 @@
// File : glm/core/func_geometric.inl // File : glm/core/func_geometric.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
namespace core
{ {
// length // length
template <typename genType> template <typename genType>
@ -281,5 +280,4 @@ namespace core
return eta * I - (eta * dotValue + sqrt(k)) * N; return eta * I - (eta * dotValue + sqrt(k)) * N;
} }
}//namespace core
}//namespace glm }//namespace glm

@ -10,10 +10,9 @@
#ifndef glm_core_func_integer #ifndef glm_core_func_integer
#define glm_core_func_integer #define glm_core_func_integer
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
//! Adds 32-bit unsigned integer x and y, returning the sum //! Adds 32-bit unsigned integer x and y, returning the sum
@ -140,7 +139,6 @@ namespace core
typename C<T>::signed_type findMSB(C<T> const & Value); typename C<T>::signed_type findMSB(C<T> const & Value);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_integer.inl" #include "func_integer.inl"

@ -7,8 +7,7 @@
// File : glm/core/func_integer.inl // File : glm/core/func_integer.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
namespace core
{ {
// uaddCarry // uaddCarry
template <typename genUType> template <typename genUType>
@ -582,6 +581,4 @@ namespace core
findMSB(value[2]), findMSB(value[2]),
findMSB(value[3])); findMSB(value[3]));
} }
}//namespace core
}//namespace glm }//namespace glm

@ -10,10 +10,9 @@
#ifndef glm_core_func_matrix #ifndef glm_core_func_matrix
#define glm_core_func_matrix #define glm_core_func_matrix
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
//! Multiply matrix x by matrix y component-wise, i.e., //! Multiply matrix x by matrix y component-wise, i.e.,
@ -94,7 +93,6 @@ namespace core
detail::tmat4x4<T> const & m); detail::tmat4x4<T> const & m);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_matrix.inl" #include "func_matrix.inl"

@ -7,8 +7,7 @@
// File : glm/core/func_matrix.inl // File : glm/core/func_matrix.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
namespace core
{ {
// matrixCompMult // matrixCompMult
template <typename matType> template <typename matType>
@ -561,6 +560,4 @@ namespace core
return Inverse; return Inverse;
} }
}//namespace core
}//namespace glm }//namespace glm

@ -10,10 +10,9 @@
#ifndef glm_core_func_noise #ifndef glm_core_func_noise
#define glm_core_func_noise #define glm_core_func_noise
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
//! Returns a 1D noise value based on the input value x. //! Returns a 1D noise value based on the input value x.
@ -45,7 +44,6 @@ namespace core
detail::tvec4<typename genType::value_type> noise4(genType const & x); detail::tvec4<typename genType::value_type> noise4(genType const & x);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_noise.inl" #include "func_noise.inl"

@ -10,11 +10,10 @@
#ifndef glm_core_func_packing #ifndef glm_core_func_packing
#define glm_core_func_packing #define glm_core_func_packing
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
///@{ /// @{
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer. //! Then, the results are packed into the returned 32-bit unsigned integer.
@ -114,7 +113,6 @@ namespace core
detail::tvec2<detail::uint32> unpackDouble2x32(double const & v); detail::tvec2<detail::uint32> unpackDouble2x32(double const & v);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_packing.inl" #include "func_packing.inl"

@ -8,44 +8,43 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace core
GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v)
{ {
GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v)
{
detail::uint16 A((detail::uint16)round(clamp(v.x, 0.0f, 1.0f) * 65535.0f)); detail::uint16 A((detail::uint16)round(clamp(v.x, 0.0f, 1.0f) * 65535.0f));
detail::uint16 B((detail::uint16)round(clamp(v.y, 0.0f, 1.0f) * 65535.0f)); detail::uint16 B((detail::uint16)round(clamp(v.y, 0.0f, 1.0f) * 65535.0f));
return detail::uint32((B << 16) | A); return detail::uint32((B << 16) | A);
} }
GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v) GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v)
{ {
detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f));
detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f));
detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f));
detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f));
return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); return detail::uint32((D << 24) | (C << 16) | (B << 8) | A);
} }
GLM_FUNC_QUALIFIER detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> const & v) GLM_FUNC_QUALIFIER detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> const & v)
{ {
detail::uint8 A((detail::uint8)round(clamp(v.x,-1.0f, 1.0f) * 255.0f)); detail::uint8 A((detail::uint8)round(clamp(v.x,-1.0f, 1.0f) * 255.0f));
detail::uint8 B((detail::uint8)round(clamp(v.y,-1.0f, 1.0f) * 255.0f)); detail::uint8 B((detail::uint8)round(clamp(v.y,-1.0f, 1.0f) * 255.0f));
detail::uint8 C((detail::uint8)round(clamp(v.z,-1.0f, 1.0f) * 255.0f)); detail::uint8 C((detail::uint8)round(clamp(v.z,-1.0f, 1.0f) * 255.0f));
detail::uint8 D((detail::uint8)round(clamp(v.w,-1.0f, 1.0f) * 255.0f)); detail::uint8 D((detail::uint8)round(clamp(v.w,-1.0f, 1.0f) * 255.0f));
return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); return detail::uint32((D << 24) | (C << 16) | (B << 8) | A);
} }
GLM_FUNC_QUALIFIER detail::tvec2<detail::float32> unpackUnorm2x16(detail::uint32 const & p) GLM_FUNC_QUALIFIER detail::tvec2<detail::float32> unpackUnorm2x16(detail::uint32 const & p)
{ {
detail::uint16 A(detail::uint16(p >> 0)); detail::uint16 A(detail::uint16(p >> 0));
detail::uint16 B(detail::uint16(p >> 16)); detail::uint16 B(detail::uint16(p >> 16));
return detail::tvec2<detail::float32>( return detail::tvec2<detail::float32>(
A * 1.0f / 65535.0f, A * 1.0f / 65535.0f,
B * 1.0f / 65535.0f); B * 1.0f / 65535.0f);
} }
GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> unpackUnorm4x8(detail::uint32 const & p) GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> unpackUnorm4x8(detail::uint32 const & p)
{ {
detail::uint8 A(detail::uint8(p >> 0)); detail::uint8 A(detail::uint8(p >> 0));
detail::uint8 B(detail::uint8(p >> 8)); detail::uint8 B(detail::uint8(p >> 8));
detail::uint8 C(detail::uint8(p >> 16)); detail::uint8 C(detail::uint8(p >> 16));
@ -55,10 +54,10 @@ namespace core
B * 1.0f / 255.0f, B * 1.0f / 255.0f,
C * 1.0f / 255.0f, C * 1.0f / 255.0f,
D * 1.0f / 255.0f); D * 1.0f / 255.0f);
} }
GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> unpackSnorm4x8(detail::uint32 const & p) GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> unpackSnorm4x8(detail::uint32 const & p)
{ {
detail::uint8 A(detail::uint8(p >> 0)); detail::uint8 A(detail::uint8(p >> 0));
detail::uint8 B(detail::uint8(p >> 8)); detail::uint8 B(detail::uint8(p >> 8));
detail::uint8 C(detail::uint8(p >> 16)); detail::uint8 C(detail::uint8(p >> 16));
@ -68,17 +67,16 @@ namespace core
B * 1.0f / 127.0f, B * 1.0f / 127.0f,
C * 1.0f / 127.0f, C * 1.0f / 127.0f,
D * 1.0f / 127.0f), -1.0f, 1.0f); D * 1.0f / 127.0f), -1.0f, 1.0f);
} }
GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2<detail::uint32> const & v) GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2<detail::uint32> const & v)
{ {
return *(double*)&v; return *(double*)&v;
} }
GLM_FUNC_QUALIFIER detail::tvec2<detail::uint32> unpackDouble2x32(double const & v) GLM_FUNC_QUALIFIER detail::tvec2<detail::uint32> unpackDouble2x32(double const & v)
{ {
return *(detail::tvec2<detail::uint32>*)&v; return *(detail::tvec2<detail::uint32>*)&v;
} }
}//namespace core
}//namespace glm }//namespace glm

@ -10,10 +10,9 @@
#ifndef glm_core_func_trigonometric #ifndef glm_core_func_trigonometric
#define glm_core_func_trigonometric #define glm_core_func_trigonometric
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
//! Converts degrees to radians and returns the result. //! Converts degrees to radians and returns the result.
@ -135,7 +134,6 @@ namespace core
genType atanh(genType const & x); genType atanh(genType const & x);
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_trigonometric.inl" #include "func_trigonometric.inl"

File diff suppressed because it is too large Load Diff

@ -12,10 +12,9 @@
#include "_detail.hpp" #include "_detail.hpp"
namespace glm{ namespace glm
namespace core
{ {
/// \addtogroup core_funcs /// @addtogroup core_funcs
/// @{ /// @{
//! Returns the component-wise comparison result of x < y. //! Returns the component-wise comparison result of x < y.
@ -197,7 +196,6 @@ namespace core
} }
/// @} /// @}
}//namespace core
}//namespace glm }//namespace glm
#include "func_vector_relational.inl" #include "func_vector_relational.inl"

@ -16,6 +16,6 @@ namespace glm
class dont_care {}; class dont_care {};
class nicest {}; class nicest {};
class fastest {}; class fastest {};
}; }//namespace glm
#endif//glm_core_type #endif//glm_core_type

@ -43,16 +43,6 @@
# pragma message("GLM: Core library included") # pragma message("GLM: Core library included")
#endif//GLM_MESSAGE #endif//GLM_MESSAGE
namespace glm
{
namespace gtc{}
namespace gtx{}
namespace virtrev{}
using namespace gtc;
using namespace gtx;
}//namespace glm
#include "./core/_detail.hpp" #include "./core/_detail.hpp"
#include "./core/type.hpp" #include "./core/type.hpp"

@ -349,8 +349,6 @@ namespace detail
} }
//namespace detail //namespace detail
namespace gtc
{
/// @addtogroup gtc_half_float /// @addtogroup gtc_half_float
/// @{ /// @{
@ -419,7 +417,6 @@ namespace gtc
typedef detail::tmat4x4<detail::thalf> hmat4x4; typedef detail::tmat4x4<detail::thalf> hmat4x4;
/// @} /// @}
}// namespace gtc
}// namespace glm }// namespace glm
#include "half_float.inl" #include "half_float.inl"

@ -44,9 +44,8 @@
# pragma message("GLM: GLM_GTC_matrix_access extension included") # pragma message("GLM: GLM_GTC_matrix_access extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc{ {
/// @addtogroup gtc_matrix_access /// @addtogroup gtc_matrix_access
/// @{ /// @{
@ -81,7 +80,6 @@ namespace gtc{
typename genType::col_type const & x); typename genType::col_type const & x);
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#include "matrix_access.inl" #include "matrix_access.inl"

@ -8,50 +8,48 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtc
{ template <typename genType>
template <typename genType> GLM_FUNC_QUALIFIER genType row(
GLM_FUNC_QUALIFIER genType row(
genType const & m, genType const & m,
int index, int index,
typename genType::row_type const & x) typename genType::row_type const & x)
{ {
genType Result = m; genType Result = m;
for(typename genType::size_type i = 0; i < genType::row_size(); ++i) for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
Result[i][index] = x[i]; Result[i][index] = x[i];
return Result; return Result;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER typename genType::row_type row( GLM_FUNC_QUALIFIER typename genType::row_type row(
genType const & m, genType const & m,
int index) int index)
{ {
typename genType::row_type Result; typename genType::row_type Result;
for(typename genType::size_type i = 0; i < genType::row_size(); ++i) for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
Result[i] = m[i][index]; Result[i] = m[i][index];
return Result; return Result;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType column( GLM_FUNC_QUALIFIER genType column(
genType const & m, genType const & m,
int index, int index,
typename genType::col_type const & x) typename genType::col_type const & x)
{ {
genType Result = m; genType Result = m;
Result[index] = x; Result[index] = x;
return Result; return Result;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER typename genType::col_type column( GLM_FUNC_QUALIFIER typename genType::col_type column(
genType const & m, genType const & m,
int index) int index)
{ {
return m[index]; return m[index];
} }
}//namespace gtc
}//namespace glm }//namespace glm

@ -44,10 +44,9 @@
# pragma message("GLM: GLM_GTC_matrix_integer extension included") # pragma message("GLM: GLM_GTC_matrix_integer extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc{ {
/// @addtogroup gtc_matrix_integer
/// \addtogroup gtc_matrix_integer
/// @{ /// @{
typedef detail::tmat2x2<highp_int> highp_imat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension) typedef detail::tmat2x2<highp_int> highp_imat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
@ -217,7 +216,6 @@ namespace gtc{
#endif//GLM_PRECISION #endif//GLM_PRECISION
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#endif//glm_gtc_matrix_integer #endif//glm_gtc_matrix_integer

@ -44,8 +44,7 @@
# pragma message("GLM: GLM_GTC_matrix_inverse extension included") # pragma message("GLM: GLM_GTC_matrix_inverse extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc
{ {
/// @addtogroup gtc_matrix_inverse /// @addtogroup gtc_matrix_inverse
/// @{ /// @{
@ -62,7 +61,6 @@ namespace gtc
genType const & m); genType const & m);
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#include "matrix_inverse.inl" #include "matrix_inverse.inl"

@ -8,40 +8,39 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtc{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> affineInverse GLM_FUNC_QUALIFIER detail::tmat3x3<T> affineInverse
( (
detail::tmat3x3<T> const & m detail::tmat3x3<T> const & m
) )
{ {
detail::tmat3x3<T> Result(m); detail::tmat3x3<T> Result(m);
Result[2] = detail::tvec3<T>(0, 0, 1); Result[2] = detail::tvec3<T>(0, 0, 1);
Result = transpose(Result); Result = transpose(Result);
detail::tvec3<T> Translation = Result * detail::tvec3<T>(-detail::tvec2<T>(m[2]), m[2][2]); detail::tvec3<T> Translation = Result * detail::tvec3<T>(-detail::tvec2<T>(m[2]), m[2][2]);
Result[2] = Translation; Result[2] = Translation;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> affineInverse GLM_FUNC_QUALIFIER detail::tmat4x4<T> affineInverse
( (
detail::tmat4x4<T> const & m detail::tmat4x4<T> const & m
) )
{ {
detail::tmat4x4<T> Result(m); detail::tmat4x4<T> Result(m);
Result[3] = detail::tvec4<T>(0, 0, 0, 1); Result[3] = detail::tvec4<T>(0, 0, 0, 1);
Result = transpose(Result); Result = transpose(Result);
detail::tvec4<T> Translation = Result * detail::tvec4<T>(-detail::tvec3<T>(m[3]), m[3][3]); detail::tvec4<T> Translation = Result * detail::tvec4<T>(-detail::tvec3<T>(m[3]), m[3][3]);
Result[3] = Translation; Result[3] = Translation;
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose( GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose(
detail::tmat2x2<valType> const & m) detail::tmat2x2<valType> const & m)
{ {
valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
detail::tmat2x2<valType> Inverse( detail::tmat2x2<valType> Inverse(
@ -51,12 +50,12 @@ namespace gtc{
+ m[0][0] / Determinant); + m[0][0] / Determinant);
return Inverse; return Inverse;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose( GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose(
detail::tmat3x3<valType> const & m) detail::tmat3x3<valType> const & m)
{ {
valType Determinant = valType Determinant =
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) + m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
- m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
@ -75,12 +74,12 @@ namespace gtc{
Inverse /= Determinant; Inverse /= Determinant;
return Inverse; return Inverse;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose( GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose(
detail::tmat4x4<valType> const & m) detail::tmat4x4<valType> const & m)
{ {
valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
@ -131,7 +130,6 @@ namespace gtc{
Inverse /= Determinant; Inverse /= Determinant;
return Inverse; return Inverse;
} }
}//namespace gtc
}//namespace glm }//namespace glm

@ -53,8 +53,7 @@
# pragma message("GLM: GLM_GTC_matrix_transform extension included") # pragma message("GLM: GLM_GTC_matrix_transform extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc
{ {
/// @addtogroup gtc_matrix_transform /// @addtogroup gtc_matrix_transform
/// @{ /// @{
@ -62,9 +61,9 @@ namespace gtc
/// Builds a translation 4 * 4 matrix created from a vector of 3 components. /// Builds a translation 4 * 4 matrix created from a vector of 3 components.
/// @see - gtc_matrix_transform /// @see - gtc_matrix_transform
/// @see - gtx_transform: /// @see - gtx_transform:
/// - @link glm::gtx::translate(T x, T y, T z) translate(T x, T y, T z) @endlink /// - @link translate(T x, T y, T z) translate(T x, T y, T z) @endlink
/// - @link glm::gtx::translate(detail::tmat4x4<T> const & m, T x, T y, T z) translate(mat4x4<T> const & m, T x, T y, T z) @endlink /// - @link translate(detail::tmat4x4<T> const & m, T x, T y, T z) translate(mat4x4<T> const & m, T x, T y, T z) @endlink
/// - @link glm::gtx::translate(detail::tvec3<T> const & v) translate(vec3<T> const & v) @endlink /// - @link translate(detail::tvec3<T> const & v) translate(vec3<T> const & v) @endlink
template <typename T> template <typename T>
detail::tmat4x4<T> translate( detail::tmat4x4<T> translate(
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
@ -73,9 +72,9 @@ namespace gtc
/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle expressed in degrees. /// Builds a rotation 4 * 4 matrix created from an axis vector and an angle expressed in degrees.
/// @see - gtc_matrix_transform /// @see - gtc_matrix_transform
/// @see - gtx_transform: /// @see - gtx_transform:
/// - @link glm::gtx::rotate(T angle, T x, T y, T z) rotate(T const & angle, T const & x, T const & y, T const & z) @endlink /// - @link rotate(T angle, T x, T y, T z) rotate(T const & angle, T const & x, T const & y, T const & z) @endlink
/// - @link glm::gtx::rotate(detail::tmat4x4<T> const & m, T angle, T x, T y, T z) rotate(mat4x4<T> const & m, T const & angle, T const & x, T const & y, T const & z) @endlink /// - @link rotate(detail::tmat4x4<T> const & m, T angle, T x, T y, T z) rotate(mat4x4<T> const & m, T const & angle, T const & x, T const & y, T const & z) @endlink
/// - @link glm::gtx::rotate(T angle, detail::tvec3<T> const & v) rotate(T const & angle, vec3<T> const & v) @endlink /// - @link rotate(T angle, detail::tvec3<T> const & v) rotate(T const & angle, vec3<T> const & v) @endlink
template <typename T> template <typename T>
detail::tmat4x4<T> rotate( detail::tmat4x4<T> rotate(
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
@ -85,9 +84,9 @@ namespace gtc
/// Builds a scale 4 * 4 matrix created from 3 scalars. /// Builds a scale 4 * 4 matrix created from 3 scalars.
/// @see - gtc_matrix_transform /// @see - gtc_matrix_transform
/// @see - gtx_transform: /// @see - gtx_transform:
/// - @link glm::gtx::scale(T x, T y, T z) scale(T const & x, T const & y, T const & z) @endlink /// - @link scale(T x, T y, T z) scale(T const & x, T const & y, T const & z) @endlink
/// - @link glm::gtx::scale(detail::tmat4x4<T> const & m, T x, T y, T z) scale(mat4x4<T> const & m, T const & angle, T const & x, T const & y, T const & z) @endlink /// - @link scale(detail::tmat4x4<T> const & m, T x, T y, T z) scale(mat4x4<T> const & m, T const & angle, T const & x, T const & y, T const & z) @endlink
/// - @link glm::gtx::scale(detail::tvec3<T> const & v) scale(vec3<T> const & v) @endlink /// - @link scale(detail::tvec3<T> const & v) scale(vec3<T> const & v) @endlink
template <typename T> template <typename T>
detail::tmat4x4<T> scale( detail::tmat4x4<T> scale(
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
@ -95,7 +94,7 @@ namespace gtc
/// Creates a matrix for an orthographic parallel viewing volume. /// Creates a matrix for an orthographic parallel viewing volume.
/// @see - gtc_matrix_transform: /// @see - gtc_matrix_transform:
/// - @link glm::gtc::ortho(T const & left, T const & right, T const & bottom, T const & top) ortho(T const & left, T const & right, T const & bottom, T const & top) @endlink /// - @link glm::ortho(T const & left, T const & right, T const & bottom, T const & top) ortho(T const & left, T const & right, T const & bottom, T const & top) @endlink
template <typename T> template <typename T>
detail::tmat4x4<T> ortho( detail::tmat4x4<T> ortho(
T const & left, T const & left,
@ -107,7 +106,7 @@ namespace gtc
/// Creates a matrix for projecting two-dimensional coordinates onto the screen. /// Creates a matrix for projecting two-dimensional coordinates onto the screen.
/// @see - gtc_matrix_transform: /// @see - gtc_matrix_transform:
/// - @link glm::gtc::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar) ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar) @endlink /// - @link glm::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar) ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar) @endlink
template <typename T> template <typename T>
detail::tmat4x4<T> ortho( detail::tmat4x4<T> ortho(
T const & left, T const & left,
@ -196,7 +195,6 @@ namespace gtc
detail::tvec3<T> const & up); detail::tvec3<T> const & up);
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#include "matrix_transform.inl" #include "matrix_transform.inl"

@ -8,28 +8,27 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtc{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate
( (
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
detail::tmat4x4<T> Result(m); detail::tmat4x4<T> Result(m);
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate
( (
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
T const & angle, T const & angle,
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
T a = radians(angle); T a = radians(angle);
T c = cos(a); T c = cos(a);
T s = sin(a); T s = sin(a);
@ -57,30 +56,30 @@ namespace gtc{
Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2]; Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
Result[3] = m[3]; Result[3] = m[3];
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale
( (
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
detail::tmat4x4<T> Result(detail::tmat4x4<T>::null); detail::tmat4x4<T> Result(detail::tmat4x4<T>::null);
Result[0] = m[0] * v[0]; Result[0] = m[0] * v[0];
Result[1] = m[1] * v[1]; Result[1] = m[1] * v[1];
Result[2] = m[2] * v[2]; Result[2] = m[2] * v[2];
Result[3] = m[3]; Result[3] = m[3];
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate_slow GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate_slow
( (
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
detail::tmat4x4<T> Result(T(1)); detail::tmat4x4<T> Result(T(1));
Result[3] = detail::tvec4<T>(v, T(1)); Result[3] = detail::tvec4<T>(v, T(1));
return m * Result; return m * Result;
@ -92,16 +91,16 @@ namespace gtc{
//Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2]; //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]; //Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3];
//return Result; //return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate_slow GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate_slow
( (
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
T const & angle, T const & angle,
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
T a = radians(angle); T a = radians(angle);
T c = cos(a); T c = cos(a);
T s = sin(a); T s = sin(a);
@ -126,33 +125,33 @@ namespace gtc{
Result[3] = detail::tvec4<T>(0, 0, 0, 1); Result[3] = detail::tvec4<T>(0, 0, 0, 1);
return m * Result; return m * Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale_slow GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale_slow
( (
detail::tmat4x4<T> const & m, detail::tmat4x4<T> const & m,
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
detail::tmat4x4<T> Result(T(1)); detail::tmat4x4<T> Result(T(1));
Result[0][0] = v.x; Result[0][0] = v.x;
Result[1][1] = v.y; Result[1][1] = v.y;
Result[2][2] = v.z; Result[2][2] = v.z;
return m * Result; return m * Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho
( (
valType const & left, valType const & left,
valType const & right, valType const & right,
valType const & bottom, valType const & bottom,
valType const & top, valType const & top,
valType const & zNear, valType const & zNear,
valType const & zFar valType const & zFar
) )
{ {
detail::tmat4x4<valType> Result(1); detail::tmat4x4<valType> Result(1);
Result[0][0] = valType(2) / (right - left); Result[0][0] = valType(2) / (right - left);
Result[1][1] = valType(2) / (top - bottom); Result[1][1] = valType(2) / (top - bottom);
@ -161,15 +160,15 @@ namespace gtc{
Result[3][1] = - (top + bottom) / (top - bottom); Result[3][1] = - (top + bottom) / (top - bottom);
Result[3][2] = - (zFar + zNear) / (zFar - zNear); Result[3][2] = - (zFar + zNear) / (zFar - zNear);
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho( GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho(
valType const & left, valType const & left,
valType const & right, valType const & right,
valType const & bottom, valType const & bottom,
valType const & top) valType const & top)
{ {
detail::tmat4x4<valType> Result(1); detail::tmat4x4<valType> Result(1);
Result[0][0] = valType(2) / (right - left); Result[0][0] = valType(2) / (right - left);
Result[1][1] = valType(2) / (top - bottom); Result[1][1] = valType(2) / (top - bottom);
@ -177,19 +176,19 @@ namespace gtc{
Result[3][0] = - (right + left) / (right - left); Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom); Result[3][1] = - (top + bottom) / (top - bottom);
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> frustum GLM_FUNC_QUALIFIER detail::tmat4x4<valType> frustum
( (
valType const & left, valType const & left,
valType const & right, valType const & right,
valType const & bottom, valType const & bottom,
valType const & top, valType const & top,
valType const & nearVal, valType const & nearVal,
valType const & farVal valType const & farVal
) )
{ {
detail::tmat4x4<valType> Result(0); detail::tmat4x4<valType> Result(0);
Result[0][0] = (valType(2) * nearVal) / (right - left); Result[0][0] = (valType(2) * nearVal) / (right - left);
Result[1][1] = (valType(2) * nearVal) / (top - bottom); Result[1][1] = (valType(2) * nearVal) / (top - bottom);
@ -199,17 +198,17 @@ namespace gtc{
Result[2][3] = valType(-1); Result[2][3] = valType(-1);
Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal); Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal);
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspective GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspective
( (
valType const & fovy, valType const & fovy,
valType const & aspect, valType const & aspect,
valType const & zNear, valType const & zNear,
valType const & zFar valType const & zFar
) )
{ {
valType range = tan(radians(fovy / valType(2))) * zNear; valType range = tan(radians(fovy / valType(2))) * zNear;
valType left = -range * aspect; valType left = -range * aspect;
valType right = range * aspect; valType right = range * aspect;
@ -223,18 +222,18 @@ namespace gtc{
Result[2][3] = - valType(1); Result[2][3] = - valType(1);
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear); Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspectiveFov GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspectiveFov
( (
valType const & fov, valType const & fov,
valType const & width, valType const & width,
valType const & height, valType const & height,
valType const & zNear, valType const & zNear,
valType const & zFar valType const & zFar
) )
{ {
valType rad = glm::radians(fov); valType rad = glm::radians(fov);
valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad); valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad);
valType w = h * height / width; valType w = h * height / width;
@ -246,16 +245,16 @@ namespace gtc{
Result[2][3] = valType(1); Result[2][3] = valType(1);
Result[3][2] = -(valType(2) * zFar * zNear) / (zFar - zNear); Result[3][2] = -(valType(2) * zFar * zNear) / (zFar - zNear);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> infinitePerspective GLM_FUNC_QUALIFIER detail::tmat4x4<T> infinitePerspective
( (
T fovy, T fovy,
T aspect, T aspect,
T zNear T zNear
) )
{ {
T range = tan(radians(fovy / T(2))) * zNear; T range = tan(radians(fovy / T(2))) * zNear;
T left = -range * aspect; T left = -range * aspect;
T right = range * aspect; T right = range * aspect;
@ -269,16 +268,16 @@ namespace gtc{
Result[2][3] = - T(1); Result[2][3] = - T(1);
Result[3][2] = - T(2) * zNear; Result[3][2] = - T(2) * zNear;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> tweakedInfinitePerspective GLM_FUNC_QUALIFIER detail::tmat4x4<T> tweakedInfinitePerspective
( (
T fovy, T fovy,
T aspect, T aspect,
T zNear T zNear
) )
{ {
T range = tan(radians(fovy / T(2))) * zNear; T range = tan(radians(fovy / T(2))) * zNear;
T left = -range * aspect; T left = -range * aspect;
T right = range * aspect; T right = range * aspect;
@ -292,17 +291,17 @@ namespace gtc{
Result[2][3] = T(-1); Result[2][3] = T(-1);
Result[3][2] = - (T(0.0001) - T(2)) * zNear; Result[3][2] = - (T(0.0001) - T(2)) * zNear;
return Result; return Result;
} }
template <typename T, typename U> template <typename T, typename U>
GLM_FUNC_QUALIFIER detail::tvec3<T> project GLM_FUNC_QUALIFIER detail::tvec3<T> project
( (
detail::tvec3<T> const & obj, detail::tvec3<T> const & obj,
detail::tmat4x4<T> const & model, detail::tmat4x4<T> const & model,
detail::tmat4x4<T> const & proj, detail::tmat4x4<T> const & proj,
detail::tvec4<U> const & viewport detail::tvec4<U> const & viewport
) )
{ {
detail::tvec4<T> tmp = detail::tvec4<T>(obj, T(1)); detail::tvec4<T> tmp = detail::tvec4<T>(obj, T(1));
tmp = model * tmp; tmp = model * tmp;
tmp = proj * tmp; tmp = proj * tmp;
@ -313,17 +312,17 @@ namespace gtc{
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]); tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
return detail::tvec3<T>(tmp); return detail::tvec3<T>(tmp);
} }
template <typename T, typename U> template <typename T, typename U>
GLM_FUNC_QUALIFIER detail::tvec3<T> unProject GLM_FUNC_QUALIFIER detail::tvec3<T> unProject
( (
detail::tvec3<T> const & win, detail::tvec3<T> const & win,
detail::tmat4x4<T> const & model, detail::tmat4x4<T> const & model,
detail::tmat4x4<T> const & proj, detail::tmat4x4<T> const & proj,
detail::tvec4<U> const & viewport detail::tvec4<U> const & viewport
) )
{ {
detail::tmat4x4<T> inverse = glm::inverse(proj * model); detail::tmat4x4<T> inverse = glm::inverse(proj * model);
detail::tvec4<T> tmp = detail::tvec4<T>(win, T(1)); detail::tvec4<T> tmp = detail::tvec4<T>(win, T(1));
@ -335,16 +334,16 @@ namespace gtc{
obj /= obj.w; obj /= obj.w;
return detail::tvec3<T>(obj); return detail::tvec3<T>(obj);
} }
template <typename T, typename U> template <typename T, typename U>
detail::tmat4x4<T> pickMatrix detail::tmat4x4<T> pickMatrix
( (
detail::tvec2<T> const & center, detail::tvec2<T> const & center,
detail::tvec2<T> const & delta, detail::tvec2<T> const & delta,
detail::tvec4<U> const & viewport detail::tvec4<U> const & viewport
) )
{ {
assert(delta.x > T(0) && delta.y > T(0)); assert(delta.x > T(0) && delta.y > T(0));
detail::tmat4x4<T> Result(1.0f); detail::tmat4x4<T> Result(1.0f);
@ -359,16 +358,16 @@ namespace gtc{
// Translate and scale the picked region to the entire window // Translate and scale the picked region to the entire window
Result = translate(Result, Temp); Result = translate(Result, Temp);
return scale(Result, detail::tvec3<T>(T(viewport[2]) / delta.x, T(viewport[3]) / delta.y, T(1))); return scale(Result, detail::tvec3<T>(T(viewport[2]) / delta.x, T(viewport[3]) / delta.y, T(1)));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> lookAt GLM_FUNC_QUALIFIER detail::tmat4x4<T> lookAt
( (
detail::tvec3<T> const & eye, detail::tvec3<T> const & eye,
detail::tvec3<T> const & center, detail::tvec3<T> const & center,
detail::tvec3<T> const & up detail::tvec3<T> const & up
) )
{ {
detail::tvec3<T> f = normalize(center - eye); detail::tvec3<T> f = normalize(center - eye);
detail::tvec3<T> u = normalize(up); detail::tvec3<T> u = normalize(up);
detail::tvec3<T> s = normalize(cross(f, u)); detail::tvec3<T> s = normalize(cross(f, u));
@ -384,13 +383,12 @@ namespace gtc{
Result[0][2] =-f.x; Result[0][2] =-f.x;
Result[1][2] =-f.y; Result[1][2] =-f.y;
Result[2][2] =-f.z; Result[2][2] =-f.z;
/* Test this instead of translate3D /* Test this instead of translate3D
Result[3][0] =-dot(s, eye); Result[3][0] =-dot(s, eye);
Result[3][1] =-dot(y, eye); Result[3][1] =-dot(y, eye);
Result[3][2] = dot(f, eye); Result[3][2] = dot(f, eye);
*/ */
return gtc::translate(Result, -eye); return translate(Result, -eye);
} }
}//namespace gtc
}//namespace glm }//namespace glm

@ -73,7 +73,7 @@ namespace detail
tquat(); tquat();
explicit tquat( explicit tquat(
value_type const & s, value_type const & s,
tvec3<T> const & v); glm::detail::tvec3<T> const & v);
explicit tquat( explicit tquat(
value_type const & w, value_type const & w,
value_type const & x, value_type const & x,
@ -150,8 +150,6 @@ namespace detail
} //namespace detail } //namespace detail
namespace gtc{
/// @addtogroup gtc_quaternion /// @addtogroup gtc_quaternion
/// @{ /// @{
@ -255,7 +253,6 @@ namespace gtc{
typedef detail::tquat<highp_float> highp_quat; typedef detail::tquat<highp_float> highp_quat;
/// @} /// @}
} //namespace gtc
} //namespace glm } //namespace glm
#include "quaternion.inl" #include "quaternion.inl"

@ -211,7 +211,7 @@ namespace detail{
detail::tquat<T> const & q detail::tquat<T> const & q
) )
{ {
return gtc::inverse(q) * v; return inverse(q) * v;
} }
template <typename T> template <typename T>
@ -231,7 +231,7 @@ namespace detail{
detail::tquat<T> const & q detail::tquat<T> const & q
) )
{ {
return gtc::inverse(q) * v; return inverse(q) * v;
} }
template <typename T> template <typename T>
@ -291,8 +291,6 @@ namespace detail{
}//namespace detail }//namespace detail
namespace gtc{
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T length GLM_FUNC_QUALIFIER T length
@ -447,7 +445,7 @@ namespace gtc{
detail::tquat<T> const & q detail::tquat<T> const & q
) )
{ {
return gtc::conjugate(q) / gtc::dot(q, q); return conjugate(q) / dot(q, q);
} }
template <typename T> template <typename T>
@ -473,7 +471,7 @@ namespace gtc{
typename detail::tquat<T>::value_type AngleRad = radians(angle); typename detail::tquat<T>::value_type AngleRad = radians(angle);
typename detail::tquat<T>::value_type fSin = sin(AngleRad * T(0.5)); typename detail::tquat<T>::value_type fSin = sin(AngleRad * T(0.5));
return gtc::cross(q, detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); return cross(q, detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
} }
template <typename T> template <typename T>
@ -578,5 +576,4 @@ namespace gtc{
return quat_cast(detail::tmat3x3<T>(m4)); return quat_cast(detail::tmat3x3<T>(m4));
} }
}//namespace gtc
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTC_swizzle extension included") # pragma message("GLM: GLM_GTC_swizzle extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc
{ {
/// @addtogroup gtc_swizzle /// @addtogroup gtc_swizzle
/// @{ /// @{
@ -369,7 +368,6 @@ namespace gtc
static_swizzle4_ref(glm::u64, 4) static_swizzle4_ref(glm::u64, 4)
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#include "swizzle.inl" #include "swizzle.inl"

@ -11,7 +11,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtc{
template <typename T, template <typename> class vecType> template <typename T, template <typename> class vecType>
GLM_FUNC_QUALIFIER T swizzle GLM_FUNC_QUALIFIER T swizzle
@ -172,5 +171,4 @@ GLM_FUNC_QUALIFIER detail::tref4<int> swizzle
} }
*/ */
}//namespace gtc
}//namespace glm }//namespace glm

@ -52,9 +52,8 @@
# pragma message("GLM: GLM_GTC_type_precision extension included") # pragma message("GLM: GLM_GTC_type_precision extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc{ {
/////////////////////////// ///////////////////////////
// Signed int vector types // Signed int vector types
@ -229,7 +228,6 @@ namespace gtc{
typedef detail::tquat<f64> f64quat; //!< \brief Double-precision floating-point quaternion. (from GLM_GTC_type_precision extension) typedef detail::tquat<f64> f64quat; //!< \brief Double-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#include "type_precision.inl" #include "type_precision.inl"

@ -69,8 +69,7 @@
# pragma message("GLM: GLM_GTC_type_ptr extension included") # pragma message("GLM: GLM_GTC_type_ptr extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtc
{ {
/// @addtogroup gtc_type_ptr /// @addtogroup gtc_type_ptr
/// @{ /// @{
@ -502,7 +501,6 @@ namespace gtc
} }
/// @} /// @}
}//namespace gtc
}//namespace glm }//namespace glm
#include "type_ptr.inl" #include "type_ptr.inl"

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_associated_min_max extension included") # pragma message("GLM: GLM_GTX_associated_min_max extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_associated_min_max /// @addtogroup gtx_associated_min_max
/// @{ /// @{
@ -94,7 +93,6 @@ namespace gtx
const genTypeT& w, const genTypeU& d); const genTypeT& w, const genTypeU& d);
/// @} /// @}
} //namespace gtx
} //namespace glm } //namespace glm
#include "associated_min_max.inl" #include "associated_min_max.inl"

File diff suppressed because it is too large Load Diff

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_bit extension included") # pragma message("GLM: GLM_GTX_bit extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_bit /// @addtogroup gtx_bit
/// @{ /// @{
@ -134,7 +133,6 @@ namespace gtx
int const & ToBit); int const & ToBit);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "bit.inl" #include "bit.inl"

@ -10,7 +10,6 @@
#include "../core/_detail.hpp" #include "../core/_detail.hpp"
namespace glm{ namespace glm{
namespace gtx{
template <typename genIType> template <typename genIType>
GLM_FUNC_QUALIFIER genIType mask GLM_FUNC_QUALIFIER genIType mask
@ -61,13 +60,13 @@ GLM_FUNC_QUALIFIER detail::tvec4<valIType> mask
template <typename genIType> template <typename genIType>
GLM_FUNC_QUALIFIER genIType extractField GLM_FUNC_QUALIFIER genIType extractField
( (
gtc::half const & value, half const & value,
genIType const & first, genIType const & first,
genIType const & count genIType const & count
) )
{ {
assert(first + count < sizeof(gtc::half)); assert(first + count < sizeof(half));
return (value._data() << first) >> ((sizeof(gtc::half) << 3) - count); return (value._data() << first) >> ((sizeof(half) << 3) - count);
} }
template <typename genIType> template <typename genIType>
@ -771,5 +770,4 @@ GLM_FUNC_QUALIFIER genIUType fillBitfieldWithZero
return Result; return Result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_closest_point extension included") # pragma message("GLM: GLM_GTX_closest_point extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_closest_point /// @addtogroup gtx_closest_point
/// @{ /// @{
@ -60,7 +59,6 @@ namespace gtx
detail::tvec3<T> const & b); detail::tvec3<T> const & b);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "closest_point.inl" #include "closest_point.inl"

@ -11,7 +11,6 @@
#define glm_gtx_closest_point #define glm_gtx_closest_point
namespace glm{ namespace glm{
namespace gtx{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
@ -33,7 +32,6 @@ GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
return a + LineDirection * Distance; return a + LineDirection * Distance;
} }
}//namespace gtx
}//namespace glm }//namespace glm
#endif//glm_gtx_closest_point #endif//glm_gtx_closest_point

@ -47,78 +47,76 @@
# pragma message("GLM: GLM_GTX_color_cast extension included") # pragma message("GLM: GLM_GTX_color_cast extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_color_cast /// @addtogroup gtx_color_cast
/// @{ /// @{
//! Conversion of a floating value into a 8bit unsigned int value. //! Conversion of a floating value into a 8bit unsigned int value.
//! From GLM_GTX_color_cast extension. //! From GLM_GTX_color_cast extension.
template <typename valType> gtc::uint8 u8channel_cast(valType a); template <typename valType> uint8 u8channel_cast(valType a);
//! Conversion of a floating value into a 16bit unsigned int value. //! Conversion of a floating value into a 16bit unsigned int value.
//! From GLM_GTX_color_cast extension. //! From GLM_GTX_color_cast extension.
template <typename valType> gtc::uint16 u16channel_cast(valType a); template <typename valType> uint16 u16channel_cast(valType a);
template <typename T> gtc::uint32 u32_rgbx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_rgbx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_xrgb_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_xrgb_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_bgrx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_bgrx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_xbgr_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_xbgr_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_rgba_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_rgba_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_argb_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_argb_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_bgra_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_bgra_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint32 u32_abgr_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint32 u32_abgr_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_rgbx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_rgbx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_xrgb_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_xrgb_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_bgrx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_bgrx_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_xbgr_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_xbgr_cast(const detail::tvec3<T>& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_rgba_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_rgba_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_argb_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_argb_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_bgra_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_bgra_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::uint64 u64_abgr_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) template <typename T> uint64 u64_abgr_cast(const detail::tvec4<T>& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
template <typename T> gtx::f16vec1 f16_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension) template <typename T> f16 f16_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec3 f16_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec3 f16_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec3 f16_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec3 f16_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec3 f16_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec3 f16_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec3 f16_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec3 f16_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec4 f16_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec4 f16_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec4 f16_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec4 f16_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec4 f16_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec4 f16_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f16vec4 f16_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f16vec4 f16_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtx::f32vec1 f32_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension) template <typename T> f32 f32_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec3 f32_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec3 f32_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec3 f32_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec3 f32_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec3 f32_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec3 f32_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec3 f32_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec3 f32_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec4 f32_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec4 f32_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec4 f32_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec4 f32_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec4 f32_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec4 f32_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f32vec4 f32_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f32vec4 f32_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtx::f64vec1 f64_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension) template <typename T> f64 f64_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec3 f64_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec3 f64_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec3 f64_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec3 f64_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec3 f64_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec3 f64_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec3 f64_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec3 f64_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec4 f64_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec4 f64_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec4 f64_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec4 f64_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec4 f64_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec4 f64_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
template <typename T> gtc::f64vec4 f64_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) template <typename T> f64vec4 f64_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "color_cast.inl" #include "color_cast.inl"

@ -8,213 +8,212 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint8 u8channel_cast(T a) GLM_FUNC_QUALIFIER uint8 u8channel_cast(T a)
{ {
return static_cast<gtc::uint8>(a * T(255)); return static_cast<uint8>(a * T(255));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint16 u16channel_cast(T a) GLM_FUNC_QUALIFIER uint16 u16channel_cast(T a)
{ {
return static_cast<gtc::uint16>(a * T(65535)); return static_cast<uint16>(a * T(65535));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_rgbx_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint32 u32_rgbx_cast(const detail::tvec3<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 0; result += static_cast<uint32>(c.x * detail::tvec3<T>::value_type(255)) << 0;
result += static_cast<gtc::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 8; result += static_cast<uint32>(c.y * detail::tvec3<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 16; result += static_cast<uint32>(c.z * detail::tvec3<T>::value_type(255)) << 16;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_xrgb_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint32 u32_xrgb_cast(const detail::tvec3<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 8; result += static_cast<uint32>(c.x * detail::tvec3<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 16; result += static_cast<uint32>(c.y * detail::tvec3<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 24; result += static_cast<uint32>(c.z * detail::tvec3<T>::value_type(255)) << 24;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_bgrx_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint32 u32_bgrx_cast(const detail::tvec3<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 16; result += static_cast<uint32>(c.x * detail::tvec3<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 8; result += static_cast<uint32>(c.y * detail::tvec3<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 0; result += static_cast<uint32>(c.z * detail::tvec3<T>::value_type(255)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_xbgr_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint32 u32_xbgr_cast(const detail::tvec3<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec3<T>::value_type(255)) << 24; result += static_cast<uint32>(c.x * detail::tvec3<T>::value_type(255)) << 24;
result += static_cast<gtc::uint32>(c.y * detail::tvec3<T>::value_type(255)) << 16; result += static_cast<uint32>(c.y * detail::tvec3<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.z * detail::tvec3<T>::value_type(255)) << 8; result += static_cast<uint32>(c.z * detail::tvec3<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.w * detail::tvec3<T>::value_type(255)) << 0; result += static_cast<uint32>(c.w * detail::tvec3<T>::value_type(255)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_rgba_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint32 u32_rgba_cast(const detail::tvec4<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 0; result += static_cast<uint32>(c.x * detail::tvec4<T>::value_type(255)) << 0;
result += static_cast<gtc::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 8; result += static_cast<uint32>(c.y * detail::tvec4<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 16; result += static_cast<uint32>(c.z * detail::tvec4<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 24; result += static_cast<uint32>(c.w * detail::tvec4<T>::value_type(255)) << 24;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_argb_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint32 u32_argb_cast(const detail::tvec4<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 8; result += static_cast<uint32>(c.x * detail::tvec4<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 16; result += static_cast<uint32>(c.y * detail::tvec4<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 24; result += static_cast<uint32>(c.z * detail::tvec4<T>::value_type(255)) << 24;
result += static_cast<gtc::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 0; result += static_cast<uint32>(c.w * detail::tvec4<T>::value_type(255)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_bgra_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint32 u32_bgra_cast(const detail::tvec4<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 16; result += static_cast<uint32>(c.x * detail::tvec4<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 8; result += static_cast<uint32>(c.y * detail::tvec4<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 0; result += static_cast<uint32>(c.z * detail::tvec4<T>::value_type(255)) << 0;
result += static_cast<gtc::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 24; result += static_cast<uint32>(c.w * detail::tvec4<T>::value_type(255)) << 24;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint32 u32_abgr_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint32 u32_abgr_cast(const detail::tvec4<T>& c)
{ {
gtc::uint32 result = 0; uint32 result = 0;
result += static_cast<gtc::uint32>(c.x * detail::tvec4<T>::value_type(255)) << 24; result += static_cast<uint32>(c.x * detail::tvec4<T>::value_type(255)) << 24;
result += static_cast<gtc::uint32>(c.y * detail::tvec4<T>::value_type(255)) << 16; result += static_cast<uint32>(c.y * detail::tvec4<T>::value_type(255)) << 16;
result += static_cast<gtc::uint32>(c.z * detail::tvec4<T>::value_type(255)) << 8; result += static_cast<uint32>(c.z * detail::tvec4<T>::value_type(255)) << 8;
result += static_cast<gtc::uint32>(c.w * detail::tvec4<T>::value_type(255)) << 0; result += static_cast<uint32>(c.w * detail::tvec4<T>::value_type(255)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u64_rgbx_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint64 u64_rgbx_cast(const detail::tvec3<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 0;
result += static_cast<gtc::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 32;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u32_xrgb_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint64 u32_xrgb_cast(const detail::tvec3<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 48; result += static_cast<uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 48;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u32_bgrx_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint64 u32_bgrx_cast(const detail::tvec3<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u32_xbgr_cast(const detail::tvec3<T>& c) GLM_FUNC_QUALIFIER uint64 u32_xbgr_cast(const detail::tvec3<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 48; result += static_cast<uint64>(c.x * detail::tvec3<T>::value_type(65535)) << 48;
result += static_cast<gtc::uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.y * detail::tvec3<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.z * detail::tvec3<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.w * detail::tvec3<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.w * detail::tvec3<T>::value_type(65535)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u64_rgba_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint64 u64_rgba_cast(const detail::tvec4<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 0;
result += static_cast<gtc::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 48; result += static_cast<uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 48;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u64_argb_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint64 u64_argb_cast(const detail::tvec4<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 48; result += static_cast<uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 48;
result += static_cast<gtc::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 0;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u64_bgra_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint64 u64_bgra_cast(const detail::tvec4<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 0;
result += static_cast<gtc::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 48; result += static_cast<uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 48;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER gtc::uint64 u64_abgr_cast(const detail::tvec4<T>& c) GLM_FUNC_QUALIFIER uint64 u64_abgr_cast(const detail::tvec4<T>& c)
{ {
gtc::uint64 result = 0; uint64 result = 0;
result += static_cast<gtc::uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 48; result += static_cast<uint64>(c.x * detail::tvec4<T>::value_type(65535)) << 48;
result += static_cast<gtc::uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 32; result += static_cast<uint64>(c.y * detail::tvec4<T>::value_type(65535)) << 32;
result += static_cast<gtc::uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 16; result += static_cast<uint64>(c.z * detail::tvec4<T>::value_type(65535)) << 16;
result += static_cast<gtc::uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 0; result += static_cast<uint64>(c.w * detail::tvec4<T>::value_type(65535)) << 0;
return result; return result;
} }
template <> template <>
GLM_FUNC_QUALIFIER f16vec1 f16_channel_cast<gtc::uint32>(gtc::uint32 color) GLM_FUNC_QUALIFIER f16 f16_channel_cast<uint32>(uint32 color)
{ {
return gtc::f16(static_cast<float>(color >> 0) / static_cast<float>(255)); return f16(static_cast<float>(color >> 0) / static_cast<float>(255));
} }
template <> template <>
GLM_FUNC_QUALIFIER gtc::f16vec3 f16_rgbx_cast<gtc::uint32>(gtc::uint32 color) GLM_FUNC_QUALIFIER f16vec3 f16_rgbx_cast<uint32>(uint32 color)
{ {
gtc::f16vec3 result; f16vec3 result;
result.x = gtc::f16(static_cast<float>(color >> 0) / static_cast<float>(255)); result.x = f16(static_cast<float>(color >> 0) / static_cast<float>(255));
result.y = gtc::f16(static_cast<float>(color >> 8) / static_cast<float>(255)); result.y = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
result.z = gtc::f16(static_cast<float>(color >> 16) / static_cast<float>(255)); result.z = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
return result; return result;
} }
template <> template <>
GLM_FUNC_QUALIFIER gtc::f16vec3 f16_xrgb_cast<gtc::uint32>(gtc::uint32 color) GLM_FUNC_QUALIFIER f16vec3 f16_xrgb_cast<uint32>(uint32 color)
{ {
gtc::f16vec3 result; f16vec3 result;
result.x = gtc::f16(static_cast<float>(color >> 8) / static_cast<float>(255)); result.x = f16(static_cast<float>(color >> 8) / static_cast<float>(255));
result.y = gtc::f16(static_cast<float>(color >> 16) / static_cast<float>(255)); result.y = f16(static_cast<float>(color >> 16) / static_cast<float>(255));
result.z = gtc::f16(static_cast<float>(color >> 24) / static_cast<float>(255)); result.z = f16(static_cast<float>(color >> 24) / static_cast<float>(255));
return result; return result;
} }
@ -732,5 +731,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint64>(uint64 color)
return result; return result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_color_space extension included") # pragma message("GLM: GLM_GTX_color_space extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_color_space /// @addtogroup gtx_color_space
/// @{ /// @{
@ -90,7 +89,6 @@ namespace gtx
detail::tvec3<valType> const & color); detail::tvec3<valType> const & color);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "color_space.inl" #include "color_space.inl"

@ -8,11 +8,10 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rgbColor(const detail::tvec3<T>& hsvColor)
{ {
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rgbColor(const detail::tvec3<T>& hsvColor)
{
detail::tvec3<T> hsv = hsvColor; detail::tvec3<T> hsv = hsvColor;
detail::tvec3<T> rgbColor; detail::tvec3<T> rgbColor;
@ -65,11 +64,11 @@ namespace gtx
} }
return rgbColor; return rgbColor;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> hsvColor(const detail::tvec3<T>& rgbColor) GLM_FUNC_QUALIFIER detail::tvec3<T> hsvColor(const detail::tvec3<T>& rgbColor)
{ {
detail::tvec3<T> hsv = rgbColor; detail::tvec3<T> hsv = rgbColor;
float Min = min(min(rgbColor.r, rgbColor.g), rgbColor.b); float Min = min(min(rgbColor.r, rgbColor.g), rgbColor.b);
float Max = max(max(rgbColor.r, rgbColor.g), rgbColor.b); float Max = max(max(rgbColor.r, rgbColor.g), rgbColor.b);
@ -105,11 +104,11 @@ namespace gtx
} }
return hsv; return hsv;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> saturation(const T s) GLM_FUNC_QUALIFIER detail::tmat4x4<T> saturation(const T s)
{ {
detail::tvec3<T> rgbw = detail::tvec3<T>(T(0.2126), T(0.7152), T(0.0722)); detail::tvec3<T> rgbw = detail::tvec3<T>(T(0.2126), T(0.7152), T(0.0722));
T col0 = (T(1) - s) * rgbw.r; T col0 = (T(1) - s) * rgbw.r;
@ -127,26 +126,25 @@ namespace gtx
result[2][1] = col2; result[2][1] = col2;
result[2][2] = col2 + s; result[2][2] = col2 + s;
return result; return result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> saturation(const T s, const detail::tvec3<T>& color) GLM_FUNC_QUALIFIER detail::tvec3<T> saturation(const T s, const detail::tvec3<T>& color)
{ {
return detail::tvec3<T>(saturation(s) * detail::tvec4<T>(color, T(0))); return detail::tvec3<T>(saturation(s) * detail::tvec4<T>(color, T(0)));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> saturation(const T s, const detail::tvec4<T>& color) GLM_FUNC_QUALIFIER detail::tvec4<T> saturation(const T s, const detail::tvec4<T>& color)
{ {
return saturation(s) * color; return saturation(s) * color;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T luminosity(const detail::tvec3<T>& color) GLM_FUNC_QUALIFIER T luminosity(const detail::tvec3<T>& color)
{ {
const detail::tvec3<T> tmp = detail::tvec3<T>(0.33, 0.59, 0.11); const detail::tvec3<T> tmp = detail::tvec3<T>(0.33, 0.59, 0.11);
return dot(color, tmp); return dot(color, tmp);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") # pragma message("GLM: GLM_GTX_color_space_YCoCg extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_color_space_YCoCg /// @addtogroup gtx_color_space_YCoCg
/// @{ /// @{
@ -78,7 +77,6 @@ namespace gtx
detail::tvec3<valType> const & YCoCgColor); detail::tvec3<valType> const & YCoCgColor);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "color_space_YCoCg.inl" #include "color_space_YCoCg.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg
@ -63,5 +62,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCgR2rgb
return result; return result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -53,8 +53,7 @@
#include <cmath> #include <cmath>
#endif//GLM_COMPILER #endif//GLM_COMPILER
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_compatibility /// @addtogroup gtx_compatibility
/// @{ /// @{
@ -124,21 +123,21 @@ namespace gtx
typedef detail::tmat4x3<int> int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) typedef detail::tmat4x3<int> int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat4x4<int> int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef detail::tmat4x4<int> int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
typedef gtc::half half1; //!< \brief half-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) typedef detail::thalf half1; //!< \brief half-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension)
typedef detail::tvec2<gtc::half> half2; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) typedef detail::tvec2<detail::thalf> half2; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
typedef detail::tvec3<gtc::half> half3; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) typedef detail::tvec3<detail::thalf> half3; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
typedef detail::tvec4<gtc::half> half4; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) typedef detail::tvec4<detail::thalf> half4; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
typedef gtc::half half1x1; //!< \brief half-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) typedef detail::thalf half1x1; //!< \brief half-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)
typedef detail::tmat2x2<gtc::half> half2x2; //!< \brief half-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) typedef detail::tmat2x2<detail::thalf> half2x2; //!< \brief half-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat2x3<gtc::half> half2x3; //!< \brief half-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) typedef detail::tmat2x3<detail::thalf> half2x3; //!< \brief half-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat2x4<gtc::half> half2x4; //!< \brief half-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) typedef detail::tmat2x4<detail::thalf> half2x4; //!< \brief half-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat3x2<gtc::half> half3x2; //!< \brief half-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) typedef detail::tmat3x2<detail::thalf> half3x2; //!< \brief half-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat3x3<gtc::half> half3x3; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) typedef detail::tmat3x3<detail::thalf> half3x3; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat3x4<gtc::half> half3x4; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) typedef detail::tmat3x4<detail::thalf> half3x4; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat4x2<gtc::half> half4x2; //!< \brief half-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) typedef detail::tmat4x2<detail::thalf> half4x2; //!< \brief half-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat4x3<gtc::half> half4x3; //!< \brief half-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) typedef detail::tmat4x3<detail::thalf> half4x3; //!< \brief half-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)
typedef detail::tmat4x4<gtc::half> half4x4; //!< \brief half-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef detail::tmat4x4<detail::thalf> half4x4; //!< \brief half-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
typedef float float1; //!< \brief single-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) typedef float float1; //!< \brief single-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension)
typedef detail::tvec2<float> float2; //!< \brief single-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) typedef detail::tvec2<float> float2; //!< \brief single-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension)
@ -173,7 +172,6 @@ namespace gtx
typedef detail::tmat4x4<double> double4x4; //!< \brief double-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef detail::tmat4x4<double> double4x4; //!< \brief double-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "compatibility.inl" #include "compatibility.inl"

@ -8,8 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
namespace compatibility{
// isfinite // isfinite
template <typename genType> template <typename genType>
@ -136,6 +134,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> isnan(
isnan(x.w)); isnan(x.w));
} }
}//namespace compatibility
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_component_wise extension included") # pragma message("GLM: GLM_GTX_component_wise extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_component_wise /// @addtogroup gtx_component_wise
/// @{ /// @{
@ -76,7 +75,6 @@ namespace gtx
genType const & v); genType const & v);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "component_wise.inl" #include "component_wise.inl"

@ -8,43 +8,41 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
{ {
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
{
typename genType::size_type result = typename genType::value_type(0); typename genType::size_type result = typename genType::value_type(0);
for(typename genType::size_type i = 0; i < genType::value_size(); ++i) for(typename genType::size_type i = 0; i < genType::value_size(); ++i)
result += v[i]; result += v[i];
return result; return result;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v) GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v)
{ {
typename genType::value_type result = typename genType::value_type(1); typename genType::value_type result = typename genType::value_type(1);
for(typename genType::size_type i = 0; i < genType::value_size(); ++i) for(typename genType::size_type i = 0; i < genType::value_size(); ++i)
result *= v[i]; result *= v[i];
return result; return result;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v) GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v)
{ {
typename genType::value_type result = typename genType::value_type(v[0]); typename genType::value_type result = typename genType::value_type(v[0]);
for(typename genType::size_type i = 1; i < genType::value_size(); ++i) for(typename genType::size_type i = 1; i < genType::value_size(); ++i)
result = min(result, v[i]); result = min(result, v[i]);
return result; return result;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v) GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v)
{ {
typename genType::value_type result = typename genType::value_type(v[0]); typename genType::value_type result = typename genType::value_type(v[0]);
for(typename genType::size_type i = 1; i < genType::value_size(); ++i) for(typename genType::size_type i = 1; i < genType::value_size(); ++i)
result = max(result, v[i]); result = max(result, v[i]);
return result; return result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -49,8 +49,7 @@
# pragma message("GLM: GLM_GTX_epsilon extension included") # pragma message("GLM: GLM_GTX_epsilon extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_epsilon /// @addtogroup gtx_epsilon
/// @{ /// @{
@ -72,7 +71,6 @@ namespace gtx
genTypeU const & epsilon); genTypeU const & epsilon);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "epsilon.inl" #include "epsilon.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER bool equalEpsilon GLM_FUNC_QUALIFIER bool equalEpsilon
@ -228,5 +227,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
abs(x.w - y.w) >= epsilon.w); abs(x.w - y.w) >= epsilon.w);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -50,8 +50,7 @@
# pragma message("GLM: GLM_GTX_euler_angles extension included") # pragma message("GLM: GLM_GTX_euler_angles extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_euler_angles /// @addtogroup gtx_euler_angles
/// @{ /// @{
@ -153,7 +152,6 @@ namespace gtx
detail::tmat4x4<T> orientate4(detail::tvec3<T> const & angles); detail::tmat4x4<T> orientate4(detail::tvec3<T> const & angles);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "euler_angles.inl" #include "euler_angles.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleX GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleX
@ -243,5 +242,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> orientate4
return yawPitchRoll(angles.z, angles.x, angles.y); return yawPitchRoll(angles.z, angles.x, angles.y);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_extend extension included") # pragma message("GLM: GLM_GTX_extend extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_extend /// @addtogroup gtx_extend
/// @{ /// @{
@ -60,7 +59,6 @@ namespace gtx
typename genType::value_type const Length); typename genType::value_type const Length);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "extend.inl" #include "extend.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename genType> template <typename genType>
genType extend genType extend
@ -54,5 +53,4 @@ detail::tvec4<valType> extend
return Origin + (Source - Origin) * Distance; return Origin + (Source - Origin) * Distance;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_extented_min_max extension included") # pragma message("GLM: GLM_GTX_extented_min_max extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_extented_min_max /// @addtogroup gtx_extented_min_max
/// @{ /// @{
@ -188,7 +187,6 @@ namespace gtx
C<T> const & w); C<T> const & w);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "extented_min_max.inl" #include "extented_min_max.inl"

@ -7,8 +7,7 @@
// File : gtx_extented_min_max.inl // File : gtx_extented_min_max.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
namespace gtx
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T min( GLM_FUNC_QUALIFIER T min(
@ -176,5 +175,4 @@ namespace gtx
return glm::max(glm::max(x, y), glm::max(z, w)); return glm::max(glm::max(x, y), glm::max(z, w));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_fast_exponential extension included") # pragma message("GLM: GLM_GTX_fast_exponential extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_fast_exponential /// @addtogroup gtx_fast_exponential
/// @{ /// @{
@ -93,7 +92,6 @@ namespace gtx
T fastLn(const T& x); T fastLn(const T& x);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "fast_exponential.inl" #include "fast_exponential.inl"

@ -8,95 +8,94 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
// fastPow:
template <typename T>
GLM_FUNC_QUALIFIER T fastPow(const T x, const T y)
{ {
// fastPow:
template <typename T>
GLM_FUNC_QUALIFIER T fastPow(const T x, const T y)
{
return exp(y * log(x)); return exp(y * log(x));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow( GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow(
const detail::tvec2<T>& x, const detail::tvec2<T>& x,
const detail::tvec2<T>& y) const detail::tvec2<T>& y)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y)); fastPow(x.y, y.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow( GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow(
const detail::tvec3<T>& x, const detail::tvec3<T>& x,
const detail::tvec3<T>& y) const detail::tvec3<T>& y)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y), fastPow(x.y, y.y),
fastPow(x.z, y.z)); fastPow(x.z, y.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow( GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow(
const detail::tvec4<T>& x, const detail::tvec4<T>& x,
const detail::tvec4<T>& y) const detail::tvec4<T>& y)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y), fastPow(x.y, y.y),
fastPow(x.z, y.z), fastPow(x.z, y.z),
fastPow(x.w, y.w)); fastPow(x.w, y.w));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastPow(const T x, int y) GLM_FUNC_QUALIFIER T fastPow(const T x, int y)
{ {
T f = T(1); T f = T(1);
for(int i = 0; i < y; ++i) for(int i = 0; i < y; ++i)
f *= x; f *= x;
return f; return f;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow( GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow(
const detail::tvec2<T>& x, const detail::tvec2<T>& x,
const detail::tvec2<int>& y) const detail::tvec2<int>& y)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y)); fastPow(x.y, y.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow( GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow(
const detail::tvec3<T>& x, const detail::tvec3<T>& x,
const detail::tvec3<int>& y) const detail::tvec3<int>& y)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y), fastPow(x.y, y.y),
fastPow(x.z, y.z)); fastPow(x.z, y.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow( GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow(
const detail::tvec4<T>& x, const detail::tvec4<T>& x,
const detail::tvec4<int>& y) const detail::tvec4<int>& y)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y), fastPow(x.y, y.y),
fastPow(x.z, y.z), fastPow(x.z, y.z),
fastPow(x.w, y.w)); fastPow(x.w, y.w));
} }
// fastExp // fastExp
// Note: This function provides accurate results only for value between -1 and 1, else avoid it. // Note: This function provides accurate results only for value between -1 and 1, else avoid it.
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastExp(const T x) GLM_FUNC_QUALIFIER T fastExp(const T x)
{ {
// This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower. // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower.
// return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f)))); // return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f))));
T x2 = x * x; T x2 = x * x;
@ -104,10 +103,10 @@ namespace gtx
T x4 = x3 * x; T x4 = x3 * x;
T x5 = x4 * x; T x5 = x4 * x;
return T(1) + x + (x2 * T(0.5)) + (x3 * T(0.1666666667)) + (x4 * T(0.041666667)) + (x5 * T(0.008333333333)); return T(1) + x + (x2 * T(0.5)) + (x3 * T(0.1666666667)) + (x4 * T(0.041666667)) + (x5 * T(0.008333333333));
} }
/* // Try to handle all values of float... but often shower than std::exp, glm::floor and the loop kill the performance /* // Try to handle all values of float... but often shower than std::exp, glm::floor and the loop kill the performance
GLM_FUNC_QUALIFIER float fastExp(float x) GLM_FUNC_QUALIFIER float fastExp(float x)
{ {
const float e = 2.718281828f; const float e = 2.718281828f;
const float IntegerPart = floor(x); const float IntegerPart = floor(x);
const float FloatPart = x - IntegerPart; const float FloatPart = x - IntegerPart;
@ -121,11 +120,11 @@ namespace gtx
const float x4 = x3 * FloatPart; const float x4 = x3 * FloatPart;
const float x5 = x4 * FloatPart; const float x5 = x4 * FloatPart;
return z * (1.0f + FloatPart + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)); return z * (1.0f + FloatPart + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f));
} }
// Increase accuracy on number bigger that 1 and smaller than -1 but it's not enough for high and negative numbers // Increase accuracy on number bigger that 1 and smaller than -1 but it's not enough for high and negative numbers
GLM_FUNC_QUALIFIER float fastExp(float x) GLM_FUNC_QUALIFIER float fastExp(float x)
{ {
// This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower. // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower.
// return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f)))); // return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f))));
float x2 = x * x; float x2 = x * x;
@ -136,157 +135,156 @@ namespace gtx
float x7 = x6 * x; float x7 = x6 * x;
float x8 = x7 * x; float x8 = x7 * x;
return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);; return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);;
} }
*/ */
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp( GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastExp(x.x), fastExp(x.x),
fastExp(x.y)); fastExp(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp( GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastExp(x.x), fastExp(x.x),
fastExp(x.y), fastExp(x.y),
fastExp(x.z)); fastExp(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp( GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastExp(x.x), fastExp(x.x),
fastExp(x.y), fastExp(x.y),
fastExp(x.z), fastExp(x.z),
fastExp(x.w)); fastExp(x.w));
} }
// fastLog // fastLog
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastLog(const T x) GLM_FUNC_QUALIFIER T fastLog(const T x)
{ {
return std::log(x); return std::log(x);
} }
/* Slower than the VC7.1 function... /* Slower than the VC7.1 function...
GLM_FUNC_QUALIFIER float fastLog(float x) GLM_FUNC_QUALIFIER float fastLog(float x)
{ {
float y1 = (x - 1.0f) / (x + 1.0f); float y1 = (x - 1.0f) / (x + 1.0f);
float y2 = y1 * y1; float y2 = y1 * y1;
return 2.0f * y1 * (1.0f + y2 * (0.3333333333f + y2 * (0.2f + y2 * 0.1428571429f))); return 2.0f * y1 * (1.0f + y2 * (0.3333333333f + y2 * (0.2f + y2 * 0.1428571429f)));
} }
*/ */
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog( GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastLog(x.x), fastLog(x.x),
fastLog(x.y)); fastLog(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog( GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastLog(x.x), fastLog(x.x),
fastLog(x.y), fastLog(x.y),
fastLog(x.z)); fastLog(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog( GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastLog(x.x), fastLog(x.x),
fastLog(x.y), fastLog(x.y),
fastLog(x.z), fastLog(x.z),
fastLog(x.w)); fastLog(x.w));
} }
//fastExp2, ln2 = 0.69314718055994530941723212145818f //fastExp2, ln2 = 0.69314718055994530941723212145818f
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastExp2(const T x) GLM_FUNC_QUALIFIER T fastExp2(const T x)
{ {
return fastExp(0.69314718055994530941723212145818f * x); return fastExp(0.69314718055994530941723212145818f * x);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp2( GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp2(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastExp2(x.x), fastExp2(x.x),
fastExp2(x.y)); fastExp2(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp2( GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp2(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastExp2(x.x), fastExp2(x.x),
fastExp2(x.y), fastExp2(x.y),
fastExp2(x.z)); fastExp2(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp2( GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp2(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastExp2(x.x), fastExp2(x.x),
fastExp2(x.y), fastExp2(x.y),
fastExp2(x.z), fastExp2(x.z),
fastExp2(x.w)); fastExp2(x.w));
} }
// fastLog2, ln2 = 0.69314718055994530941723212145818f // fastLog2, ln2 = 0.69314718055994530941723212145818f
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastLog2(const T x) GLM_FUNC_QUALIFIER T fastLog2(const T x)
{ {
return fastLog(x) / 0.69314718055994530941723212145818f; return fastLog(x) / 0.69314718055994530941723212145818f;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog2( GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog2(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastLog2(x.x), fastLog2(x.x),
fastLog2(x.y)); fastLog2(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog2( GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog2(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastLog2(x.x), fastLog2(x.x),
fastLog2(x.y), fastLog2(x.y),
fastLog2(x.z)); fastLog2(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog2( GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog2(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastLog2(x.x), fastLog2(x.x),
fastLog2(x.y), fastLog2(x.y),
fastLog2(x.z), fastLog2(x.z),
fastLog2(x.w)); fastLog2(x.w));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_fast_square_root extension included") # pragma message("GLM: GLM_GTX_fast_square_root extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_fast_square_root /// @addtogroup gtx_fast_square_root
/// @{ /// @{
@ -79,7 +78,6 @@ namespace gtx
genType fastNormalize(genType const & x); genType fastNormalize(genType const & x);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "fast_square_root.inl" #include "fast_square_root.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
// fastSqrt // fastSqrt
template <typename genType> template <typename genType>
@ -231,5 +230,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<valType> fastNormalize
return x * fastInverseSqrt(sqr); return x * fastInverseSqrt(sqr);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_fast_trigonometry extension included") # pragma message("GLM: GLM_GTX_fast_trigonometry extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_fast_trigonometry /// @addtogroup gtx_fast_trigonometry
/// @{ /// @{
@ -94,7 +93,6 @@ namespace gtx
T fastAtan(const T& angle); T fastAtan(const T& angle);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "fast_trigonometry.inl" #include "fast_trigonometry.inl"

@ -8,263 +8,261 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
// sin
template <typename T>
GLM_FUNC_QUALIFIER T fastSin(const T x)
{ {
// sin
template <typename T>
GLM_FUNC_QUALIFIER T fastSin(const T x)
{
return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040)); return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastSin( GLM_FUNC_QUALIFIER detail::tvec2<T> fastSin(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastSin(x.x), fastSin(x.x),
fastSin(x.y)); fastSin(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastSin( GLM_FUNC_QUALIFIER detail::tvec3<T> fastSin(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastSin(x.x), fastSin(x.x),
fastSin(x.y), fastSin(x.y),
fastSin(x.z)); fastSin(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastSin( GLM_FUNC_QUALIFIER detail::tvec4<T> fastSin(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastSin(x.x), fastSin(x.x),
fastSin(x.y), fastSin(x.y),
fastSin(x.z), fastSin(x.z),
fastSin(x.w)); fastSin(x.w));
} }
// cos // cos
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastCos(const T x) GLM_FUNC_QUALIFIER T fastCos(const T x)
{ {
return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888)); return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastCos( GLM_FUNC_QUALIFIER detail::tvec2<T> fastCos(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastCos(x.x), fastCos(x.x),
fastCos(x.y)); fastCos(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastCos( GLM_FUNC_QUALIFIER detail::tvec3<T> fastCos(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastCos(x.x), fastCos(x.x),
fastCos(x.y), fastCos(x.y),
fastCos(x.z)); fastCos(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastCos( GLM_FUNC_QUALIFIER detail::tvec4<T> fastCos(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastCos(x.x), fastCos(x.x),
fastCos(x.y), fastCos(x.y),
fastCos(x.z), fastCos(x.z),
fastCos(x.w)); fastCos(x.w));
} }
// tan // tan
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastTan(const T x) GLM_FUNC_QUALIFIER T fastTan(const T x)
{ {
return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539)); return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastTan( GLM_FUNC_QUALIFIER detail::tvec2<T> fastTan(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastTan(x.x), fastTan(x.x),
fastTan(x.y)); fastTan(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastTan( GLM_FUNC_QUALIFIER detail::tvec3<T> fastTan(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastTan(x.x), fastTan(x.x),
fastTan(x.y), fastTan(x.y),
fastTan(x.z)); fastTan(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastTan( GLM_FUNC_QUALIFIER detail::tvec4<T> fastTan(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastTan(x.x), fastTan(x.x),
fastTan(x.y), fastTan(x.y),
fastTan(x.z), fastTan(x.z),
fastTan(x.w)); fastTan(x.w));
} }
// asin // asin
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastAsin(const T x) GLM_FUNC_QUALIFIER T fastAsin(const T x)
{ {
return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159)); return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159));
} }
template <typename T> detail::tvec2<T> fastAsin( template <typename T> detail::tvec2<T> fastAsin(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastAsin(x.x), fastAsin(x.x),
fastAsin(x.y)); fastAsin(x.y));
} }
template <typename T> detail::tvec3<T> fastAsin( template <typename T> detail::tvec3<T> fastAsin(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastAsin(x.x), fastAsin(x.x),
fastAsin(x.y), fastAsin(x.y),
fastAsin(x.z)); fastAsin(x.z));
} }
template <typename T> detail::tvec4<T> fastAsin( template <typename T> detail::tvec4<T> fastAsin(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastAsin(x.x), fastAsin(x.x),
fastAsin(x.y), fastAsin(x.y),
fastAsin(x.z), fastAsin(x.z),
fastAsin(x.w)); fastAsin(x.w));
} }
// acos // acos
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastAcos(const T x) GLM_FUNC_QUALIFIER T fastAcos(const T x)
{ {
return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
} }
template <typename T> detail::tvec2<T> fastAcos( template <typename T> detail::tvec2<T> fastAcos(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastAcos(x.x), fastAcos(x.x),
fastAcos(x.y)); fastAcos(x.y));
} }
template <typename T> detail::tvec3<T> fastAcos( template <typename T> detail::tvec3<T> fastAcos(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastAcos(x.x), fastAcos(x.x),
fastAcos(x.y), fastAcos(x.y),
fastAcos(x.z)); fastAcos(x.z));
} }
template <typename T> detail::tvec4<T> fastAcos( template <typename T> detail::tvec4<T> fastAcos(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastAcos(x.x), fastAcos(x.x),
fastAcos(x.y), fastAcos(x.y),
fastAcos(x.z), fastAcos(x.z),
fastAcos(x.w)); fastAcos(x.w));
} }
// atan // atan
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastAtan(const T y, const T x) GLM_FUNC_QUALIFIER T fastAtan(const T y, const T x)
{ {
T sgn = sign(y) * sign(x); T sgn = sign(y) * sign(x);
return abs(fastAtan(y / x)) * sgn; return abs(fastAtan(y / x)) * sgn;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan( GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
const detail::tvec2<T>& y, const detail::tvec2<T>& y,
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastAtan(y.x, x.x), fastAtan(y.x, x.x),
fastAtan(y.y, x.y)); fastAtan(y.y, x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan( GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
const detail::tvec3<T>& y, const detail::tvec3<T>& y,
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastAtan(y.x, x.x), fastAtan(y.x, x.x),
fastAtan(y.y, x.y), fastAtan(y.y, x.y),
fastAtan(y.z, x.z)); fastAtan(y.z, x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan( GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
const detail::tvec4<T>& y, const detail::tvec4<T>& y,
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastAtan(y.x, x.x), fastAtan(y.x, x.x),
fastAtan(y.y, x.y), fastAtan(y.y, x.y),
fastAtan(y.z, x.z), fastAtan(y.z, x.z),
fastAtan(y.w, x.w)); fastAtan(y.w, x.w));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T fastAtan(const T x) GLM_FUNC_QUALIFIER T fastAtan(const T x)
{ {
return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909)); return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan( GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
fastAtan(x.x), fastAtan(x.x),
fastAtan(x.y)); fastAtan(x.y));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan( GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return detail::tvec3<T>( return detail::tvec3<T>(
fastAtan(x.x), fastAtan(x.x),
fastAtan(x.y), fastAtan(x.y),
fastAtan(x.z)); fastAtan(x.z));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan( GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return detail::tvec4<T>( return detail::tvec4<T>(
fastAtan(x.x), fastAtan(x.x),
fastAtan(x.y), fastAtan(x.y),
fastAtan(x.z), fastAtan(x.z),
fastAtan(x.w)); fastAtan(x.w));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTX_gradient_paint extension included") # pragma message("GLM: GLM_GTX_gradient_paint extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_gradient_paint /// @addtogroup gtx_gradient_paint
/// @{ /// @{
@ -70,7 +69,6 @@ namespace gtx
glm::detail::tvec2<valType> const & Position); glm::detail::tvec2<valType> const & Position);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "gradient_paint.inl" #include "gradient_paint.inl"

@ -8,15 +8,14 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename valType> template <typename valType>
valType radialGradient( valType radialGradient(
glm::detail::tvec2<valType> const & Center, glm::detail::tvec2<valType> const & Center,
valType const & Radius, valType const & Radius,
glm::detail::tvec2<valType> const & Focal, glm::detail::tvec2<valType> const & Focal,
glm::detail::tvec2<valType> const & Position) glm::detail::tvec2<valType> const & Position)
{ {
glm::detail::tvec2<valType> F = Focal - Center; glm::detail::tvec2<valType> F = Focal - Center;
glm::detail::tvec2<valType> D = Position - Focal; glm::detail::tvec2<valType> D = Position - Focal;
valType Radius2 = gtx::pow2(Radius); valType Radius2 = gtx::pow2(Radius);
@ -26,17 +25,16 @@ namespace gtx{
valType Numerator = (D.x * F.x + D.y * F.y) + glm::sqrt(Radius2 * (gtx::pow2(D.x) + gtx::pow2(D.y)) - gtx::pow2(D.x * F.y - D.y * F.x)); valType Numerator = (D.x * F.x + D.y * F.y) + glm::sqrt(Radius2 * (gtx::pow2(D.x) + gtx::pow2(D.y)) - gtx::pow2(D.x * F.y - D.y * F.x));
valType Denominator = Radius2 - (Fx2 + Fy2); valType Denominator = Radius2 - (Fx2 + Fy2);
return Numerator / Denominator; return Numerator / Denominator;
} }
template <typename valType> template <typename valType>
valType linearGradient( valType linearGradient(
glm::detail::tvec2<valType> const & Point0, glm::detail::tvec2<valType> const & Point0,
glm::detail::tvec2<valType> const & Point1, glm::detail::tvec2<valType> const & Point1,
glm::detail::tvec2<valType> const & Position) glm::detail::tvec2<valType> const & Position)
{ {
glm::detail::tvec2<valType> Dist = Point1 - Point0; glm::detail::tvec2<valType> Dist = Point1 - Point0;
return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_handed_coordinate_space /// @addtogroup gtx_handed_coordinate_space
/// @{ /// @{
@ -68,7 +67,6 @@ namespace gtx
detail::tvec3<T> const & normal); detail::tvec3<T> const & normal);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "handed_coordinate_space.inl" #include "handed_coordinate_space.inl"

@ -8,25 +8,23 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
{ template <typename T>
template <typename T> GLM_FUNC_QUALIFIER bool rightHanded(
GLM_FUNC_QUALIFIER bool rightHanded(
detail::tvec3<T> const & tangent, detail::tvec3<T> const & tangent,
detail::tvec3<T> const & binormal, detail::tvec3<T> const & binormal,
detail::tvec3<T> const & normal) detail::tvec3<T> const & normal)
{ {
return dot(cross(normal, tangent), binormal) > T(0); return dot(cross(normal, tangent), binormal) > T(0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER bool leftHanded( GLM_FUNC_QUALIFIER bool leftHanded(
detail::tvec3<T> const & tangent, detail::tvec3<T> const & tangent,
detail::tvec3<T> const & binormal, detail::tvec3<T> const & binormal,
detail::tvec3<T> const & normal) detail::tvec3<T> const & normal)
{ {
return dot(cross(normal, tangent), binormal) < T(0); return dot(cross(normal, tangent), binormal) < T(0);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTX_inertia extension included") # pragma message("GLM: GLM_GTX_inertia extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_inertia /// @addtogroup gtx_inertia
/// @{ /// @{
@ -109,7 +108,6 @@ namespace gtx
const T Radius); const T Radius);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "inertia.inl" #include "inertia.inl"

@ -8,94 +8,92 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
const T Mass, const T Mass,
const detail::tvec3<T>& Scale) const detail::tvec3<T>& Scale)
{ {
detail::tmat3x3<T> Result(T(1)); detail::tmat3x3<T> Result(T(1));
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12); Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12); Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12);
Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12); Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
const T Mass, const T Mass,
const detail::tvec3<T>& Scale) const detail::tvec3<T>& Scale)
{ {
detail::tmat4x4<T> Result(T(1)); detail::tmat4x4<T> Result(T(1));
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12); Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12); Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12);
Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12); Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
const T Mass, const T Mass,
const T Radius) const T Radius)
{ {
T a = Mass * Radius * Radius / T(2); T a = Mass * Radius * Radius / T(2);
detail::tmat3x3<T> Result(a); detail::tmat3x3<T> Result(a);
Result[2][2] *= T(2); Result[2][2] *= T(2);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
const T Mass, const T Mass,
const T Radius) const T Radius)
{ {
T a = Mass * Radius * Radius / T(2); T a = Mass * Radius * Radius / T(2);
detail::tmat4x4<T> Result(a); detail::tmat4x4<T> Result(a);
Result[2][2] *= T(2); Result[2][2] *= T(2);
Result[3][3] = T(1); Result[3][3] = T(1);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3(
const T Mass, const T Mass,
const T Radius) const T Radius)
{ {
T a = T(2) * Mass * Radius * Radius / T(5); T a = T(2) * Mass * Radius * Radius / T(5);
return detail::tmat3x3<T>(a); return detail::tmat3x3<T>(a);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
const T Mass, const T Mass,
const T Radius) const T Radius)
{ {
T a = T(2) * Mass * Radius * Radius / T(5); T a = T(2) * Mass * Radius * Radius / T(5);
detail::tmat4x4<T> Result(a); detail::tmat4x4<T> Result(a);
Result[3][3] = T(1); Result[3][3] = T(1);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3(
const T Mass, const T Mass,
const T Radius) const T Radius)
{ {
T a = T(2) * Mass * Radius * Radius / T(3); T a = T(2) * Mass * Radius * Radius / T(3);
return detail::tmat3x3<T>(a); return detail::tmat3x3<T>(a);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4(
const T Mass, const T Mass,
const T Radius) const T Radius)
{ {
T a = T(2) * Mass * Radius * Radius / T(3); T a = T(2) * Mass * Radius * Radius / T(3);
detail::tmat4x4<T> Result(a); detail::tmat4x4<T> Result(a);
Result[3][3] = T(1); Result[3][3] = T(1);
return Result; return Result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_int_10_10_10_2 extension included") # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_int_10_10_10_2 /// @addtogroup gtx_int_10_10_10_2
/// @{ /// @{
@ -58,7 +57,6 @@ namespace gtx
dword uint10_10_10_2_cast(glm::vec4 const & v); dword uint10_10_10_2_cast(glm::vec4 const & v);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "int_10_10_10_2.inl" #include "int_10_10_10_2.inl"

@ -8,12 +8,10 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast(glm::vec4 const & v) GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast(glm::vec4 const & v)
{ {
return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30); return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_integer extension included") # pragma message("GLM: GLM_GTX_integer extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_integer /// @addtogroup gtx_integer
/// @{ /// @{
@ -69,7 +68,6 @@ namespace gtx
genType factorial(genType const & x); genType factorial(genType const & x);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "integer.inl" #include "integer.inl"

@ -8,22 +8,21 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
// pow // pow
GLM_FUNC_QUALIFIER int pow(int x, int y) GLM_FUNC_QUALIFIER int pow(int x, int y)
{ {
if(y == 0) if(y == 0)
return 1; return 1;
int result = x; int result = x;
for(int i = 1; i < y; ++i) for(int i = 1; i < y; ++i)
result *= x; result *= x;
return result; return result;
} }
// sqrt: From Christopher J. Musial, An integer square root, Graphics Gems, 1990, page 387 // sqrt: From Christopher J. Musial, An integer square root, Graphics Gems, 1990, page 387
GLM_FUNC_QUALIFIER int sqrt(int x) GLM_FUNC_QUALIFIER int sqrt(int x)
{ {
if(x <= 1) return x; if(x <= 1) return x;
int NextTrial = x >> 1; int NextTrial = x >> 1;
@ -36,54 +35,53 @@ namespace gtx{
} while(NextTrial < CurrentAnswer); } while(NextTrial < CurrentAnswer);
return CurrentAnswer; return CurrentAnswer;
} }
// mod // mod
GLM_FUNC_QUALIFIER int mod(int x, int y) GLM_FUNC_QUALIFIER int mod(int x, int y)
{ {
return x - y * (x / y); return x - y * (x / y);
} }
// factorial (!12 max, integer only) // factorial (!12 max, integer only)
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType factorial(genType const & x) GLM_FUNC_QUALIFIER genType factorial(genType const & x)
{ {
genType Temp = x; genType Temp = x;
genType Result; genType Result;
for(Result = 1; Temp > 1; --Temp) for(Result = 1; Temp > 1; --Temp)
Result *= Temp; Result *= Temp;
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> factorial( GLM_FUNC_QUALIFIER detail::tvec2<valType> factorial(
detail::tvec2<valType> const & x) detail::tvec2<valType> const & x)
{ {
return detail::tvec2<valType>( return detail::tvec2<valType>(
factorial(x.x), factorial(x.x),
factorial(x.y)); factorial(x.y));
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> factorial( GLM_FUNC_QUALIFIER detail::tvec3<valType> factorial(
detail::tvec3<valType> const & x) detail::tvec3<valType> const & x)
{ {
return detail::tvec3<valType>( return detail::tvec3<valType>(
factorial(x.x), factorial(x.x),
factorial(x.y), factorial(x.y),
factorial(x.z)); factorial(x.z));
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> factorial( GLM_FUNC_QUALIFIER detail::tvec4<valType> factorial(
detail::tvec4<valType> const & x) detail::tvec4<valType> const & x)
{ {
return detail::tvec4<valType>( return detail::tvec4<valType>(
factorial(x.x), factorial(x.x),
factorial(x.y), factorial(x.y),
factorial(x.z), factorial(x.z),
factorial(x.w)); factorial(x.w));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_closest_point extension included") # pragma message("GLM: GLM_GTX_closest_point extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_intersect /// @addtogroup gtx_intersect
/// @{ /// @{
@ -86,7 +85,6 @@ namespace gtx
genType & position, genType & normal); genType & position, genType & normal);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "intersect.inl" #include "intersect.inl"

@ -11,7 +11,6 @@
#include <limits> #include <limits>
namespace glm{ namespace glm{
namespace gtx{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER bool intersectRayTriangle GLM_FUNC_QUALIFIER bool intersectRayTriangle
@ -195,5 +194,4 @@ GLM_FUNC_QUALIFIER bool intersectLineSphere
return false; return false;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_log_base extension included") # pragma message("GLM: GLM_GTX_log_base extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_log_base /// @addtogroup gtx_log_base
/// @{ /// @{
@ -59,7 +58,6 @@ namespace gtx
genType const & base); genType const & base);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "log_base.inl" #include "log_base.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType log( GLM_FUNC_QUALIFIER genType log(
@ -86,5 +85,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
log(v.w, base.w)); log(v.w, base.w));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTX_matrix_cross_product extension included") # pragma message("GLM: GLM_GTX_matrix_cross_product extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_matrix_cross_product /// @addtogroup gtx_matrix_cross_product
/// @{ /// @{
@ -65,7 +64,6 @@ namespace gtx
detail::tvec3<T> const & x); detail::tvec3<T> const & x);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "matrix_cross_product.inl" #include "matrix_cross_product.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
@ -38,5 +37,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4(
return Result; return Result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_matrix_interpolation extension included") # pragma message("GLM: GLM_GTX_matrix_interpolation extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_matrix_interpolation /// @addtogroup gtx_matrix_interpolation
/// @{ /// @{
@ -76,7 +75,6 @@ namespace gtx
T const delta); T const delta);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "matrix_interpolation.inl" #include "matrix_interpolation.inl"

@ -8,14 +8,13 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER void axisAngle( GLM_FUNC_QUALIFIER void axisAngle(
detail::tmat4x4<T> const & mat, detail::tmat4x4<T> const & mat,
detail::tvec3<T> & axis, detail::tvec3<T> & axis,
T & angle) T & angle)
{ {
T epsilon = (T)0.01; T epsilon = (T)0.01;
T epsilon2 = (T)0.1; T epsilon2 = (T)0.1;
@ -74,13 +73,13 @@ namespace gtx{
axis.x = (mat[1][2] - mat[2][1]) / s; axis.x = (mat[1][2] - mat[2][1]) / s;
axis.y = (mat[2][0] - mat[0][2]) / s; axis.y = (mat[2][0] - mat[0][2]) / s;
axis.z = (mat[0][1] - mat[1][0]) / s; axis.z = (mat[0][1] - mat[1][0]) / s;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix( GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
detail::tvec3<T> const & axis, detail::tvec3<T> const & axis,
T const angle) T const angle)
{ {
T c = cos(angle); T c = cos(angle);
T s = sin(angle); T s = sin(angle);
T t = T(1) - c; T t = T(1) - c;
@ -92,14 +91,14 @@ namespace gtx{
t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, T(0), t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, T(0),
T(0), T(0), T(0), T(1) T(0), T(0), T(0), T(1)
); );
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate( GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
detail::tmat4x4<T> const & m1, detail::tmat4x4<T> const & m1,
detail::tmat4x4<T> const & m2, detail::tmat4x4<T> const & m2,
T const delta) T const delta)
{ {
detail::tmat4x4<T> dltRotation = m2 * transpose(m1); detail::tmat4x4<T> dltRotation = m2 * transpose(m1);
detail::tvec3<T> dltAxis; detail::tvec3<T> dltAxis;
T dltAngle; T dltAngle;
@ -109,7 +108,6 @@ namespace gtx{
out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]); out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]);
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]); out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
return out; return out;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,10 +46,9 @@
# pragma message("GLM: GLM_GTX_matrix_major_storage extension included") # pragma message("GLM: GLM_GTX_matrix_major_storage extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// \addtogroup gtx_matrix_major_storage /// @addtogroup gtx_matrix_major_storage
/// @{ /// @{
//! Build a row major matrix from row vectors. //! Build a row major matrix from row vectors.
@ -137,7 +136,6 @@ namespace gtx
const detail::tmat4x4<T>& m); const detail::tmat4x4<T>& m);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "matrix_major_storage.inl" #include "matrix_major_storage.inl"

@ -8,39 +8,38 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2( GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2(
const detail::tvec2<T>& v1, const detail::tvec2<T>& v1,
const detail::tvec2<T>& v2) const detail::tvec2<T>& v2)
{ {
detail::tmat2x2<T> Result; detail::tmat2x2<T> Result;
Result[0][0] = v1.x; Result[0][0] = v1.x;
Result[1][0] = v1.y; Result[1][0] = v1.y;
Result[0][1] = v2.x; Result[0][1] = v2.x;
Result[1][1] = v2.y; Result[1][1] = v2.y;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2( GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2(
const detail::tmat2x2<T>& m) const detail::tmat2x2<T>& m)
{ {
detail::tmat2x2<T> Result; detail::tmat2x2<T> Result;
Result[0][0] = m[0][0]; Result[0][0] = m[0][0];
Result[0][1] = m[1][0]; Result[0][1] = m[1][0];
Result[1][0] = m[0][1]; Result[1][0] = m[0][1];
Result[1][1] = m[1][1]; Result[1][1] = m[1][1];
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> rowMajor3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> rowMajor3(
const detail::tvec3<T>& v1, const detail::tvec3<T>& v1,
const detail::tvec3<T>& v2, const detail::tvec3<T>& v2,
const detail::tvec3<T>& v3) const detail::tvec3<T>& v3)
{ {
detail::tmat3x3<T> Result; detail::tmat3x3<T> Result;
Result[0][0] = v1.x; Result[0][0] = v1.x;
Result[1][0] = v1.y; Result[1][0] = v1.y;
@ -52,12 +51,12 @@ namespace gtx{
Result[1][2] = v3.y; Result[1][2] = v3.y;
Result[2][2] = v3.z; Result[2][2] = v3.z;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> rowMajor3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> rowMajor3(
const detail::tmat3x3<T>& m) const detail::tmat3x3<T>& m)
{ {
detail::tmat3x3<T> Result; detail::tmat3x3<T> Result;
Result[0][0] = m[0][0]; Result[0][0] = m[0][0];
Result[0][1] = m[1][0]; Result[0][1] = m[1][0];
@ -69,15 +68,15 @@ namespace gtx{
Result[2][1] = m[1][2]; Result[2][1] = m[1][2];
Result[2][2] = m[2][2]; Result[2][2] = m[2][2];
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> rowMajor4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> rowMajor4(
const detail::tvec4<T>& v1, const detail::tvec4<T>& v1,
const detail::tvec4<T>& v2, const detail::tvec4<T>& v2,
const detail::tvec4<T>& v3, const detail::tvec4<T>& v3,
const detail::tvec4<T>& v4) const detail::tvec4<T>& v4)
{ {
detail::tmat4x4<T> Result; detail::tmat4x4<T> Result;
Result[0][0] = v1.x; Result[0][0] = v1.x;
Result[1][0] = v1.y; Result[1][0] = v1.y;
@ -96,12 +95,12 @@ namespace gtx{
Result[2][3] = v4.z; Result[2][3] = v4.z;
Result[3][3] = v4.w; Result[3][3] = v4.w;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> rowMajor4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> rowMajor4(
const detail::tmat4x4<T>& m) const detail::tmat4x4<T>& m)
{ {
detail::tmat4x4<T> Result; detail::tmat4x4<T> Result;
Result[0][0] = m[0][0]; Result[0][0] = m[0][0];
Result[0][1] = m[1][0]; Result[0][1] = m[1][0];
@ -120,55 +119,54 @@ namespace gtx{
Result[3][2] = m[2][3]; Result[3][2] = m[2][3];
Result[3][3] = m[3][3]; Result[3][3] = m[3][3];
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat2x2<T> colMajor2( GLM_FUNC_QUALIFIER detail::tmat2x2<T> colMajor2(
const detail::tvec2<T>& v1, const detail::tvec2<T>& v1,
const detail::tvec2<T>& v2) const detail::tvec2<T>& v2)
{ {
return detail::tmat2x2<T>(v1, v2); return detail::tmat2x2<T>(v1, v2);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat2x2<T> colMajor2( GLM_FUNC_QUALIFIER detail::tmat2x2<T> colMajor2(
const detail::tmat2x2<T>& m) const detail::tmat2x2<T>& m)
{ {
return detail::tmat2x2<T>(m); return detail::tmat2x2<T>(m);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> colMajor3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> colMajor3(
const detail::tvec3<T>& v1, const detail::tvec3<T>& v1,
const detail::tvec3<T>& v2, const detail::tvec3<T>& v2,
const detail::tvec3<T>& v3) const detail::tvec3<T>& v3)
{ {
return detail::tmat3x3<T>(v1, v2, v3); return detail::tmat3x3<T>(v1, v2, v3);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> colMajor3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> colMajor3(
const detail::tmat3x3<T>& m) const detail::tmat3x3<T>& m)
{ {
return detail::tmat3x3<T>(m); return detail::tmat3x3<T>(m);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
const detail::tvec4<T>& v1, const detail::tvec4<T>& v1,
const detail::tvec4<T>& v2, const detail::tvec4<T>& v2,
const detail::tvec4<T>& v3, const detail::tvec4<T>& v3,
const detail::tvec4<T>& v4) const detail::tvec4<T>& v4)
{ {
return detail::tmat4x4<T>(v1, v2, v3, v4); return detail::tmat4x4<T>(v1, v2, v3, v4);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
const detail::tmat4x4<T>& m) const detail::tmat4x4<T>& m)
{ {
return detail::tmat4x4<T>(m); return detail::tmat4x4<T>(m);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,10 +45,9 @@
# pragma message("GLM: GLM_GTX_matrix_operation extension included") # pragma message("GLM: GLM_GTX_matrix_operation extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// \addtogroup gtx_matrix_operation /// @addtogroup gtx_matrix_operation
/// @{ /// @{
//! Build a diagonal matrix. //! Build a diagonal matrix.
@ -106,7 +105,6 @@ namespace gtx
detail::tvec4<valType> const & v); detail::tvec4<valType> const & v);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "matrix_operation.inl" #include "matrix_operation.inl"

@ -8,120 +8,118 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2 GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
( (
detail::tvec2<valType> const & v detail::tvec2<valType> const & v
) )
{ {
detail::tmat2x2<valType> Result(valType(1)); detail::tmat2x2<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat2x3<valType> diagonal2x3 GLM_FUNC_QUALIFIER detail::tmat2x3<valType> diagonal2x3
( (
detail::tvec2<valType> const & v detail::tvec2<valType> const & v
) )
{ {
detail::tmat2x3<valType> Result(valType(1)); detail::tmat2x3<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat2x4<valType> diagonal2x4 GLM_FUNC_QUALIFIER detail::tmat2x4<valType> diagonal2x4
( (
detail::tvec2<valType> const & v detail::tvec2<valType> const & v
) )
{ {
detail::tmat2x4<valType> Result(valType(1)); detail::tmat2x4<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat3x2<valType> diagonal3x2 GLM_FUNC_QUALIFIER detail::tmat3x2<valType> diagonal3x2
( (
detail::tvec2<valType> const & v detail::tvec2<valType> const & v
) )
{ {
detail::tmat3x2<valType> Result(valType(1)); detail::tmat3x2<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat3x3<valType> diagonal3x3 GLM_FUNC_QUALIFIER detail::tmat3x3<valType> diagonal3x3
( (
detail::tvec3<valType> const & v detail::tvec3<valType> const & v
) )
{ {
detail::tmat3x3<valType> Result(valType(1)); detail::tmat3x3<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
Result[2][2] = v[2]; Result[2][2] = v[2];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat3x4<valType> diagonal3x4 GLM_FUNC_QUALIFIER detail::tmat3x4<valType> diagonal3x4
( (
detail::tvec3<valType> const & v detail::tvec3<valType> const & v
) )
{ {
detail::tmat3x4<valType> Result(valType(1)); detail::tmat3x4<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
Result[2][2] = v[2]; Result[2][2] = v[2];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> diagonal4x4 GLM_FUNC_QUALIFIER detail::tmat4x4<valType> diagonal4x4
( (
detail::tvec4<valType> const & v detail::tvec4<valType> const & v
) )
{ {
detail::tmat4x4<valType> Result(valType(1)); detail::tmat4x4<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
Result[2][2] = v[2]; Result[2][2] = v[2];
Result[3][3] = v[3]; Result[3][3] = v[3];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x3<valType> diagonal4x3 GLM_FUNC_QUALIFIER detail::tmat4x3<valType> diagonal4x3
( (
detail::tvec3<valType> const & v detail::tvec3<valType> const & v
) )
{ {
detail::tmat4x3<valType> Result(valType(1)); detail::tmat4x3<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
Result[2][2] = v[2]; Result[2][2] = v[2];
return Result; return Result;
} }
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2 GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
( (
detail::tvec2<valType> const & v detail::tvec2<valType> const & v
) )
{ {
detail::tmat4x2<valType> Result(valType(1)); detail::tmat4x2<valType> Result(valType(1));
Result[0][0] = v[0]; Result[0][0] = v[0];
Result[1][1] = v[1]; Result[1][1] = v[1];
return Result; return Result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTX_matrix_query extension included") # pragma message("GLM: GLM_GTX_matrix_query extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_matrix_query /// @addtogroup gtx_matrix_query
/// @{ /// @{
@ -109,7 +108,6 @@ namespace gtx
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon()); const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "matrix_query.inl" #include "matrix_query.inl"

@ -11,46 +11,45 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
{ template<typename T>
template<typename T> GLM_FUNC_QUALIFIER bool isNull(
GLM_FUNC_QUALIFIER bool isNull(
const detail::tmat2x2<T>& m, const detail::tmat2x2<T>& m,
const T epsilon) const T epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 2 ; ++i) for(int i = 0; result && i < 2 ; ++i)
result = isNull(m[i], epsilon); result = isNull(m[i], epsilon);
return result; return result;
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNull( GLM_FUNC_QUALIFIER bool isNull(
const detail::tmat3x3<T>& m, const detail::tmat3x3<T>& m,
const T epsilon) const T epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 3 ; ++i) for(int i = 0; result && i < 3 ; ++i)
result = isNull(m[i], epsilon); result = isNull(m[i], epsilon);
return result; return result;
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNull( GLM_FUNC_QUALIFIER bool isNull(
const detail::tmat4x4<T>& m, const detail::tmat4x4<T>& m,
const T epsilon) const T epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 4 ; ++i) for(int i = 0; result && i < 4 ; ++i)
result = isNull(m[i], epsilon); result = isNull(m[i], epsilon);
return result; return result;
} }
template<typename genType> template<typename genType>
GLM_FUNC_QUALIFIER bool isIdentity( GLM_FUNC_QUALIFIER bool isIdentity(
const genType& m, const genType& m,
const typename genType::value_type epsilon) const typename genType::value_type epsilon)
{ {
bool result = true; bool result = true;
for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i) for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i)
{ {
@ -62,13 +61,13 @@ namespace gtx
result = abs(m[i][j]) <= epsilon; result = abs(m[i][j]) <= epsilon;
} }
return result; return result;
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized( GLM_FUNC_QUALIFIER bool isNormalized(
const detail::tmat2x2<T>& m, const detail::tmat2x2<T>& m,
const T epsilon) const T epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 2; ++i) for(int i = 0; result && i < 2; ++i)
result = isNormalized(m[i], epsilon); result = isNormalized(m[i], epsilon);
@ -80,13 +79,13 @@ namespace gtx
result = isNormalized(v, epsilon); result = isNormalized(v, epsilon);
} }
return result; return result;
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized( GLM_FUNC_QUALIFIER bool isNormalized(
const detail::tmat3x3<T>& m, const detail::tmat3x3<T>& m,
const T epsilon) const T epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 3; ++i) for(int i = 0; result && i < 3; ++i)
result = isNormalized(m[i], epsilon); result = isNormalized(m[i], epsilon);
@ -98,13 +97,13 @@ namespace gtx
result = isNormalized(v, epsilon); result = isNormalized(v, epsilon);
} }
return result; return result;
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized( GLM_FUNC_QUALIFIER bool isNormalized(
const detail::tmat4x4<T>& m, const detail::tmat4x4<T>& m,
const T epsilon) const T epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 4; ++i) for(int i = 0; result && i < 4; ++i)
result = isNormalized(m[i], epsilon); result = isNormalized(m[i], epsilon);
@ -116,13 +115,13 @@ namespace gtx
result = isNormalized(v, epsilon); result = isNormalized(v, epsilon);
} }
return result; return result;
} }
template<typename genType> template<typename genType>
GLM_FUNC_QUALIFIER bool isOrthogonal( GLM_FUNC_QUALIFIER bool isOrthogonal(
const genType& m, const genType& m,
const typename genType::value_type epsilon) const typename genType::value_type epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < genType::col_size() - 1; ++i) for(int i = 0; result && i < genType::col_size() - 1; ++i)
for(int j= i + 1; result && j < genType::col_size(); ++j) for(int j= i + 1; result && j < genType::col_size(); ++j)
@ -136,7 +135,6 @@ namespace gtx
result = areOrthogonal(tmp[i], tmp[j], epsilon); result = areOrthogonal(tmp[i], tmp[j], epsilon);
} }
return result; return result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -45,8 +45,7 @@
# pragma message("GLM: GLM_GTX_mixed_product extension included") # pragma message("GLM: GLM_GTX_mixed_product extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_mixed_product /// @addtogroup gtx_mixed_product
/// @{ /// @{
@ -59,7 +58,6 @@ namespace gtx
detail::tvec3<valType> const & v3); detail::tvec3<valType> const & v3);
/// @} /// @}
}// namespace gtx
}// namespace glm }// namespace glm
#include "mixed_product.inl" #include "mixed_product.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER valType mixedProduct( GLM_FUNC_QUALIFIER valType mixedProduct(
@ -19,14 +18,4 @@ GLM_FUNC_QUALIFIER valType mixedProduct(
return dot(cross(v1, v2), v3); return dot(cross(v1, v2), v3);
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTX_multiple extension included") # pragma message("GLM: GLM_GTX_multiple extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_multiple /// @addtogroup gtx_multiple
/// @{ /// @{
@ -67,7 +66,6 @@ namespace gtx
genType const & Multiple); genType const & Multiple);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "multiple.inl" #include "multiple.inl"

@ -11,179 +11,177 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
{
//////////////////////
// higherMultiple
template <typename genType> //////////////////////
GLM_FUNC_QUALIFIER genType higherMultiple // higherMultiple
(
template <typename genType>
GLM_FUNC_QUALIFIER genType higherMultiple
(
genType const & Source, genType const & Source,
genType const & Multiple genType const & Multiple
) )
{ {
genType Tmp = Source % Multiple; genType Tmp = Source % Multiple;
return Tmp ? Source + Multiple - Tmp : Source; return Tmp ? Source + Multiple - Tmp : Source;
} }
template <> template <>
GLM_FUNC_QUALIFIER detail::thalf higherMultiple GLM_FUNC_QUALIFIER detail::thalf higherMultiple
( (
detail::thalf const & Source, detail::thalf const & Source,
detail::thalf const & Multiple detail::thalf const & Multiple
) )
{ {
int Tmp = int(float(Source)) % int(float(Multiple)); int Tmp = int(float(Source)) % int(float(Multiple));
return Tmp ? Source + Multiple - detail::thalf(float(Tmp)) : Source; return Tmp ? Source + Multiple - detail::thalf(float(Tmp)) : Source;
} }
template <> template <>
GLM_FUNC_QUALIFIER float higherMultiple GLM_FUNC_QUALIFIER float higherMultiple
( (
float const & Source, float const & Source,
float const & Multiple float const & Multiple
) )
{ {
int Tmp = int(Source) % int(Multiple); int Tmp = int(Source) % int(Multiple);
return Tmp ? Source + Multiple - float(Tmp) : Source; return Tmp ? Source + Multiple - float(Tmp) : Source;
} }
template <> template <>
GLM_FUNC_QUALIFIER double higherMultiple GLM_FUNC_QUALIFIER double higherMultiple
( (
double const & Source, double const & Source,
double const & Multiple double const & Multiple
) )
{ {
long Tmp = long(Source) % long(Multiple); long Tmp = long(Source) % long(Multiple);
return Tmp ? Source + Multiple - double(Tmp) : Source; return Tmp ? Source + Multiple - double(Tmp) : Source;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> higherMultiple GLM_FUNC_QUALIFIER detail::tvec2<T> higherMultiple
( (
detail::tvec2<T> const & Source, detail::tvec2<T> const & Source,
detail::tvec2<T> const & Multiple detail::tvec2<T> const & Multiple
) )
{ {
detail::tvec2<T> Result; detail::tvec2<T> Result;
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i) for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]); Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> higherMultiple GLM_FUNC_QUALIFIER detail::tvec3<T> higherMultiple
( (
detail::tvec3<T> const & Source, detail::tvec3<T> const & Source,
detail::tvec3<T> const & Multiple detail::tvec3<T> const & Multiple
) )
{ {
detail::tvec3<T> Result; detail::tvec3<T> Result;
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i) for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]); Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> higherMultiple GLM_FUNC_QUALIFIER detail::tvec4<T> higherMultiple
( (
detail::tvec4<T> const & Source, detail::tvec4<T> const & Source,
detail::tvec4<T> const & Multiple detail::tvec4<T> const & Multiple
) )
{ {
detail::tvec4<T> Result; detail::tvec4<T> Result;
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i) for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]); Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result; return Result;
} }
////////////////////// //////////////////////
// lowerMultiple // lowerMultiple
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType lowerMultiple GLM_FUNC_QUALIFIER genType lowerMultiple
( (
genType const & Source, genType const & Source,
genType const & Multiple genType const & Multiple
) )
{ {
genType Tmp = Source % Multiple; genType Tmp = Source % Multiple;
return Tmp ? Source - Tmp : Source; return Tmp ? Source - Tmp : Source;
} }
template <> template <>
GLM_FUNC_QUALIFIER detail::thalf lowerMultiple GLM_FUNC_QUALIFIER detail::thalf lowerMultiple
( (
detail::thalf const & Source, detail::thalf const & Source,
detail::thalf const & Multiple detail::thalf const & Multiple
) )
{ {
int Tmp = int(float(Source)) % int(float(Multiple)); int Tmp = int(float(Source)) % int(float(Multiple));
return Tmp ? Source - detail::thalf(float(Tmp)) : Source; return Tmp ? Source - detail::thalf(float(Tmp)) : Source;
} }
template <> template <>
GLM_FUNC_QUALIFIER float lowerMultiple GLM_FUNC_QUALIFIER float lowerMultiple
( (
float const & Source, float const & Source,
float const & Multiple float const & Multiple
) )
{ {
int Tmp = int(Source) % int(Multiple); int Tmp = int(Source) % int(Multiple);
return Tmp ? Source - float(Tmp) : Source; return Tmp ? Source - float(Tmp) : Source;
} }
template <> template <>
GLM_FUNC_QUALIFIER double lowerMultiple GLM_FUNC_QUALIFIER double lowerMultiple
( (
double const & Source, double const & Source,
double const & Multiple double const & Multiple
) )
{ {
long Tmp = long(Source) % long(Multiple); long Tmp = long(Source) % long(Multiple);
return Tmp ? Source - double(Tmp) : Source; return Tmp ? Source - double(Tmp) : Source;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> lowerMultiple GLM_FUNC_QUALIFIER detail::tvec2<T> lowerMultiple
( (
detail::tvec2<T> const & Source, detail::tvec2<T> const & Source,
detail::tvec2<T> const & Multiple detail::tvec2<T> const & Multiple
) )
{ {
detail::tvec2<T> Result; detail::tvec2<T> Result;
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i) for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]); Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> lowerMultiple GLM_FUNC_QUALIFIER detail::tvec3<T> lowerMultiple
( (
detail::tvec3<T> const & Source, detail::tvec3<T> const & Source,
detail::tvec3<T> const & Multiple detail::tvec3<T> const & Multiple
) )
{ {
detail::tvec3<T> Result; detail::tvec3<T> Result;
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i) for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]); Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> lowerMultiple GLM_FUNC_QUALIFIER detail::tvec4<T> lowerMultiple
( (
detail::tvec4<T> const & Source, detail::tvec4<T> const & Source,
detail::tvec4<T> const & Multiple detail::tvec4<T> const & Multiple
) )
{ {
detail::tvec4<T> Result; detail::tvec4<T> Result;
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i) for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]); Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result; return Result;
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -49,8 +49,7 @@
# pragma message("GLM: GLM_GTX_noise extension included") # pragma message("GLM: GLM_GTX_noise extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_noise /// @addtogroup gtx_noise
/// @{ /// @{
@ -75,7 +74,6 @@ namespace gtx
vecType<T> const & p); vecType<T> const & p);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "noise.inl" #include "noise.inl"

@ -16,65 +16,64 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T permute(T const & x) GLM_FUNC_QUALIFIER T permute(T const & x)
{ {
return mod(((x * T(34)) + T(1)) * x, T(289)); return mod(((x * T(34)) + T(1)) * x, T(289));
} }
template <typename T, template<typename> class vecType> template <typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> permute(vecType<T> const & x) GLM_FUNC_QUALIFIER vecType<T> permute(vecType<T> const & x)
{ {
return mod(((x * T(34)) + T(1)) * x, T(289)); return mod(((x * T(34)) + T(1)) * x, T(289));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
{ {
return T(1.79284291400159) - T(0.85373472095314) * r; return T(1.79284291400159) - T(0.85373472095314) * r;
} }
template <typename T, template<typename> class vecType> template <typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> taylorInvSqrt(vecType<T> const & r) GLM_FUNC_QUALIFIER vecType<T> taylorInvSqrt(vecType<T> const & r)
{ {
return T(1.79284291400159) - T(0.85373472095314) * r; return T(1.79284291400159) - T(0.85373472095314) * r;
} }
template <typename T, template <typename> class vecType> template <typename T, template <typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> fade(vecType<T> const & t) GLM_FUNC_QUALIFIER vecType<T> fade(vecType<T> const & t)
{ {
return t * t * t * (t * (t * T(6) - T(15)) + T(10)); return t * t * t * (t * (t * T(6) - T(15)) + T(10));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> grad4(T const & j, detail::tvec4<T> const & ip) GLM_FUNC_QUALIFIER detail::tvec4<T> grad4(T const & j, detail::tvec4<T> const & ip)
{ {
detail::tvec3<T> pXYZ = floor(fract(detail::tvec3<T>(j) * detail::tvec3<T>(ip)) * T(7)) * ip[2] - T(1); detail::tvec3<T> pXYZ = floor(fract(detail::tvec3<T>(j) * detail::tvec3<T>(ip)) * T(7)) * ip[2] - T(1);
T pW = T(1.5) - dot(abs(pXYZ), detail::tvec3<T>(1)); T pW = T(1.5) - dot(abs(pXYZ), detail::tvec3<T>(1));
detail::tvec4<T> s = detail::tvec4<T>(lessThan(detail::tvec4<T>(pXYZ, pW), detail::tvec4<T>(0.0))); detail::tvec4<T> s = detail::tvec4<T>(lessThan(detail::tvec4<T>(pXYZ, pW), detail::tvec4<T>(0.0)));
pXYZ = pXYZ + (detail::tvec3<T>(s) * T(2) - T(1)) * s.w; pXYZ = pXYZ + (detail::tvec3<T>(s) * T(2) - T(1)) * s.w;
return detail::tvec4<T>(pXYZ, pW); return detail::tvec4<T>(pXYZ, pW);
} }
// Classic Perlin noise // Classic Perlin noise
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T> const & P) GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T> const & P)
{ {
detail::tvec4<T> Pi = floor(detail::tvec4<T>(P.x, P.y, P.x, P.y)) + detail::tvec4<T>(0.0, 0.0, 1.0, 1.0); detail::tvec4<T> Pi = glm::floor(detail::tvec4<T>(P.x, P.y, P.x, P.y)) + detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
detail::tvec4<T> Pf = fract(detail::tvec4<T>(P.x, P.y, P.x, P.y)) - detail::tvec4<T>(0.0, 0.0, 1.0, 1.0); detail::tvec4<T> Pf = glm::fract(detail::tvec4<T>(P.x, P.y, P.x, P.y)) - detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
Pi = mod(Pi, T(289)); // To avoid truncation effects in permutation Pi = mod(Pi, T(289)); // To avoid truncation effects in permutation
detail::tvec4<T> ix(Pi.x, Pi.z, Pi.x, Pi.z); detail::tvec4<T> ix(Pi.x, Pi.z, Pi.x, Pi.z);
detail::tvec4<T> iy(Pi.y, Pi.y, Pi.w, Pi.w); detail::tvec4<T> iy(Pi.y, Pi.y, Pi.w, Pi.w);
detail::tvec4<T> fx(Pf.x, Pf.z, Pf.x, Pf.z); detail::tvec4<T> fx(Pf.x, Pf.z, Pf.x, Pf.z);
detail::tvec4<T> fy(Pf.y, Pf.y, Pf.w, Pf.w); detail::tvec4<T> fy(Pf.y, Pf.y, Pf.w, Pf.w);
detail::tvec4<T> i = permute(permute(ix) + iy); detail::tvec4<T> i = glm::permute(glm::permute(ix) + iy);
detail::tvec4<T> gx = T(2) * fract(i / T(41)) - T(1); detail::tvec4<T> gx = T(2) * glm::fract(i / T(41)) - T(1);
detail::tvec4<T> gy = abs(gx) - T(0.5); detail::tvec4<T> gy = glm::abs(gx) - T(0.5);
detail::tvec4<T> tx = floor(gx + T(0.5)); detail::tvec4<T> tx = glm::floor(gx + T(0.5));
gx = gx - tx; gx = gx - tx;
detail::tvec2<T> g00(gx.x, gy.x); detail::tvec2<T> g00(gx.x, gy.x);
@ -97,12 +96,12 @@ namespace gtx{
detail::tvec2<T> n_x = mix(detail::tvec2<T>(n00, n01), detail::tvec2<T>(n10, n11), fade_xy.x); detail::tvec2<T> n_x = mix(detail::tvec2<T>(n00, n01), detail::tvec2<T>(n10, n11), fade_xy.x);
T n_xy = mix(n_x.x, n_x.y, fade_xy.y); T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
return T(2.3) * n_xy; return T(2.3) * n_xy;
} }
// Classic Perlin noise // Classic Perlin noise
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T perlin(detail::tvec3<T> const & P) GLM_FUNC_QUALIFIER T perlin(detail::tvec3<T> const & P)
{ {
detail::tvec3<T> Pi0 = floor(P); // Integer part for indexing detail::tvec3<T> Pi0 = floor(P); // Integer part for indexing
detail::tvec3<T> Pi1 = Pi0 + T(1); // Integer part + 1 detail::tvec3<T> Pi1 = Pi0 + T(1); // Integer part + 1
Pi0 = mod(Pi0, T(289)); Pi0 = mod(Pi0, T(289));
@ -170,12 +169,12 @@ namespace gtx{
detail::tvec2<T>(n_z.z, n_z.w), fade_xyz.y); detail::tvec2<T>(n_z.z, n_z.w), fade_xyz.y);
T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return T(2.2) * n_xyz; return T(2.2) * n_xyz;
} }
// Classic Perlin noise // Classic Perlin noise
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T perlin(detail::tvec4<T> const & P) GLM_FUNC_QUALIFIER T perlin(detail::tvec4<T> const & P)
{ {
detail::tvec4<T> Pi0 = floor(P); // Integer part for indexing detail::tvec4<T> Pi0 = floor(P); // Integer part for indexing
detail::tvec4<T> Pi1 = Pi0 + T(1); // Integer part + 1 detail::tvec4<T> Pi1 = Pi0 + T(1); // Integer part + 1
Pi0 = mod(Pi0, T(289)); Pi0 = mod(Pi0, T(289));
@ -306,12 +305,12 @@ namespace gtx{
detail::tvec2<T> n_yzw = mix(detail::tvec2<T>(n_zw.x, n_zw.y), detail::tvec2<T>(n_zw.z, n_zw.w), fade_xyzw.y); detail::tvec2<T> n_yzw = mix(detail::tvec2<T>(n_zw.x, n_zw.y), detail::tvec2<T>(n_zw.z, n_zw.w), fade_xyzw.y);
T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x); T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
return T(2.2) * n_xyzw; return T(2.2) * n_xyzw;
} }
// Classic Perlin noise, periodic variant // Classic Perlin noise, periodic variant
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T> const & P, detail::tvec2<T> const & rep) GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T> const & P, detail::tvec2<T> const & rep)
{ {
detail::tvec4<T> Pi = floor(detail::tvec4<T>(P.x, P.y, P.x, P.y)) + detail::tvec4<T>(0.0, 0.0, 1.0, 1.0); detail::tvec4<T> Pi = floor(detail::tvec4<T>(P.x, P.y, P.x, P.y)) + detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
detail::tvec4<T> Pf = fract(detail::tvec4<T>(P.x, P.y, P.x, P.y)) - detail::tvec4<T>(0.0, 0.0, 1.0, 1.0); detail::tvec4<T> Pf = fract(detail::tvec4<T>(P.x, P.y, P.x, P.y)) - detail::tvec4<T>(0.0, 0.0, 1.0, 1.0);
Pi = mod(Pi, detail::tvec4<T>(rep.x, rep.y, rep.x, rep.y)); // To create noise with explicit period Pi = mod(Pi, detail::tvec4<T>(rep.x, rep.y, rep.x, rep.y)); // To create noise with explicit period
@ -348,12 +347,12 @@ namespace gtx{
detail::tvec2<T> n_x = mix(detail::tvec2<T>(n00, n01), detail::tvec2<T>(n10, n11), fade_xy.x); detail::tvec2<T> n_x = mix(detail::tvec2<T>(n00, n01), detail::tvec2<T>(n10, n11), fade_xy.x);
T n_xy = mix(n_x.x, n_x.y, fade_xy.y); T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
return T(2.3) * n_xy; return T(2.3) * n_xy;
} }
// Classic Perlin noise, periodic variant // Classic Perlin noise, periodic variant
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T perlin(detail::tvec3<T> const & P, detail::tvec3<T> const & rep) GLM_FUNC_QUALIFIER T perlin(detail::tvec3<T> const & P, detail::tvec3<T> const & rep)
{ {
detail::tvec3<T> Pi0 = mod(floor(P), rep); // Integer part, modulo period detail::tvec3<T> Pi0 = mod(floor(P), rep); // Integer part, modulo period
detail::tvec3<T> Pi1 = mod(Pi0 + detail::tvec3<T>(1.0), rep); // Integer part + 1, mod period detail::tvec3<T> Pi1 = mod(Pi0 + detail::tvec3<T>(1.0), rep); // Integer part + 1, mod period
Pi0 = mod(Pi0, T(289)); Pi0 = mod(Pi0, T(289));
@ -419,12 +418,12 @@ namespace gtx{
detail::tvec2<T> n_yz = mix(detail::tvec2<T>(n_z.x, n_z.y), detail::tvec2<T>(n_z.z, n_z.w), fade_xyz.y); detail::tvec2<T> n_yz = mix(detail::tvec2<T>(n_z.x, n_z.y), detail::tvec2<T>(n_z.z, n_z.w), fade_xyz.y);
T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return T(2.2) * n_xyz; return T(2.2) * n_xyz;
} }
// Classic Perlin noise, periodic version // Classic Perlin noise, periodic version
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T perlin(detail::tvec4<T> const & P, detail::tvec4<T> const & rep) GLM_FUNC_QUALIFIER T perlin(detail::tvec4<T> const & P, detail::tvec4<T> const & rep)
{ {
detail::tvec4<T> Pi0 = mod(floor(P), rep); // Integer part modulo rep detail::tvec4<T> Pi0 = mod(floor(P), rep); // Integer part modulo rep
detail::tvec4<T> Pi1 = mod(Pi0 + T(1), rep); // Integer part + 1 mod rep detail::tvec4<T> Pi1 = mod(Pi0 + T(1), rep); // Integer part + 1 mod rep
detail::tvec4<T> Pf0 = fract(P); // Fractional part for interpolation detail::tvec4<T> Pf0 = fract(P); // Fractional part for interpolation
@ -553,11 +552,11 @@ namespace gtx{
detail::tvec2<T> n_yzw = mix(detail::tvec2<T>(n_zw.x, n_zw.y), detail::tvec2<T>(n_zw.z, n_zw.w), fade_xyzw.y); detail::tvec2<T> n_yzw = mix(detail::tvec2<T>(n_zw.x, n_zw.y), detail::tvec2<T>(n_zw.z, n_zw.w), fade_xyzw.y);
T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x); T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
return T(2.2) * n_xyzw; return T(2.2) * n_xyzw;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T simplex(glm::detail::tvec2<T> const & v) GLM_FUNC_QUALIFIER T simplex(glm::detail::tvec2<T> const & v)
{ {
detail::tvec4<T> const C = detail::tvec4<T>( detail::tvec4<T> const C = detail::tvec4<T>(
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0 T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0) T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
@ -610,11 +609,11 @@ namespace gtx{
g.y = a0.y * x12.x + h.y * x12.y; g.y = a0.y * x12.x + h.y * x12.y;
g.z = a0.z * x12.z + h.z * x12.w; g.z = a0.z * x12.z + h.z * x12.w;
return T(130) * dot(m, g); return T(130) * dot(m, g);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T simplex(detail::tvec3<T> const & v) GLM_FUNC_QUALIFIER T simplex(detail::tvec3<T> const & v)
{ {
detail::tvec2<T> const C = detail::tvec2<T>(1.0 / 6.0, 1.0 / 3.0); detail::tvec2<T> const C = detail::tvec2<T>(1.0 / 6.0, 1.0 / 3.0);
detail::tvec4<T> const D = detail::tvec4<T>(0.0, 0.5, 1.0, 2.0); detail::tvec4<T> const D = detail::tvec4<T>(0.0, 0.5, 1.0, 2.0);
@ -697,11 +696,11 @@ namespace gtx{
dot(p1, x1), dot(p1, x1),
dot(p2, x2), dot(p2, x2),
dot(p3, x3))); dot(p3, x3)));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T simplex(detail::tvec4<T> const & v) GLM_FUNC_QUALIFIER T simplex(detail::tvec4<T> const & v)
{ {
detail::tvec4<T> const C( detail::tvec4<T> const C(
0.138196601125011, // (5 - sqrt(5))/20 G4 0.138196601125011, // (5 - sqrt(5))/20 G4
0.276393202250021, // 2 * G4 0.276393202250021, // 2 * G4
@ -783,7 +782,6 @@ namespace gtx{
return T(49) * return T(49) *
(dot(m0 * m0, detail::tvec3<T>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) + (dot(m0 * m0, detail::tvec3<T>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
dot(m1 * m1, detail::tvec2<T>(dot(p3, x3), dot(p4, x4)))); dot(m1 * m1, detail::tvec2<T>(dot(p3, x3), dot(p4, x4))));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -49,8 +49,7 @@
# pragma message("GLM: GLM_GTX_norm extension included") # pragma message("GLM: GLM_GTX_norm extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_norm /// @addtogroup gtx_norm
/// @{ /// @{
@ -155,7 +154,6 @@ namespace gtx
unsigned int Depth); unsigned int Depth);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "norm.inl" #include "norm.inl"

@ -8,121 +8,119 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx
{ template <typename T>
template <typename T> GLM_FUNC_QUALIFIER T length2(
GLM_FUNC_QUALIFIER T length2(
const T x) const T x)
{ {
return x * x; return x * x;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T length2( GLM_FUNC_QUALIFIER T length2(
const detail::tvec2<T>& x) const detail::tvec2<T>& x)
{ {
return dot(x, x); return dot(x, x);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T length2( GLM_FUNC_QUALIFIER T length2(
const detail::tvec3<T>& x) const detail::tvec3<T>& x)
{ {
return dot(x, x); return dot(x, x);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T length2( GLM_FUNC_QUALIFIER T length2(
const detail::tvec4<T>& x) const detail::tvec4<T>& x)
{ {
return dot(x, x); return dot(x, x);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T length2( GLM_FUNC_QUALIFIER T length2(
const detail::tquat<T>& q) const detail::tquat<T>& q)
{ {
return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w; return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
} }
template <typename T> template <typename T>
T distance2( T distance2(
const T p0, const T p0,
const T p1) const T p1)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
T distance2( T distance2(
const detail::tvec2<T>& p0, const detail::tvec2<T>& p0,
const detail::tvec2<T>& p1) const detail::tvec2<T>& p1)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
T distance2( T distance2(
const detail::tvec3<T>& p0, const detail::tvec3<T>& p0,
const detail::tvec3<T>& p1) const detail::tvec3<T>& p1)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
T distance2( T distance2(
const detail::tvec4<T>& p0, const detail::tvec4<T>& p0,
const detail::tvec4<T>& p1) const detail::tvec4<T>& p1)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T l1Norm( GLM_FUNC_QUALIFIER T l1Norm(
const detail::tvec3<T>& a, const detail::tvec3<T>& a,
const detail::tvec3<T>& b) const detail::tvec3<T>& b)
{ {
return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z); return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T l1Norm( GLM_FUNC_QUALIFIER T l1Norm(
const detail::tvec3<T>& v) const detail::tvec3<T>& v)
{ {
return abs(v.x) + abs(v.y) + abs(v.z); return abs(v.x) + abs(v.y) + abs(v.z);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T l2Norm( GLM_FUNC_QUALIFIER T l2Norm(
const detail::tvec3<T>& a, const detail::tvec3<T>& a,
const detail::tvec3<T>& b) const detail::tvec3<T>& b)
{ {
return length(b - a); return length(b - a);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T l2Norm( GLM_FUNC_QUALIFIER T l2Norm(
const detail::tvec3<T>& v) const detail::tvec3<T>& v)
{ {
return length(v); return length(v);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T lxNorm( GLM_FUNC_QUALIFIER T lxNorm(
const detail::tvec3<T>& x, const detail::tvec3<T>& x,
const detail::tvec3<T>& y, const detail::tvec3<T>& y,
unsigned int Depth) unsigned int Depth)
{ {
return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth)); return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T lxNorm( GLM_FUNC_QUALIFIER T lxNorm(
const detail::tvec3<T>& v, const detail::tvec3<T>& v,
unsigned int Depth) unsigned int Depth)
{ {
return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth)); return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -46,8 +46,7 @@
# pragma message("GLM: GLM_GTX_normal extension included") # pragma message("GLM: GLM_GTX_normal extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_normal /// @addtogroup gtx_normal
/// @{ /// @{
@ -61,7 +60,6 @@ namespace gtx
detail::tvec3<T> const & p3); detail::tvec3<T> const & p3);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "normal.inl" #include "normal.inl"

@ -8,7 +8,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
@ -21,5 +20,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
return normalize(cross(p1 - p2, p1 - p3)); return normalize(cross(p1 - p2, p1 - p3));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -47,8 +47,7 @@
# pragma message("GLM: GLM_GTX_normalize_dot extension included") # pragma message("GLM: GLM_GTX_normalize_dot extension included")
#endif #endif
namespace glm{ namespace glm
namespace gtx
{ {
/// @addtogroup gtx_normalize_dot /// @addtogroup gtx_normalize_dot
/// @{ /// @{
@ -70,7 +69,6 @@ namespace gtx
genType const & y); genType const & y);
/// @} /// @}
}//namespace gtx
}//namespace glm }//namespace glm
#include "normalize_dot.inl" #include "normalize_dot.inl"

@ -8,7 +8,6 @@
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType normalizeDot GLM_FUNC_QUALIFIER genType normalizeDot
@ -71,7 +70,7 @@ GLM_FUNC_QUALIFIER genType fastNormalizeDot
{ {
return return
glm::dot(x, y) * glm::dot(x, y) *
glm::gtx::fastInverseSqrt(glm::dot(x, x) * fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y)); glm::dot(y, y));
} }
@ -84,7 +83,7 @@ GLM_FUNC_QUALIFIER valType fastNormalizeDot
{ {
return return
glm::dot(x, y) * glm::dot(x, y) *
glm::gtx::fastInverseSqrt(glm::dot(x, x) * fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y)); glm::dot(y, y));
} }
@ -97,7 +96,7 @@ GLM_FUNC_QUALIFIER valType fastNormalizeDot
{ {
return return
glm::dot(x, y) * glm::dot(x, y) *
glm::gtx::fastInverseSqrt(glm::dot(x, x) * fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y)); glm::dot(y, y));
} }
@ -110,9 +109,8 @@ GLM_FUNC_QUALIFIER valType fastNormalizeDot
{ {
return return
glm::dot(x, y) * glm::dot(x, y) *
glm::gtx::fastInverseSqrt(glm::dot(x, x) * fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y)); glm::dot(y, y));
} }
}//namespace gtx
}//namespace glm }//namespace glm

@ -8,54 +8,52 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm{
namespace gtx{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType pow2(const genType& x) GLM_FUNC_QUALIFIER genType pow2(const genType& x)
{ {
return x * x; return x * x;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType pow3(const genType& x) GLM_FUNC_QUALIFIER genType pow3(const genType& x)
{ {
return x * x * x; return x * x * x;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType pow4(const genType& x) GLM_FUNC_QUALIFIER genType pow4(const genType& x)
{ {
return x * x * x * x; return x * x * x * x;
} }
GLM_FUNC_QUALIFIER bool powOfTwo(int x) GLM_FUNC_QUALIFIER bool powOfTwo(int x)
{ {
return !(x & (x - 1)); return !(x & (x - 1));
} }
GLM_FUNC_QUALIFIER detail::tvec2<bool> powOfTwo(const detail::tvec2<int>& x) GLM_FUNC_QUALIFIER detail::tvec2<bool> powOfTwo(const detail::tvec2<int>& x)
{ {
return detail::tvec2<bool>( return detail::tvec2<bool>(
powOfTwo(x.x), powOfTwo(x.x),
powOfTwo(x.y)); powOfTwo(x.y));
} }
GLM_FUNC_QUALIFIER detail::tvec3<bool> powOfTwo(const detail::tvec3<int>& x) GLM_FUNC_QUALIFIER detail::tvec3<bool> powOfTwo(const detail::tvec3<int>& x)
{ {
return detail::tvec3<bool>( return detail::tvec3<bool>(
powOfTwo(x.x), powOfTwo(x.x),
powOfTwo(x.y), powOfTwo(x.y),
powOfTwo(x.z)); powOfTwo(x.z));
} }
GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x) GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x)
{ {
return detail::tvec4<bool>( return detail::tvec4<bool>(
powOfTwo(x.x), powOfTwo(x.x),
powOfTwo(x.y), powOfTwo(x.y),
powOfTwo(x.z), powOfTwo(x.z),
powOfTwo(x.w)); powOfTwo(x.w));
} }
}//namespace gtx
}//namespace glm }//namespace glm

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save