Vectorize and reformatting

This commit is contained in:
Christophe Riccio 2011-10-14 14:07:53 +01:00
parent 7e9ca13cde
commit 8d843a448a
40 changed files with 2772 additions and 3411 deletions

View File

@ -7,8 +7,8 @@
// File : glm/gtx/gradient_paint.inl // File : glm/gtx/gradient_paint.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename valType> template <typename valType>
valType radialGradient valType radialGradient
( (
@ -40,5 +40,4 @@ valType linearGradient
detail::tvec2<valType> Dist = Point1 - Point0; 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 glm }//namespace glm

View File

@ -7,24 +7,27 @@
// File : glm/gtx/handed_coordinate_space.inl // File : glm/gtx/handed_coordinate_space.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
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 glm }//namespace glm

View File

@ -55,57 +55,57 @@ namespace glm
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat3x3<T> boxInertia3( detail::tmat3x3<T> boxInertia3(
const T Mass, T const & Mass,
const detail::tvec3<T>& Scale); detail::tvec3<T> const & Scale);
//! Build an inertia matrix for a box. //! Build an inertia matrix for a box.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat4x4<T> boxInertia4( detail::tmat4x4<T> boxInertia4(
const T Mass, T const & Mass,
const detail::tvec3<T>& Scale); detail::tvec3<T> const & Scale);
//! Build an inertia matrix for a disk. //! Build an inertia matrix for a disk.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat3x3<T> diskInertia3( detail::tmat3x3<T> diskInertia3(
const T Mass, T const & Mass,
const T Radius); T const & Radius);
//! Build an inertia matrix for a disk. //! Build an inertia matrix for a disk.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat4x4<T> diskInertia4( detail::tmat4x4<T> diskInertia4(
const T Mass, T const & Mass,
const T Radius); T const & Radius);
//! Build an inertia matrix for a ball. //! Build an inertia matrix for a ball.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat3x3<T> ballInertia3( detail::tmat3x3<T> ballInertia3(
const T Mass, T const & Mass,
const T Radius); T const & Radius);
//! Build an inertia matrix for a ball. //! Build an inertia matrix for a ball.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat4x4<T> ballInertia4( detail::tmat4x4<T> ballInertia4(
const T Mass, T const & Mass,
const T Radius); T const & Radius);
//! Build an inertia matrix for a sphere. //! Build an inertia matrix for a sphere.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat3x3<T> sphereInertia3( detail::tmat3x3<T> sphereInertia3(
const T Mass, T const & Mass,
const T Radius); T const & Radius);
//! Build an inertia matrix for a sphere. //! Build an inertia matrix for a sphere.
//! From GLM_GTX_inertia extension. //! From GLM_GTX_inertia extension.
template <typename T> template <typename T>
detail::tmat4x4<T> sphereInertia4( detail::tmat4x4<T> sphereInertia4(
const T Mass, T const & Mass,
const T Radius); T const & Radius);
/// @} /// @}
}// namespace glm }// namespace glm

View File

@ -7,12 +7,14 @@
// File : glm/gtx/inertia.inl // File : glm/gtx/inertia.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3
const T Mass, (
const detail::tvec3<T>& Scale) T const & Mass,
detail::tvec3<T> const & 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);
@ -22,9 +24,11 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4
const T Mass, (
const detail::tvec3<T>& Scale) T const & Mass,
detail::tvec3<T> const & 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);
@ -34,9 +38,11 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
} }
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 Radius) T const & Mass,
T const & 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);
@ -45,9 +51,11 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
} }
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 Radius) T const & Mass,
T const & 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);
@ -57,18 +65,22 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
} }
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 Radius) T const & Mass,
T const & 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 Radius) T const & Mass,
T const & 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);
@ -77,23 +89,26 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
} }
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 Radius) T const & Mass,
T const & 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 Radius) T const & Mass,
T const & 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 glm }//namespace glm

View File

