Matching headers and implementations

This commit is contained in:
Christophe Riccio 2014-11-29 22:13:30 +01:00
parent 25a57418bd
commit 67964bfd0a
5 changed files with 60 additions and 144 deletions

View File

@ -37,10 +37,7 @@
namespace glm
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> affineInverse
(
tmat3x3<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> affineInverse(tmat3x3<T, P> const & m)
{
tmat3x3<T, P> Result(m);
Result[2] = tvec3<T, P>(0, 0, 1);
@ -51,10 +48,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> affineInverse
(
tmat4x4<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> affineInverse(tmat4x4<T, P> const & m)
{
tmat4x4<T, P> Result(m);
Result[3] = tvec4<T, P>(0, 0, 0, 1);
@ -65,10 +59,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> inverseTranspose
(
tmat2x2<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P> inverseTranspose(tmat2x2<T, P> const & m)
{
T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
@ -82,10 +73,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> inverseTranspose
(
tmat3x3<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> inverseTranspose(tmat3x3<T, P> const & m)
{
T Determinant =
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
@ -108,10 +96,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> inverseTranspose
(
tmat4x4<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> inverseTranspose(tmat4x4<T, P> const & m)
{
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];

View File

@ -44,7 +44,9 @@
#pragma once
// Dependency:
#include "../glm.hpp"
#include "../common.hpp"
#include "../exponential.hpp"
#include "../geometric.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_fast_square_root extension included")
@ -55,38 +57,57 @@ namespace glm
/// @addtogroup gtx_fast_square_root
/// @{
//! Faster than the common sqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common sqrt function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename genType>
GLM_FUNC_DECL genType fastSqrt(genType x);
//! Faster than the common inversesqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common sqrt function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastSqrt(vecType<T, P> const & x);
/// Faster than the common inversesqrt function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename genType>
GLM_FUNC_DECL genType fastInverseSqrt(genType x);
//! Faster than the common inversesqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common inversesqrt function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastInverseSqrt(vecType<T, P> const & x);
//! Faster than the common length function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common length function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename genType>
GLM_FUNC_DECL typename genType::value_type fastLength(genType const & x);
GLM_FUNC_DECL genType fastLength(genType x);
//! Faster than the common distance function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common length function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL T fastLength(vecType<T, P> const & x);
/// Faster than the common distance function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename genType>
GLM_FUNC_DECL genType fastDistance(genType x, genType y);
//! Faster than the common distance function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common distance function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL T fastDistance(vecType<T, P> const & x, vecType<T, P> const & y);
//! Faster than the common normalize function but less accurate.
//! From GLM_GTX_fast_square_root extension.
/// Faster than the common normalize function but less accurate.
///
/// @see gtx_fast_square_root extension.
template <typename genType>
GLM_FUNC_DECL genType fastNormalize(genType const & x);

View File

@ -42,7 +42,6 @@
#pragma once
// Dependency:
#include "../glm.hpp"
#include "../gtc/constants.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))

View File

@ -43,7 +43,6 @@
#pragma once
// Dependency:
#include "../glm.hpp"
#include "../gtx/fast_square_root.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
@ -55,21 +54,19 @@ namespace glm
/// @addtogroup gtx_normalize_dot
/// @{
//! Normalize parameters and returns the dot product of x and y.
//! It's faster that dot(normalize(x), normalize(y)).
//! From GLM_GTX_normalize_dot extension.
template <typename genType>
GLM_FUNC_DECL typename genType::value_type normalizeDot(
genType const & x,
genType const & y);
/// Normalize parameters and returns the dot product of x and y.
/// It's faster that dot(normalize(x), normalize(y)).
///
/// @see gtx_normalize_dot extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL T normalizeDot(vecType<T, P> const & x, vecType<T, P> const & y);
//! Normalize parameters and returns the dot product of x and y.
//! Faster that dot(fastNormalize(x), fastNormalize(y)).
//! From GLM_GTX_normalize_dot extension.
template <typename genType>
GLM_FUNC_DECL typename genType::value_type fastNormalizeDot(
genType const & x,
genType const & y);
/// Normalize parameters and returns the dot product of x and y.
/// Faster that dot(fastNormalize(x), fastNormalize(y)).
///
/// @see gtx_normalize_dot extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL T fastNormalizeDot(vecType<T, P> const & x, vecType<T, P> const & y);
/// @}
}//namespace glm

View File

@ -32,101 +32,15 @@
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType normalizeDot
(
genType const & x,
genType const & y
)
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T normalizeDot(vecType<T, P> const & x, vecType<T, P> const & y)
{
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T normalizeDot
(
tvec2<T, P> const & x,
tvec2<T, P> const & y
)
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType<T, P> const & x, vecType<T, P> const & y)
{
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T normalizeDot
(
tvec3<T, P> const & x,
tvec3<T, P> const & y
)
{
return
glm::dot(x, y) *
glm::inversesqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T normalizeDot
(
tvec4<T, P> const & x,
tvec4<T, P> const & y
)
{
return
glm::dot(x, y) *
glm::inversesqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename genType>
GLM_FUNC_QUALIFIER genType fastNormalizeDot
(
genType const & x,
genType const & y
)
{
return
glm::dot(x, y) *
fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T fastNormalizeDot
(
tvec2<T, P> const & x,
tvec2<T, P> const & y
)
{
return
glm::dot(x, y) *
fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T fastNormalizeDot
(
tvec3<T, P> const & x,
tvec3<T, P> const & y
)
{
return
glm::dot(x, y) *
fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T fastNormalizeDot
(
tvec4<T, P> const & x,
tvec4<T, P> const & y
)
{
return
glm::dot(x, y) *
fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y));
}
}//namespace glm