@ -7,11 +7,13 @@
// File : glm/gtx/int_10_10_10_2.inl // File : glm/gtx/int_10_10_10_2.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
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 glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/integer.inl // File : glm/gtx/integer.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
// pow // pow
GLM_FUNC_QUALIFIER int pow(int x, int y) GLM_FUNC_QUALIFIER int pow(int x, int y)
{ {

View File

@ -10,8 +10,8 @@
#include <cfloat> #include <cfloat>
#include <limits> #include <limits>
namespace glm{ namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER bool intersectRayTriangle GLM_FUNC_QUALIFIER bool intersectRayTriangle
( (
@ -193,5 +193,4 @@ GLM_FUNC_QUALIFIER bool intersectLineSphere
} }
return false; return false;
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,10 @@
// File : glm/gtx/log_base.inl // File : glm/gtx/log_base.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ #include "../core/_vectorize.hpp"
namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType log( GLM_FUNC_QUALIFIER genType log(
genType const & x, genType const & x,
@ -19,70 +21,6 @@ GLM_FUNC_QUALIFIER genType log(
return glm::log(x) / glm::log(base); return glm::log(x) / glm::log(base);
} }
template <typename valType> VECTORIZE_VEC_SCA(log)
GLM_FUNC_QUALIFIER detail::tvec2<valType> log( VECTORIZE_VEC_VEC(log)
detail::tvec2<valType> const & v,
valType const & base)
{
return detail::tvec2<valType>(
log(v.x, base),
log(v.y, base));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
detail::tvec3<valType> const & v,
valType const & base)
{
return detail::tvec3<valType>(
log(v.x, base),
log(v.y, base),
log(v.z, base));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
detail::tvec4<valType> const & v,
valType const & base)
{
return detail::tvec4<valType>(
log(v.x, base),
log(v.y, base),
log(v.z, base),
log(v.w, base));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
detail::tvec2<valType> const & v,
detail::tvec2<valType> const & base)
{
return detail::tvec2<valType>(
log(v.x, base.x),
log(v.y, base.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
detail::tvec3<valType> const & v,
detail::tvec3<valType> const & base)
{
return detail::tvec3<valType>(
log(v.x, base.x),
log(v.y, base.y),
log(v.z, base.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
detail::tvec4<valType> const & v,
detail::tvec4<valType> const & base)
{
return detail::tvec4<valType>(
log(v.x, base.x),
log(v.y, base.y),
log(v.z, base.z),
log(v.w, base.w));
}
}//namespace glm }//namespace glm

View File

@ -7,11 +7,13 @@
// File : glm/gtx/matrix_cross_product.inl // File : glm/gtx/matrix_cross_product.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3( GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3
detail::tvec3<T> const & x) (
detail::tvec3<T> const & x
)
{ {
detail::tmat3x3<T> Result(T(0)); detail::tmat3x3<T> Result(T(0));
Result[0][1] = x.z; Result[0][1] = x.z;
@ -24,8 +26,10 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4( GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4
detail::tvec3<T> const & x) (
detail::tvec3<T> const & x
)
{ {
detail::tmat4x4<T> Result(T(0)); detail::tmat4x4<T> Result(T(0));
Result[0][1] = x.z; Result[0][1] = x.z;

View File

@ -7,13 +7,15 @@
// File : glm/gtx/matrix_interpolation.inl // File : glm/gtx/matrix_interpolation.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
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;
@ -76,9 +78,11 @@ GLM_FUNC_QUALIFIER void axisAngle(
} }
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);
@ -94,10 +98,12 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
} }
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;
@ -109,5 +115,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
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 glm }//namespace glm

View File

@ -55,85 +55,85 @@ namespace glm
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat2x2<T> rowMajor2( detail::tmat2x2<T> rowMajor2(
const detail::tvec2<T>& v1, detail::tvec2<T> const & v1,
const detail::tvec2<T>& v2); detail::tvec2<T> const & v2);
//! Build a row major matrix from other matrix. //! Build a row major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat2x2<T> rowMajor2( detail::tmat2x2<T> rowMajor2(
const detail::tmat2x2<T>& m); detail::tmat2x2<T> const & m);
//! Build a row major matrix from row vectors. //! Build a row major matrix from row vectors.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat3x3<T> rowMajor3( detail::tmat3x3<T> rowMajor3(
const detail::tvec3<T>& v1, detail::tvec3<T> const & v1,
const detail::tvec3<T>& v2, detail::tvec3<T> const & v2,
const detail::tvec3<T>& v3); detail::tvec3<T> const & v3);
//! Build a row major matrix from other matrix. //! Build a row major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat3x3<T> rowMajor3( detail::tmat3x3<T> rowMajor3(
const detail::tmat3x3<T>& m); detail::tmat3x3<T> const & m);
//! Build a row major matrix from row vectors. //! Build a row major matrix from row vectors.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat4x4<T> rowMajor4( detail::tmat4x4<T> rowMajor4(
const detail::tvec4<T>& v1, detail::tvec4<T> const & v1,
const detail::tvec4<T>& v2, detail::tvec4<T> const & v2,
const detail::tvec4<T>& v3, detail::tvec4<T> const & v3,
const detail::tvec4<T>& v4); detail::tvec4<T> const & v4);
//! Build a row major matrix from other matrix. //! Build a row major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat4x4<T> rowMajor4( detail::tmat4x4<T> rowMajor4(
const detail::tmat4x4<T>& m); detail::tmat4x4<T> const & m);
//! Build a column major matrix from column vectors. //! Build a column major matrix from column vectors.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat2x2<T> colMajor2( detail::tmat2x2<T> colMajor2(
const detail::tvec2<T>& v1, detail::tvec2<T> const & v1,
const detail::tvec2<T>& v2); detail::tvec2<T> const & v2);
//! Build a column major matrix from other matrix. //! Build a column major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat2x2<T> colMajor2( detail::tmat2x2<T> colMajor2(
const detail::tmat2x2<T>& m); detail::tmat2x2<T> const & m);
//! Build a column major matrix from column vectors. //! Build a column major matrix from column vectors.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat3x3<T> colMajor3( detail::tmat3x3<T> colMajor3(
const detail::tvec3<T>& v1, detail::tvec3<T> const & v1,
const detail::tvec3<T>& v2, detail::tvec3<T> const & v2,
const detail::tvec3<T>& v3); detail::tvec3<T> const & v3);
//! Build a column major matrix from other matrix. //! Build a column major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat3x3<T> colMajor3( detail::tmat3x3<T> colMajor3(
const detail::tmat3x3<T>& m); detail::tmat3x3<T> const & m);
//! Build a column major matrix from column vectors. //! Build a column major matrix from column vectors.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat4x4<T> colMajor4( detail::tmat4x4<T> colMajor4(
const detail::tvec4<T>& v1, detail::tvec4<T> const & v1,
const detail::tvec4<T>& v2, detail::tvec4<T> const & v2,
const detail::tvec4<T>& v3, detail::tvec4<T> const & v3,
const detail::tvec4<T>& v4); detail::tvec4<T> const & v4);
//! Build a column major matrix from other matrix. //! Build a column major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension. //! From GLM_GTX_matrix_major_storage extension.
template <typename T> template <typename T>
detail::tmat4x4<T> colMajor4( detail::tmat4x4<T> colMajor4(
const detail::tmat4x4<T>& m); detail::tmat4x4<T> const & m);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -7,12 +7,14 @@
// File : glm/gtx/matrix_major_storage.inl // File : glm/gtx/matrix_major_storage.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
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>& v2) detail::tvec2<T> const & v1,
detail::tvec2<T> const & v2
)
{ {
detail::tmat2x2<T> Result; detail::tmat2x2<T> Result;
Result[0][0] = v1.x; Result[0][0] = v1.x;
@ -168,5 +170,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
{ {
return detail::tmat4x4<T>(m); return detail::tmat4x4<T>(m);
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/matrix_operation.inl // File : glm/gtx/matrix_operation.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2 GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
( (
@ -121,5 +121,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
Result[1][1] = v[1]; Result[1][1] = v[1];
return Result; return Result;
} }
}//namespace glm }//namespace glm

View File

@ -56,57 +56,57 @@ namespace glm
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename T> template<typename T>
bool isNull( bool isNull(
const detail::tmat2x2<T>& m, detail::tmat2x2<T> const & m,
const T epsilon = std::numeric_limits<T>::epsilon()); T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a null matrix. //! Return if a matrix a null matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename T> template<typename T>
bool isNull( bool isNull(
const detail::tmat3x3<T>& m, detail::tmat3x3<T> const & m,
const T epsilon = std::numeric_limits<T>::epsilon()); T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a null matrix. //! Return if a matrix a null matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename T> template<typename T>
bool isNull( bool isNull(
const detail::tmat4x4<T>& m, detail::tmat4x4<T> const & m,
const T epsilon = std::numeric_limits<T>::epsilon()); T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix an identity matrix. //! Return if a matrix an identity matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename genType> template<typename genType>
bool isIdentity( bool isIdentity(
const genType& m, genType const & m,
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon()); typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
//! Return if a matrix a normalized matrix. //! Return if a matrix a normalized matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename T> template<typename T>
bool isNormalized( bool isNormalized(
const detail::tmat2x2<T>& m, detail::tmat2x2<T> const & m,
const T epsilon = std::numeric_limits<T>::epsilon()); T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a normalized matrix. //! Return if a matrix a normalized matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename T> template<typename T>
bool isNormalized( bool isNormalized(
const detail::tmat3x3<T>& m, detail::tmat3x3<T> const & m,
const T epsilon = std::numeric_limits<T>::epsilon()); T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a normalized matrix. //! Return if a matrix a normalized matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename T> template<typename T>
bool isNormalized( bool isNormalized(
const detail::tmat4x4<T>& m, detail::tmat4x4<T> const & m,
const T epsilon = std::numeric_limits<T>::epsilon()); T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix an orthonormalized matrix. //! Return if a matrix an orthonormalized matrix.
//! From GLM_GTX_matrix_query extension. //! From GLM_GTX_matrix_query extension.
template<typename genType> template<typename genType>
bool isOrthogonal( bool isOrthogonal(
const genType& m, genType const & m,
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon()); typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -10,12 +10,13 @@
// - GLM core // - GLM core
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNull( GLM_FUNC_QUALIFIER bool isNull
const detail::tmat2x2<T>& m, (
const T epsilon) detail::tmat2x2<T> const & m,
T const & epsilon)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 2 ; ++i) for(int i = 0; result && i < 2 ; ++i)
@ -24,9 +25,11 @@ GLM_FUNC_QUALIFIER bool isNull(
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNull( GLM_FUNC_QUALIFIER bool isNull
const detail::tmat3x3<T>& m, (
const T epsilon) detail::tmat3x3<T> const & m,
T const & epsilon
)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 3 ; ++i) for(int i = 0; result && i < 3 ; ++i)
@ -35,9 +38,11 @@ GLM_FUNC_QUALIFIER bool isNull(
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNull( GLM_FUNC_QUALIFIER bool isNull
const detail::tmat4x4<T>& m, (
const T epsilon) detail::tmat4x4<T> const & m,
T const & epsilon
)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 4 ; ++i) for(int i = 0; result && i < 4 ; ++i)
@ -46,9 +51,11 @@ GLM_FUNC_QUALIFIER bool isNull(
} }
template<typename genType> template<typename genType>
GLM_FUNC_QUALIFIER bool isIdentity( GLM_FUNC_QUALIFIER bool isIdentity
const genType& m, (
const typename genType::value_type epsilon) genType const & m,
typename genType::value_type const & 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)
@ -64,9 +71,11 @@ GLM_FUNC_QUALIFIER bool isIdentity(
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized( GLM_FUNC_QUALIFIER bool isNormalized
const detail::tmat2x2<T>& m, (
const T epsilon) detail::tmat2x2<T> const & m,
T const & epsilon
)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 2; ++i) for(int i = 0; result && i < 2; ++i)
@ -82,9 +91,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized( GLM_FUNC_QUALIFIER bool isNormalized
const detail::tmat3x3<T>& m, (
const T epsilon) detail::tmat3x3<T> const & m,
T const & epsilon
)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 3; ++i) for(int i = 0; result && i < 3; ++i)
@ -100,9 +111,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
} }
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized( GLM_FUNC_QUALIFIER bool isNormalized
const detail::tmat4x4<T>& m, (
const T epsilon) detail::tmat4x4<T> const & m,
T const & epsilon
)
{ {
bool result = true; bool result = true;
for(int i = 0; result && i < 4; ++i) for(int i = 0; result && i < 4; ++i)
@ -118,9 +131,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
} }
template<typename genType> template<typename genType>
GLM_FUNC_QUALIFIER bool isOrthogonal( GLM_FUNC_QUALIFIER bool isOrthogonal
const genType& m, (
const typename genType::value_type epsilon) genType const & m,
typename genType::value_type const & 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)
@ -136,5 +151,4 @@ GLM_FUNC_QUALIFIER bool isOrthogonal(
} }
return result; return result;
} }
}//namespace glm }//namespace glm

View File

@ -7,15 +7,16 @@
// File : glm/gtx/mixed_product.inl // File : glm/gtx/mixed_product.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER valType mixedProduct( GLM_FUNC_QUALIFIER valType mixedProduct
(
detail::tvec3<valType> const & v1, detail::tvec3<valType> const & v1,
detail::tvec3<valType> const & v2, detail::tvec3<valType> const & v2,
detail::tvec3<valType> const & v3) detail::tvec3<valType> const & v3
)
{ {
return dot(cross(v1, v2), v3); return dot(cross(v1, v2), v3);
} }
}//namespace glm }//namespace glm

View File

@ -10,8 +10,10 @@
// - GLM core // - GLM core
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ #include "../core/_vectorize.hpp"
namespace glm
{
////////////////////// //////////////////////
// higherMultiple // higherMultiple
@ -62,44 +64,7 @@ GLM_FUNC_QUALIFIER double higherMultiple
return Tmp ? Source + Multiple - double(Tmp) : Source; return Tmp ? Source + Multiple - double(Tmp) : Source;
} }
template <typename T> VECTORIZE_VEC_VEC(higherMultiple)
GLM_FUNC_QUALIFIER detail::tvec2<T> higherMultiple
(
detail::tvec2<T> const & Source,
detail::tvec2<T> const & Multiple
)
{
detail::tvec2<T> Result;
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> higherMultiple
(
detail::tvec3<T> const & Source,
detail::tvec3<T> const & Multiple
)
{
detail::tvec3<T> Result;
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> higherMultiple
(
detail::tvec4<T> const & Source,
detail::tvec4<T> const & Multiple
)
{
detail::tvec4<T> Result;
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result;
}
////////////////////// //////////////////////
// lowerMultiple // lowerMultiple
@ -151,43 +116,5 @@ GLM_FUNC_QUALIFIER double lowerMultiple
return Tmp ? Source - double(Tmp) : Source; return Tmp ? Source - double(Tmp) : Source;
} }
template <typename T> VECTORIZE_VEC_VEC(lowerMultiple)
GLM_FUNC_QUALIFIER detail::tvec2<T> lowerMultiple
(
detail::tvec2<T> const & Source,
detail::tvec2<T> const & Multiple
)
{
detail::tvec2<T> Result;
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> lowerMultiple
(
detail::tvec3<T> const & Source,
detail::tvec3<T> const & Multiple
)
{
detail::tvec3<T> Result;
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> lowerMultiple
(
detail::tvec4<T> const & Source,
detail::tvec4<T> const & Multiple
)
{
detail::tvec4<T> Result;
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result;
}
}//namespace glm }//namespace glm

View File

@ -56,99 +56,73 @@ namespace glm
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T length2( T length2(
const T x); T const & x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename genType>
typename genType::value_type length2(
genType const & x);
//! Returns the squared length of x. //! Returns the squared length of x.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T length2( T length2(
const detail::tvec2<T> & x); detail::tquat<T> const & q);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tvec3<T>& x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tvec4<T>& x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tquat<T>& q);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T distance2( T distance2(
const T p0, T const & p0,
const T p1); T const & p1);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename genType>
T distance2( typename genType::value_type distance2(
const detail::tvec2<T>& p0, genType const & p0,
const detail::tvec2<T>& p1); genType const & p1);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension.
template <typename T>
T distance2(
const detail::tvec3<T>& p0,
const detail::tvec3<T>& p1);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension.
template <typename T>
T distance2(
const detail::tvec4<T>& p0,
const detail::tvec4<T>& p1);
//! Returns the L1 norm between x and y. //! Returns the L1 norm between x and y.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T l1Norm( T l1Norm(
const detail::tvec3<T>& x, detail::tvec3<T> const & x,
const detail::tvec3<T>& y); detail::tvec3<T> const & y);
//! Returns the L1 norm of v. //! Returns the L1 norm of v.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T l1Norm( T l1Norm(
const detail::tvec3<T>& v); detail::tvec3<T> const & v);
//! Returns the L2 norm between x and y. //! Returns the L2 norm between x and y.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T l2Norm( T l2Norm(
const detail::tvec3<T>& x, detail::tvec3<T> const & x,
const detail::tvec3<T>& y); detail::tvec3<T> const & y);
//! Returns the L2 norm of v. //! Returns the L2 norm of v.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T l2Norm( T l2Norm(
const detail::tvec3<T>& x); detail::tvec3<T> const & x);
//! Returns the L norm between x and y. //! Returns the L norm between x and y.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T lxNorm( T lxNorm(
const detail::tvec3<T>& x, detail::tvec3<T> const & x,
const detail::tvec3<T>& y, detail::tvec3<T> const & y,
unsigned int Depth); unsigned int Depth);
//! Returns the L norm of v. //! Returns the L norm of v.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.
template <typename T> template <typename T>
T lxNorm( T lxNorm(
const detail::tvec3<T>& x, detail::tvec3<T> const & x,
unsigned int Depth); unsigned int Depth);
/// @} /// @}

View File

@ -7,118 +7,148 @@
// File : glm/gtx/norm.inl // File : glm/gtx/norm.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T length2( GLM_FUNC_QUALIFIER T length2
const T x) (
T const & 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) (
detail::tvec2<T> const & 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) (
detail::tvec3<T> const & 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) (
detail::tvec4<T> const & 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) (
detail::tquat<T> const & 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( GLM_FUNC_QUALIFIER T distance2
const T p0, (
const T p1) T const & p0,
T const & p1
)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
T distance2( GLM_FUNC_QUALIFIER T distance2
const detail::tvec2<T>& p0, (
const detail::tvec2<T>& p1) detail::tvec2<T> const & p0,
detail::tvec2<T> const & p1
)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
T distance2( GLM_FUNC_QUALIFIER T distance2
const detail::tvec3<T>& p0, (
const detail::tvec3<T>& p1) detail::tvec3<T> const & p0,
detail::tvec3<T> const & p1
)
{ {
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T> template <typename T>
T distance2( GLM_FUNC_QUALIFIER T distance2
const detail::tvec4<T>& p0, (
const detail::tvec4<T>& p1) detail::tvec4<T> const & p0,
detail::tvec4<T> const & 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>& b) detail::tvec3<T> const & a,
detail::tvec3<T> const & 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) (
detail::tvec3<T> const & 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>& b) detail::tvec3<T> const & a,
detail::tvec3<T> const & 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) (
detail::tvec3<T> const & 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>& y, detail::tvec3<T> const & x,
unsigned int Depth) detail::tvec3<T> const & y,
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, (
unsigned int Depth) detail::tvec3<T> const & v,
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));
} }

View File

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

View File

@ -7,8 +7,8 @@
// File : glm/gtx/normalize_dot.inl // File : glm/gtx/normalize_dot.inl
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType normalizeDot GLM_FUNC_QUALIFIER genType normalizeDot
( (
@ -112,5 +112,4 @@ GLM_FUNC_QUALIFIER valType fastNormalizeDot
fastInverseSqrt(glm::dot(x, x) * fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y)); glm::dot(y, y));
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/optimum_pow.inl // File : glm/gtx/optimum_pow.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType pow2(const genType& x) GLM_FUNC_QUALIFIER genType pow2(const genType& x)
{ {
@ -55,5 +55,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x)
powOfTwo(x.z), powOfTwo(x.z),
powOfTwo(x.w)); powOfTwo(x.w));
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/orthonormalize.inl // File : glm/gtx/orthonormalize.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> orthonormalize GLM_FUNC_QUALIFIER detail::tmat3x3<T> orthonormalize
( (
@ -40,5 +40,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> orthonormalize
{ {
return normalize(x - y * dot(y, x)); return normalize(x - y * dot(y, x));
} }
}//namespace glm }//namespace glm

View File

@ -54,24 +54,10 @@ namespace glm
//! Projects x a perpendicular axis of Normal. //! Projects x a perpendicular axis of Normal.
//! From GLM_GTX_perpendicular extension. //! From GLM_GTX_perpendicular extension.
template <typename T> template <typename vecType>
detail::tvec2<T> perp( vecType perp(
detail::tvec2<T> const & x, vecType const & x,
detail::tvec2<T> const & Normal); vecType const & Normal);
//! Projects x a perpendicular axis of Normal.
//! From GLM_GTX_perpendicular extension.
template <typename T>
detail::tvec3<T> perp(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal);
//! Projects x a perpendicular axis of Normal.
//! From GLM_GTX_perpendicular extension.
template <typename T>
detail::tvec4<T> perp(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -7,30 +7,15 @@
// File : glm/gtx/perpendicular.inl // File : glm/gtx/perpendicular.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename vecType>
GLM_FUNC_QUALIFIER detail::tvec2<T> perp( GLM_FUNC_QUALIFIER vecType perp
detail::tvec2<T> const & x, (
detail::tvec2<T> const & Normal) vecType const & x,
vecType const & Normal
)
{ {
return x - proj(x, Normal); return x - proj(x, Normal);
} }
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> perp(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal)
{
return x - proj(x, Normal);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> perp(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal)
{
return x - proj(x, Normal);
}
}//namespace glm }//namespace glm

View File

@ -53,12 +53,14 @@ namespace glm
//! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. //! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.
//! From GLM_GTX_polar_coordinates extension. //! From GLM_GTX_polar_coordinates extension.
template <typename T> template <typename T>
detail::tvec3<T> polar(const detail::tvec3<T>& euclidean); detail::tvec3<T> polar(
detail::tvec3<T> const & euclidean);
//! Convert Polar to Euclidean coordinates. //! Convert Polar to Euclidean coordinates.
//! From GLM_GTX_polar_coordinates extension. //! From GLM_GTX_polar_coordinates extension.
template <typename T> template <typename T>
detail::tvec3<T> euclidean(const detail::tvec3<T>& polar); detail::tvec3<T> euclidean(
detail::tvec3<T> const & polar);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -10,8 +10,10 @@
namespace glm namespace glm
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> polar( GLM_FUNC_QUALIFIER detail::tvec3<T> polar
const detail::tvec3<T>& euclidean) (
detail::tvec3<T> const & euclidean
)
{ {
T length = length(euclidean); T length = length(euclidean);
detail::tvec3<T> tmp = euclidean / length; detail::tvec3<T> tmp = euclidean / length;
@ -24,8 +26,10 @@ namespace glm
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean( GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean
const detail::tvec3<T>& polar) (
detail::tvec3<T> const & polar
)
{ {
T latitude = radians(polar.x); T latitude = radians(polar.x);
T longitude = radians(polar.y); T longitude = radians(polar.y);

View File

@ -52,24 +52,10 @@ namespace glm
//! Projects x on Normal. //! Projects x on Normal.
//! From GLM_GTX_projection extension. //! From GLM_GTX_projection extension.
template <typename T> template <typename vecType>
detail::tvec2<T> proj( vecType proj(
detail::tvec2<T> const & x, vecType const & x,
detail::tvec2<T> const & Normal); vecType const & Normal);
//! Projects x on Normal.
//! From GLM_GTX_projection extension.
template <typename T>
detail::tvec3<T> proj(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal);
//! Projects x on Normal.
//! From GLM_GTX_projection extension.
template <typename T>
detail::tvec4<T> proj(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -7,30 +7,15 @@
// File : glm/gtx/projection.inl // File : glm/gtx/projection.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename vecType>
GLM_FUNC_QUALIFIER detail::tvec2<T> proj( GLM_FUNC_QUALIFIER vecType proj
detail::tvec2<T> const & x, (
detail::tvec2<T> const & Normal) vecType const & x,
vecType const & Normal
)
{ {
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
} }
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> proj(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal)
{
return dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> proj(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal)
{
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
}
}//namespace glm }//namespace glm

View File

@ -9,8 +9,8 @@
#include <limits> #include <limits>
namespace glm{ namespace glm
{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> cross GLM_FUNC_QUALIFIER detail::tvec3<valType> cross
( (
@ -295,5 +295,4 @@ GLM_FUNC_QUALIFIER detail::tquat<T> fastMix
{ {
return glm::normalize(x * (T(1) - a) + (y * a)); return glm::normalize(x * (T(1) - a) + (y * a));
} }
}//namespace glm }//namespace glm

View File

@ -2,13 +2,15 @@
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-10-09 // Created : 2008-10-09
// Updated : 2008-10-09 // Updated : 2011-10-14
// Licence : This source is under MIT License // Licence : This source is under MIT License
// File : glm/gtx/reciprocal.inl // File : glm/gtx/reciprocal.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ #include "../core/_vectorize.hpp"
namespace glm
{
// sec // sec
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType sec GLM_FUNC_QUALIFIER genType sec
@ -21,41 +23,7 @@ GLM_FUNC_QUALIFIER genType sec
return genType(1) / glm::cos(angle); return genType(1) / glm::cos(angle);
} }
template <typename valType> VECTORIZE_VEC(sec)
GLM_FUNC_QUALIFIER detail::tvec2<valType> sec
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
sec(angle.x),
sec(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> sec
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
sec(angle.x),
sec(angle.y),
sec(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> sec
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
sec(angle.x),
sec(angle.y),
sec(angle.z),
sec(angle.w));
}
// csc // csc
template <typename genType> template <typename genType>
@ -69,41 +37,7 @@ GLM_FUNC_QUALIFIER genType csc
return genType(1) / glm::sin(angle); return genType(1) / glm::sin(angle);
} }
template <typename valType> VECTORIZE_VEC(csc)
GLM_FUNC_QUALIFIER detail::tvec2<valType> csc
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
csc(angle.x),
csc(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> csc
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
csc(angle.x),
csc(angle.y),
csc(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> csc
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
csc(angle.x),
csc(angle.y),
csc(angle.z),
csc(angle.w));
}
// cot // cot
template <typename genType> template <typename genType>
@ -117,41 +51,7 @@ GLM_FUNC_QUALIFIER genType cot
return genType(1) / glm::tan(angle); return genType(1) / glm::tan(angle);
} }
template <typename valType> VECTORIZE_VEC(cot)
GLM_FUNC_QUALIFIER detail::tvec2<valType> cot
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
cot(angle.x),
cot(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> cot
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
cot(angle.x),
cot(angle.y),
cot(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> cot
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
cot(angle.x),
cot(angle.y),
cot(angle.z),
cot(angle.w));
}
// asec // asec
template <typename genType> template <typename genType>
@ -165,41 +65,7 @@ GLM_FUNC_QUALIFIER genType asec
return acos(genType(1) / x); return acos(genType(1) / x);
} }
template <typename valType> VECTORIZE_VEC(asec)
GLM_FUNC_QUALIFIER detail::tvec2<valType> asec
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
asec(x.x),
asec(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> asec
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
asec(x.x),
asec(x.y),
asec(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> asec
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
asec(x.x),
asec(x.y),
asec(x.z),
asec(x.w));
}
// acsc // acsc
template <typename genType> template <typename genType>
@ -213,41 +79,7 @@ GLM_FUNC_QUALIFIER genType acsc
return asin(genType(1) / x); return asin(genType(1) / x);
} }
template <typename valType> VECTORIZE_VEC(acsc)
GLM_FUNC_QUALIFIER detail::tvec2<valType> acsc
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acsc(x.x),
acsc(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acsc
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acsc(x.x),
acsc(x.y),
acsc(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acsc
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acsc(x.x),
acsc(x.y),
acsc(x.z),
acsc(x.w));
}
// acot // acot
template <typename genType> template <typename genType>
@ -262,41 +94,7 @@ GLM_FUNC_QUALIFIER genType acot
return pi_over_2 - atan(x); return pi_over_2 - atan(x);
} }
template <typename valType> VECTORIZE_VEC(acot)
GLM_FUNC_QUALIFIER detail::tvec2<valType> acot
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acot(x.x),
acot(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acot
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acot(x.x),
acot(x.y),
acot(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acot
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acot(x.x),
acot(x.y),
acot(x.z),
acot(x.w));
}
// sech // sech
template <typename genType> template <typename genType>
@ -310,41 +108,7 @@ GLM_FUNC_QUALIFIER genType sech
return genType(1) / glm::cosh(angle); return genType(1) / glm::cosh(angle);
} }
template <typename valType> VECTORIZE_VEC(sech)
GLM_FUNC_QUALIFIER detail::tvec2<valType> sech
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
sech(angle.x),
sech(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> sech
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
sech(angle.x),
sech(angle.y),
sech(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> sech
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
sech(angle.x),
sech(angle.y),
sech(angle.z),
sech(angle.w));
}
// csch // csch
template <typename genType> template <typename genType>
@ -358,41 +122,7 @@ GLM_FUNC_QUALIFIER genType csch
return genType(1) / glm::sinh(angle); return genType(1) / glm::sinh(angle);
} }
template <typename valType> VECTORIZE_VEC(csch)
GLM_FUNC_QUALIFIER detail::tvec2<valType> csch
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
csch(angle.x),
csch(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> csch
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
csch(angle.x),
csch(angle.y),
csch(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> csch
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
csch(angle.x),
csch(angle.y),
csch(angle.z),
csch(angle.w));
}
// coth // coth
template <typename genType> template <typename genType>
@ -406,41 +136,7 @@ GLM_FUNC_QUALIFIER genType coth
return glm::cosh(angle) / glm::sinh(angle); return glm::cosh(angle) / glm::sinh(angle);
} }
template <typename valType> VECTORIZE_VEC(coth)
GLM_FUNC_QUALIFIER detail::tvec2<valType> coth
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
coth(angle.x),
coth(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> coth
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
coth(angle.x),
coth(angle.y),
coth(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> coth
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
coth(angle.x),
coth(angle.y),
coth(angle.z),
coth(angle.w));
}
// asech // asech
template <typename genType> template <typename genType>
@ -454,41 +150,7 @@ GLM_FUNC_QUALIFIER genType asech
return acosh(genType(1) / x); return acosh(genType(1) / x);
} }
template <typename valType> VECTORIZE_VEC(asech)
GLM_FUNC_QUALIFIER detail::tvec2<valType> asech
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
asech(x.x),
asech(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> asech
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
asech(x.x),
asech(x.y),
asech(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> asech
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
asech(x.x),
asech(x.y),
asech(x.z),
asech(x.w));
}
// acsch // acsch
template <typename genType> template <typename genType>
@ -502,41 +164,7 @@ GLM_FUNC_QUALIFIER genType acsch
return asinh(genType(1) / x); return asinh(genType(1) / x);
} }
template <typename valType> VECTORIZE_VEC(acsch)
GLM_FUNC_QUALIFIER detail::tvec2<valType> acsch
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acsch(x.x),
acsch(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acsch
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acsch(x.x),
acsch(x.y),
acsch(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acsch
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acsch(x.x),
acsch(x.y),
acsch(x.z),
acsch(x.w));
}
// acoth // acoth
template <typename genType> template <typename genType>
@ -550,40 +178,5 @@ GLM_FUNC_QUALIFIER genType acoth
return atanh(genType(1) / x); return atanh(genType(1) / x);
} }
template <typename valType> VECTORIZE_VEC(acoth)
GLM_FUNC_QUALIFIER detail::tvec2<valType> acoth
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acoth(x.x),
acoth(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acoth
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acoth(x.x),
acoth(x.y),
acoth(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acoth
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acoth(x.x),
acoth(x.y),
acoth(x.z),
acoth(x.w));
}
}//namespace glm }//namespace glm

View File

@ -7,26 +7,30 @@
// File : glm/gtx/rotate_vector.inl // File : glm/gtx/rotate_vector.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> rotate( GLM_FUNC_QUALIFIER detail::tvec2<T> rotate
(
detail::tvec2<T> const & v, detail::tvec2<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec2<T> Result; detail::tvec2<T> Result;
const T Cos = cos(radians(angle)); T const Cos = cos(radians(angle));
const T Sin = sin(radians(angle)); T const Sin = sin(radians(angle));
Result.x = v.x * Cos - v.y * Sin; Result.x = v.x * Cos - v.y * Sin;
Result.y = v.x * Sin + v.y * Cos; Result.y = v.x * Sin + v.y * Cos;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotate( GLM_FUNC_QUALIFIER detail::tvec3<T> rotate
const detail::tvec3<T> & v, (
detail::tvec3<T> const & v,
T const & angle, T const & angle,
const detail::tvec3<T> & normal) detail::tvec3<T> const & normal
)
{ {
return detail::tmat3x3<T>(glm::rotate(angle, normal)) * v; return detail::tmat3x3<T>(glm::rotate(angle, normal)) * v;
} }
@ -43,18 +47,22 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateGTX(
} }
*/ */
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotate( GLM_FUNC_QUALIFIER detail::tvec4<T> rotate
(
detail::tvec4<T> const & v, detail::tvec4<T> const & v,
T const & angle, T const & angle,
detail::tvec3<T> const & normal) detail::tvec3<T> const & normal
)
{ {
return rotate(angle, normal) * v; return rotate(angle, normal) * v;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX( GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX
(
detail::tvec3<T> const & v, detail::tvec3<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec3<T> Result = v; detail::tvec3<T> Result = v;
const T Cos = cos(radians(angle)); const T Cos = cos(radians(angle));
@ -65,9 +73,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY( GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY
(
detail::tvec3<T> const & v, detail::tvec3<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec3<T> Result = v; detail::tvec3<T> Result = v;
const T Cos = cos(radians(angle)); const T Cos = cos(radians(angle));
@ -78,9 +88,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ( GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ
(
detail::tvec3<T> const & v, detail::tvec3<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec3<T> Result = v; detail::tvec3<T> Result = v;
const T Cos = cos(radians(angle)); const T Cos = cos(radians(angle));
@ -91,9 +103,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX( GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX
(
detail::tvec4<T> const & v, detail::tvec4<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec4<T> Result = v; detail::tvec4<T> Result = v;
const T Cos = cos(radians(angle)); const T Cos = cos(radians(angle));
@ -104,9 +118,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY( GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY
(
detail::tvec4<T> const & v, detail::tvec4<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec4<T> Result = v; detail::tvec4<T> Result = v;
const T Cos = cos(radians(angle)); const T Cos = cos(radians(angle));
@ -117,9 +133,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ( GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ
(
detail::tvec4<T> const & v, detail::tvec4<T> const & v,
T const & angle) T const & angle
)
{ {
detail::tvec4<T> Result = v; detail::tvec4<T> Result = v;
const T Cos = cos(radians(angle)); const T Cos = cos(radians(angle));
@ -130,9 +148,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ(
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation( GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation
(
detail::tvec3<T> const & Normal, detail::tvec3<T> const & Normal,
detail::tvec3<T> const & Up) detail::tvec3<T> const & Up
)
{ {
if(all(equal(Normal, Up))) if(all(equal(Normal, Up)))
return detail::tmat4x4<T>(T(1)); return detail::tmat4x4<T>(T(1));
@ -141,5 +161,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation(
T Angle = degrees(acos(dot(Normal, Up))); T Angle = degrees(acos(dot(Normal, Up)));
return rotate(Angle, RotationAxis); return rotate(Angle, RotationAxis);
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/transform2.inl // File : glm/gtx/transform2.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearX2D( GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearX2D(
const detail::tmat3x3<T>& m, const detail::tmat3x3<T>& m,
@ -150,6 +150,5 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scaleBias(
{ {
return m * scaleBias(scale, bias); return m * scaleBias(scale, bias);
} }
}//namespace glm }//namespace glm

View File

@ -181,8 +181,8 @@ namespace detail
# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward)) # define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward))
#endif #endif
namespace glm{ namespace glm
{
GLM_FUNC_QUALIFIER float next_float(float const & x) GLM_FUNC_QUALIFIER float next_float(float const & x)
{ {
return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max()); return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max());
@ -296,103 +296,4 @@ GLM_FUNC_QUALIFIER vecType<uint> float_distance(vecType<T> const & x, vecType<T>
Result[i] = float_distance(x[i], y[i]); Result[i] = float_distance(x[i], y[i]);
return Result; return Result;
} }
/*
inline std::size_t ulp
(
detail::thalf const & a,
detail::thalf const & b
)
{
std::size_t Count = 0;
float TempA(a);
float TempB(b);
//while((TempA = _nextafterf(TempA, TempB)) != TempB)
++Count;
return Count;
}
inline std::size_t ulp
(
float const & a,
float const & b
)
{
std::size_t Count = 0;
float Temp = a;
//while((Temp = _nextafterf(Temp, b)) != b)
{
std::cout << Temp << " " << b << std::endl;
++Count;
}
return Count;
}
inline std::size_t ulp
(
double const & a,
double const & b
)
{
std::size_t Count = 0;
double Temp = a;
//while((Temp = _nextafter(Temp, b)) != b)
{
std::cout << Temp << " " << b << std::endl;
++Count;
}
return Count;
}
template <typename T>
inline std::size_t ulp
(
detail::tvec2<T> const & a,
detail::tvec2<T> const & b
)
{
std::size_t ulps[] =
{
ulp(a[0], b[0]),
ulp(a[1], b[1])
};
return glm::max(ulps[0], ulps[1]);
}
template <typename T>
inline std::size_t ulp
(
detail::tvec3<T> const & a,
detail::tvec3<T> const & b
)
{
std::size_t ulps[] =
{
ulp(a[0], b[0]),
ulp(a[1], b[1]),
ulp(a[2], b[2])
};
return glm::max(glm::max(ulps[0], ulps[1]), ulps[2]);
}
template <typename T>
inline std::size_t ulp
(
detail::tvec4<T> const & a,
detail::tvec4<T> const & b
)
{
std::size_t ulps[] =
{
ulp(a[0], b[0]),
ulp(a[1], b[1]),
ulp(a[2], b[2]),
ulp(a[3], b[3])
};
return glm::max(glm::max(ulps[0], ulps[1]), glm::max(ulps[2], ulps[3]));
}
*/
}//namespace glm }//namespace glm

View File

@ -7,7 +7,7 @@
// File : glm/gtx/unsigned_int.inl // File : glm/gtx/unsigned_int.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/vector_access.inl // File : glm/gtx/vector_access.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER void set GLM_FUNC_QUALIFIER void set
( (
@ -50,5 +50,4 @@ GLM_FUNC_QUALIFIER void set
v.z = z; v.z = z;
v.w = w; v.w = w;
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/vector_angle.inl // File : glm/gtx/vector_angle.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type angle GLM_FUNC_QUALIFIER typename genType::value_type angle
( (
@ -50,5 +50,4 @@ GLM_FUNC_QUALIFIER valType orientedAngle
else else
return Angle; return Angle;
} }
}//namespace glm }//namespace glm

View File

@ -12,8 +12,8 @@
#include <cassert> #include <cassert>
namespace glm{ namespace glm
{
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER bool areCollinear GLM_FUNC_QUALIFIER bool areCollinear
( (
@ -166,5 +166,4 @@ GLM_FUNC_QUALIFIER bool areSimilar
similar = (abs(v0[i] - v1[i]) <= epsilon); similar = (abs(v0[i] - v1[i]) <= epsilon);
return similar; return similar;
} }
}//namespace glm }//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/verbose_operator.inl // File : glm/gtx/verbose_operator.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b) GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b)
{ {
@ -121,5 +121,4 @@ GLM_FUNC_QUALIFIER genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV
{ {
return a * b + c; return a * b + c;
} }
}//namespace glm }//namespace glm

View File

@ -10,8 +10,8 @@
// - GLM core // - GLM core
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{ namespace glm
{
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType clamp GLM_FUNC_QUALIFIER genType clamp
( (
@ -162,5 +162,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> mirrorRepeat
Result[i] = mirrorRepeat(Texcoord[i]); Result[i] = mirrorRepeat(Texcoord[i]);
return Result; return Result;
} }
}//namespace glm }//namespace glm