mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 11:24:35 +00:00
Use length_t instead of int for vec and mat lengths #584
This commit is contained in:
parent
b92fdf5a59
commit
c2fe3fccf6
@ -42,7 +42,7 @@ namespace detail
|
||||
}
|
||||
/*
|
||||
template<typename T, precision P, template<typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> permute(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> permute(vecType<L, T, P> const & x)
|
||||
{
|
||||
return mod289(((x * T(34)) + T(1)) * x);
|
||||
}
|
||||
@ -72,7 +72,7 @@ namespace detail
|
||||
}
|
||||
/*
|
||||
template<typename T, precision P, template<typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorInvSqrt(vecType<D, T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorInvSqrt(vecType<L, T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
@ -97,7 +97,7 @@ namespace detail
|
||||
}
|
||||
/*
|
||||
template<typename T, precision P, template<typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fade(vecType<D, T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fade(vecType<L, T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename R, typename T, precision P>
|
||||
template<length_t L, typename R, typename T, precision P>
|
||||
struct functor1{};
|
||||
|
||||
template<typename R, typename T, precision P>
|
||||
@ -50,7 +50,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
struct functor2{};
|
||||
|
||||
template<typename T, precision P>
|
||||
@ -89,7 +89,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
struct functor2_vec_sca{};
|
||||
|
||||
template<typename T, precision P>
|
||||
|
@ -167,7 +167,7 @@ glm::vec3 lighting
|
||||
|
||||
/*
|
||||
template<typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||
T normalizeDotA(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
T normalizeDotA(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
@ -175,7 +175,7 @@ T normalizeDotA(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
|
||||
|
||||
template<GLM_TEMPLATE_GENTYPE vecType>
|
||||
T normalizeDotB(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
T normalizeDotB(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType abs(genType x);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> abs(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> abs(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
||||
///
|
||||
@ -38,8 +38,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> sign(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> sign(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer that is less then or equal to x.
|
||||
///
|
||||
@ -47,8 +47,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> floor(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> floor(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x
|
||||
/// whose absolute value is not larger than the absolute value of x.
|
||||
@ -57,8 +57,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> trunc(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> trunc(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@ -70,8 +70,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> round(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> round(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// A fractional part of 0.5 will round toward the nearest even
|
||||
@ -82,8 +82,8 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> roundEven(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> roundEven(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer
|
||||
/// that is greater than or equal to x.
|
||||
@ -92,8 +92,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> ceil(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> ceil(vecType<L, T, P> const & x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
@ -104,8 +104,8 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType fract(genType x);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fract(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fract(vecType<L, T, P> const & x);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
@ -117,11 +117,11 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType mod(genType x, genType y);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, T y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mod(vecType<L, T, P> const & x, T y);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mod(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns the fractional part of x and sets i to the integer
|
||||
/// part (as a whole number floating point value). Both the
|
||||
@ -144,11 +144,11 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType min(genType x, genType y);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> min(vecType<D, T, P> const & x, T y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> min(vecType<L, T, P> const & x, T y);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> min(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> min(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
@ -159,11 +159,11 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType max(genType x, genType y);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> max(vecType<D, T, P> const & x, T y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> max(vecType<L, T, P> const & x, T y);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> max(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> max(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
@ -175,11 +175,11 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> clamp(vecType<D, T, P> const & x, T minVal, T maxVal);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> clamp(vecType<L, T, P> const & x, T minVal, T maxVal);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> clamp(vecType<D, T, P> const & x, vecType<D, T, P> const & minVal, vecType<D, T, P> const & maxVal);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> clamp(vecType<L, T, P> const & x, vecType<L, T, P> const & minVal, vecType<L, T, P> const & maxVal);
|
||||
|
||||
/// If genTypeU is a floating scalar or vector:
|
||||
/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
@ -223,11 +223,11 @@ namespace glm
|
||||
/// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.
|
||||
/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
|
||||
/// @endcode
|
||||
template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mix(vecType<D, T, P> const & x, vecType<D, T, P> const & y, vecType<D, U, P> const & a);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mix(vecType<L, T, P> const & x, vecType<L, T, P> const & y, vecType<L, U, P> const & a);
|
||||
|
||||
template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mix(vecType<D, T, P> const & x, vecType<D, T, P> const & y, U a);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mix(vecType<L, T, P> const & x, vecType<L, T, P> const & y, U a);
|
||||
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
|
||||
@ -243,15 +243,15 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<D, T, P> step(T edge, vecType<D, T, P> const & x);
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<L, T, P> step(T edge, vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<D, T, P> step(vecType<D, T, P> const & edge, vecType<D, T, P> const & x);
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<L, T, P> step(vecType<L, T, P> const & edge, vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||
/// performs smooth Hermite interpolation between 0 and 1
|
||||
@ -270,11 +270,11 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> smoothstep(T edge0, T edge1, vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> smoothstep(T edge0, T edge1, vecType<L, T, P> const & x);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> smoothstep(vecType<D, T, P> const & edge0, vecType<D, T, P> const & edge1, vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> smoothstep(vecType<L, T, P> const & edge0, vecType<L, T, P> const & edge1, vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
/// representation in the underlying implementation's set of
|
||||
@ -288,8 +288,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isnan(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isnan(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
/// infinity representation in the underlying implementation's
|
||||
@ -301,8 +301,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isinf(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isinf(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floating-point
|
||||
@ -318,8 +318,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_DECL vecType<D, int, P> floatBitsToInt(vecType<D, float, P> const & v);
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_DECL vecType<L, int, P> floatBitsToInt(vecType<L, float, P> const & v);
|
||||
|
||||
/// Returns a unsigned integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
@ -335,8 +335,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_DECL vecType<D, uint, P> floatBitsToUint(vecType<D, float, P> const & v);
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_DECL vecType<L, uint, P> floatBitsToUint(vecType<L, float, P> const & v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a signed
|
||||
/// integer encoding of a floating-point value.
|
||||
@ -356,8 +356,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_DECL vecType<D, float, P> intBitsToFloat(vecType<D, int, P> const & v);
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_DECL vecType<L, float, P> intBitsToFloat(vecType<L, int, P> const & v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a
|
||||
/// unsigned integer encoding of a floating-point value.
|
||||
@ -377,8 +377,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_DECL vecType<D, float, P> uintBitsToFloat(vecType<D, uint, P> const & v);
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_DECL vecType<L, float, P> uintBitsToFloat(vecType<L, uint, P> const & v);
|
||||
|
||||
/// Computes and returns a * b + c.
|
||||
///
|
||||
|
@ -107,53 +107,53 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_abs_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(abs, x);
|
||||
return detail::functor1<L, T, T, P>::call(abs, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y, vecType<D, U, P> const & a)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & y, vecType<L, U, P> const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vecType<D, T, P>(vecType<D, U, P>(x) + a * vecType<D, U, P>(y - x));
|
||||
return vecType<L, T, P>(vecType<L, U, P>(x) + a * vecType<L, U, P>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_vector<D, T, bool, P, vecType, Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_vector<L, T, bool, P, vecType, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y, vecType<D, bool, P> const & a)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & y, vecType<L, bool, P> const & a)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = a[i] ? y[i] : x[i];
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_scalar
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y, U const & a)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & y, U const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vecType<D, T, P>(vecType<D, U, P>(x) + a * vecType<D, U, P>(y - x));
|
||||
return vecType<L, T, P>(vecType<L, U, P>(x) + a * vecType<L, U, P>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_scalar<D, T, bool, P, vecType, Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_scalar<L, T, bool, P, vecType, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y, bool const & a)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & y, bool const & a)
|
||||
{
|
||||
return a ? y : x;
|
||||
}
|
||||
@ -179,127 +179,127 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isFloat, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool isFloat, bool Aligned>
|
||||
struct compute_sign
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return vecType<D, T, P>(glm::lessThan(vecType<D, T, P>(0), x)) - vecType<D, T, P>(glm::lessThan(x, vecType<D, T, P>(0)));
|
||||
return vecType<L, T, P>(glm::lessThan(vecType<L, T, P>(0), x)) - vecType<L, T, P>(glm::lessThan(x, vecType<L, T, P>(0)));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_ARCH == GLM_ARCH_X86
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_sign<T, P, vecType, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
|
||||
vecType<D, T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
|
||||
vecType<L, T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
|
||||
|
||||
return (x >> Shift) | y;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_floor
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(std::floor, x);
|
||||
return detail::functor1<L, T, T, P>::call(std::floor, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_ceil
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(std::ceil, x);
|
||||
return detail::functor1<L, T, T, P>::call(std::ceil, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_fract
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return x - floor(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_trunc
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(trunc, x);
|
||||
return detail::functor1<L, T, T, P>::call(trunc, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_round
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(round, x);
|
||||
return detail::functor1<L, T, T, P>::call(round, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mod
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
return a - b * floor(a / b);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_min_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(min, x, y);
|
||||
return detail::functor2<L, T, P>::call(min, x, y);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_max_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(max, x, y);
|
||||
return detail::functor2<L, T, P>::call(max, x, y);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_clamp_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & minVal, vecType<D, T, P> const & maxVal)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, vecType<L, T, P> const & minVal, vecType<L, T, P> const & maxVal)
|
||||
{
|
||||
return min(max(x, minVal), maxVal);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_step_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & edge, vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & edge, vecType<L, T, P> const & x)
|
||||
{
|
||||
return mix(vecType<D, T, P>(1), vecType<D, T, P>(0), glm::lessThan(x, edge));
|
||||
return mix(vecType<L, T, P>(1), vecType<L, T, P>(0), glm::lessThan(x, edge));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_smoothstep_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & edge0, vecType<D, T, P> const & edge1, vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & edge0, vecType<L, T, P> const & edge1, vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs");
|
||||
vecType<D, T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||
vecType<L, T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
||||
}
|
||||
};
|
||||
@ -311,10 +311,10 @@ namespace detail
|
||||
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> abs(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> abs(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::compute_abs_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_abs_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// sign
|
||||
@ -329,37 +329,37 @@ namespace detail
|
||||
return detail::compute_sign<1, genFIType, defaultp, vec, std::numeric_limits<genFIType>::is_iec559, highp>::call(vec<1, genFIType>(x)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sign(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sign(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<D, T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_sign<L, T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// floor
|
||||
using ::std::floor;
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> floor(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> floor(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'floor' only accept floating-point inputs.");
|
||||
return detail::compute_floor<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_floor<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> trunc(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> trunc(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
return detail::compute_trunc<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_trunc<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> round(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> round(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'round' only accept floating-point inputs");
|
||||
return detail::compute_round<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_round<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -405,20 +405,20 @@ namespace detail
|
||||
//}
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> roundEven(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> roundEven(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(roundEven, x);
|
||||
return detail::functor1<L, T, T, P>::call(roundEven, x);
|
||||
}
|
||||
|
||||
// ceil
|
||||
using ::std::ceil;
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> ceil(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> ceil(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ceil' only accept floating-point inputs");
|
||||
return detail::compute_ceil<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_ceil<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// fract
|
||||
@ -428,11 +428,11 @@ namespace detail
|
||||
return fract(vec<1, genType>(x)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fract(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fract(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fract' only accept floating-point inputs");
|
||||
return detail::compute_fract<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_fract<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// mod
|
||||
@ -448,16 +448,16 @@ namespace detail
|
||||
# endif
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> mod(vecType<D, T, P> const & x, T y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> mod(vecType<L, T, P> const & x, T y)
|
||||
{
|
||||
return detail::compute_mod<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<D, T, P>(y));
|
||||
return detail::compute_mod<L, T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<L, T, P>(y));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> mod(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return detail::compute_mod<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, y);
|
||||
return detail::compute_mod<L, T, P, vecType, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
// modf
|
||||
@ -511,31 +511,31 @@ namespace detail
|
||||
//CHAR_BIT - 1)));
|
||||
|
||||
// min
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> min(vecType<D, T, P> const & a, T b)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> min(vecType<L, T, P> const & a, T b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'min' only accept floating-point inputs for the interpolator a");
|
||||
return detail::compute_min_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<D, T, P>(b));
|
||||
return detail::compute_min_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<L, T, P>(b));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> min(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> min(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
|
||||
{
|
||||
return detail::compute_min_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||
return detail::compute_min_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||
}
|
||||
|
||||
// max
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> max(vecType<D, T, P> const & a, T b)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> max(vecType<L, T, P> const & a, T b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'max' only accept floating-point inputs for the interpolator a");
|
||||
return detail::compute_max_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<D, T, P>(b));
|
||||
return detail::compute_max_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<L, T, P>(b));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> max(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> max(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
|
||||
{
|
||||
return detail::compute_max_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||
return detail::compute_max_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||
}
|
||||
|
||||
// clamp
|
||||
@ -546,18 +546,18 @@ namespace detail
|
||||
return min(max(x, minVal), maxVal);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> clamp(vecType<D, T, P> const & x, T minVal, T maxVal)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> clamp(vecType<L, T, P> const & x, T minVal, T maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||
return detail::compute_clamp_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<D, T, P>(minVal), vecType<D, T, P>(maxVal));
|
||||
return detail::compute_clamp_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<L, T, P>(minVal), vecType<L, T, P>(maxVal));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> clamp(vecType<D, T, P> const & x, vecType<D, T, P> const & minVal, vecType<D, T, P> const & maxVal)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> clamp(vecType<L, T, P> const & x, vecType<L, T, P> const & minVal, vecType<L, T, P> const & maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||
return detail::compute_clamp_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, minVal, maxVal);
|
||||
return detail::compute_clamp_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(x, minVal, maxVal);
|
||||
}
|
||||
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
@ -566,16 +566,16 @@ namespace detail
|
||||
return detail::compute_mix<genTypeT, genTypeU>::call(x, y, a);
|
||||
}
|
||||
|
||||
template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> mix(vecType<D, T, P> const & x, vecType<D, T, P> const & y, U a)
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> mix(vecType<L, T, P> const & x, vecType<L, T, P> const & y, U a)
|
||||
{
|
||||
return detail::compute_mix_scalar<D, T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||
return detail::compute_mix_scalar<L, T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||
}
|
||||
|
||||
template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> mix(vecType<D, T, P> const & x, vecType<D, T, P> const & y, vecType<D, U, P> const & a)
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> mix(vecType<L, T, P> const & x, vecType<L, T, P> const & y, vecType<L, U, P> const & a)
|
||||
{
|
||||
return detail::compute_mix_vector<D, T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||
return detail::compute_mix_vector<L, T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||
}
|
||||
|
||||
// step
|
||||
@ -585,16 +585,16 @@ namespace detail
|
||||
return mix(static_cast<genType>(1), static_cast<genType>(0), glm::lessThan(x, edge));
|
||||
}
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> step(T edge, vecType<D, T, P> const & x)
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> step(T edge, vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::compute_step_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(vecType<D, T, P>(edge), x);
|
||||
return detail::compute_step_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(vecType<L, T, P>(edge), x);
|
||||
}
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> step(vecType<D, T, P> const & edge, vecType<D, T, P> const & x)
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> step(vecType<L, T, P> const & edge, vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::compute_step_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(edge, x);
|
||||
return detail::compute_step_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(edge, x);
|
||||
}
|
||||
|
||||
// smoothstep
|
||||
@ -607,16 +607,16 @@ namespace detail
|
||||
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> smoothstep(T edge0, T edge1, vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> smoothstep(T edge0, T edge1, vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::compute_smoothstep_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(vecType<D, T, P>(edge0), vecType<D, T, P>(edge1), x);
|
||||
return detail::compute_smoothstep_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(vecType<L, T, P>(edge0), vecType<L, T, P>(edge1), x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> smoothstep(vecType<D, T, P> const & edge0, vecType<D, T, P> const & edge1, vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> smoothstep(vecType<L, T, P> const & edge0, vecType<L, T, P> const & edge1, vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::compute_smoothstep_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(edge0, edge1, x);
|
||||
return detail::compute_smoothstep_vector<L, T, P, vecType, detail::is_aligned<P>::value>::call(edge0, edge1, x);
|
||||
}
|
||||
|
||||
# if GLM_HAS_CXX11_STL
|
||||
@ -647,12 +647,12 @@ namespace detail
|
||||
}
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isnan(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isnan(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
|
||||
return detail::functor1<D, bool, T, P>::call(isnan, x);
|
||||
return detail::functor1<L, bool, T, P>::call(isnan, x);
|
||||
}
|
||||
|
||||
# if GLM_HAS_CXX11_STL
|
||||
@ -686,12 +686,12 @@ namespace detail
|
||||
}
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isinf(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isinf(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
|
||||
return detail::functor1<D, bool, T, P>::call(isinf, x);
|
||||
return detail::functor1<L, bool, T, P>::call(isinf, x);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v)
|
||||
@ -699,10 +699,10 @@ namespace detail
|
||||
return reinterpret_cast<int&>(const_cast<float&>(v));
|
||||
}
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> floatBitsToInt(vecType<D, float, P> const & v)
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> floatBitsToInt(vecType<L, float, P> const & v)
|
||||
{
|
||||
return reinterpret_cast<vecType<D, int, P>&>(const_cast<vecType<D, float, P>&>(v));
|
||||
return reinterpret_cast<vecType<L, int, P>&>(const_cast<vecType<L, float, P>&>(v));
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
|
||||
@ -710,10 +710,10 @@ namespace detail
|
||||
return reinterpret_cast<uint&>(const_cast<float&>(v));
|
||||
}
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> floatBitsToUint(vecType<D, float, P> const & v)
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> floatBitsToUint(vecType<L, float, P> const & v)
|
||||
{
|
||||
return reinterpret_cast<vecType<D, uint, P>&>(const_cast<vecType<D, float, P>&>(v));
|
||||
return reinterpret_cast<vecType<L, uint, P>&>(const_cast<vecType<L, float, P>&>(v));
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v)
|
||||
@ -721,10 +721,10 @@ namespace detail
|
||||
return reinterpret_cast<float&>(const_cast<int&>(v));
|
||||
}
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> intBitsToFloat(vecType<D, int, P> const & v)
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> intBitsToFloat(vecType<L, int, P> const & v)
|
||||
{
|
||||
return reinterpret_cast<vecType<D, float, P>&>(const_cast<vecType<D, int, P>&>(v));
|
||||
return reinterpret_cast<vecType<L, float, P>&>(const_cast<vecType<L, int, P>&>(v));
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v)
|
||||
@ -732,10 +732,10 @@ namespace detail
|
||||
return reinterpret_cast<float&>(const_cast<uint&>(v));
|
||||
}
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> uintBitsToFloat(vecType<D, uint, P> const & v)
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> uintBitsToFloat(vecType<L, uint, P> const & v)
|
||||
{
|
||||
return reinterpret_cast<vecType<D, float, P>&>(const_cast<vecType<D, uint, P>&>(v));
|
||||
return reinterpret_cast<vecType<L, float, P>&>(const_cast<vecType<L, uint, P>&>(v));
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
|
@ -29,8 +29,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> pow(vecType<D, T, P> const & base, vecType<D, T, P> const & exponent);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> pow(vecType<L, T, P> const & base, vecType<L, T, P> const & exponent);
|
||||
|
||||
/// Returns the natural exponentiation of x, i.e., e^x.
|
||||
///
|
||||
@ -39,8 +39,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> exp(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> exp(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the natural logarithm of v, i.e.,
|
||||
/// returns the value y which satisfies the equation x = e^y.
|
||||
@ -51,8 +51,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> log(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> log(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns 2 raised to the v power.
|
||||
///
|
||||
@ -61,8 +61,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> exp2(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> exp2(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the base 2 log of x, i.e., returns the value y,
|
||||
/// which satisfies the equation x = 2 ^ y.
|
||||
@ -72,8 +72,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> log2(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> log2(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the positive square root of v.
|
||||
///
|
||||
@ -84,8 +84,8 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
//template<typename genType>
|
||||
//GLM_FUNC_DECL genType sqrt(genType const & x);
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> sqrt(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> sqrt(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the reciprocal of the positive square root of v.
|
||||
///
|
||||
@ -94,8 +94,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> inversesqrt(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> inversesqrt(vecType<L, T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -20,43 +20,43 @@ namespace detail
|
||||
}
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, class, precision> class vecType, bool isFloat, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<int, class, precision> class vecType, bool isFloat, bool Aligned>
|
||||
struct compute_log2
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<D, T, P> call(vec<D, T, P> const & vec)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(log2, vec);
|
||||
return detail::functor1<L, T, T, P>::call(log2, v);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, bool Aligned>
|
||||
template<length_t L, typename T, precision P, bool Aligned>
|
||||
struct compute_sqrt
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<D, T, P> call(vec<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(std::sqrt, x);
|
||||
return detail::functor1<L, T, T, P>::call(std::sqrt, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, bool Aligned>
|
||||
template<length_t L, typename T, precision P, bool Aligned>
|
||||
struct compute_inversesqrt
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<D, T, P> call(vec<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const & x)
|
||||
{
|
||||
return static_cast<T>(1) / sqrt(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, bool Aligned>
|
||||
struct compute_inversesqrt<D, float, lowp, Aligned>
|
||||
template<length_t L, bool Aligned>
|
||||
struct compute_inversesqrt<L, float, lowp, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<D, float, lowp> call(vec<D, float, lowp> const & x)
|
||||
GLM_FUNC_QUALIFIER static vec<L, float, lowp> call(vec<L, float, lowp> const & x)
|
||||
{
|
||||
vec<D, float, lowp> tmp(x);
|
||||
vec<D, float, lowp> xhalf(tmp * 0.5f);
|
||||
vec<D, uint, lowp>* p = reinterpret_cast<vec<D, uint, lowp>*>(const_cast<vec<D, float, lowp>*>(&x));
|
||||
vec<D, uint, lowp> i = vec<D, uint, lowp>(0x5f375a86) - (*p >> vec<D, uint, lowp>(1));
|
||||
vec<D, float, lowp>* ptmp = reinterpret_cast<vec<D, float, lowp>*>(&i);
|
||||
vec<L, float, lowp> tmp(x);
|
||||
vec<L, float, lowp> xhalf(tmp * 0.5f);
|
||||
vec<L, uint, lowp>* p = reinterpret_cast<vec<L, uint, lowp>*>(const_cast<vec<L, float, lowp>*>(&x));
|
||||
vec<L, uint, lowp> i = vec<L, uint, lowp>(0x5f375a86) - (*p >> vec<L, uint, lowp>(1));
|
||||
vec<L, float, lowp>* ptmp = reinterpret_cast<vec<L, float, lowp>*>(&i);
|
||||
tmp = *ptmp;
|
||||
tmp = tmp * (1.5f - xhalf * tmp * tmp);
|
||||
return tmp;
|
||||
@ -66,26 +66,26 @@ namespace detail
|
||||
|
||||
// pow
|
||||
using std::pow;
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> pow(vecType<D, T, P> const & base, vecType<D, T, P> const & exponent)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> pow(vecType<L, T, P> const & base, vecType<L, T, P> const& exponent)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(pow, base, exponent);
|
||||
return detail::functor2<L, T, P>::call(pow, base, exponent);
|
||||
}
|
||||
|
||||
// exp
|
||||
using std::exp;
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> exp(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> exp(vecType<L, T, P> const& x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(exp, x);
|
||||
return detail::functor1<L, T, T, P>::call(exp, x);
|
||||
}
|
||||
|
||||
// log
|
||||
using std::log;
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> log(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> log(vecType<L, T, P> const& x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(log, x);
|
||||
return detail::functor1<L, T, T, P>::call(log, x);
|
||||
}
|
||||
|
||||
//exp2, ln2 = 0.69314718055994530941723212145818f
|
||||
@ -97,10 +97,10 @@ namespace detail
|
||||
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> exp2(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> exp2(vecType<L, T, P> const& x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(exp2, x);
|
||||
return detail::functor1<L, T, T, P>::call(exp2, x);
|
||||
}
|
||||
|
||||
// log2, ln2 = 0.69314718055994530941723212145818f
|
||||
@ -110,19 +110,19 @@ namespace detail
|
||||
return log2(vec<1, genType>(x)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> log2(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> log2(vecType<L, T, P> const& x)
|
||||
{
|
||||
return detail::compute_log2<D, T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_log2<L, T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// sqrt
|
||||
using std::sqrt;
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sqrt(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sqrt(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
||||
return detail::compute_sqrt<D, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_sqrt<L, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// inversesqrt
|
||||
@ -132,11 +132,11 @@ namespace detail
|
||||
return static_cast<genType>(1) / sqrt(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> inversesqrt(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> inversesqrt(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
||||
return detail::compute_inversesqrt<D, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_inversesqrt<L, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -23,9 +23,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T length(
|
||||
vecType<D, T, P> const & x);
|
||||
vecType<L, T, P> const& x);
|
||||
|
||||
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
||||
///
|
||||
@ -33,10 +33,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T distance(
|
||||
vecType<D, T, P> const & p0,
|
||||
vecType<D, T, P> const & p1);
|
||||
vecType<L, T, P> const& p0,
|
||||
vecType<L, T, P> const& p1);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
@ -44,10 +44,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL T dot(
|
||||
vec<D, T, P> const & x,
|
||||
vec<D, T, P> const & y);
|
||||
vec<L, T, P> const & x,
|
||||
vec<L, T, P> const & y);
|
||||
|
||||
/// Returns the cross product of x and y.
|
||||
///
|
||||
@ -65,9 +65,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> normalize(
|
||||
vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> normalize(
|
||||
vecType<L, T, P> const& x);
|
||||
|
||||
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
||||
///
|
||||
@ -75,11 +75,11 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> faceforward(
|
||||
vecType<D, T, P> const & N,
|
||||
vecType<D, T, P> const & I,
|
||||
vecType<D, T, P> const & Nref);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> faceforward(
|
||||
vecType<L, T, P> const& N,
|
||||
vecType<L, T, P> const& I,
|
||||
vecType<L, T, P> const& Nref);
|
||||
|
||||
/// For the incident vector I and surface orientation N,
|
||||
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
||||
@ -101,10 +101,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> refract(
|
||||
vecType<D, T, P> const & I,
|
||||
vecType<D, T, P> const & N,
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> refract(
|
||||
vecType<L, T, P> const& I,
|
||||
vecType<L, T, P> const& N,
|
||||
T eta);
|
||||
|
||||
/// @}
|
||||
|
@ -10,19 +10,19 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P, bool Aligned>
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P, bool Aligned>
|
||||
struct compute_length
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<D, T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<L, T, P> const & v)
|
||||
{
|
||||
return sqrt(dot(v, v));
|
||||
}
|
||||
};
|
||||
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P, bool Aligned>
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P, bool Aligned>
|
||||
struct compute_distance
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<D, T, P> const & p0, vecType<D, T, P> const & p1)
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<L, T, P> const & p0, vecType<L, T, P> const & p1)
|
||||
{
|
||||
return length(p1 - p0);
|
||||
}
|
||||
@ -84,10 +84,10 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_normalize
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
@ -95,10 +95,10 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_faceforward
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & N, vecType<D, T, P> const & I, vecType<D, T, P> const & Nref)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & N, vecType<L, T, P> const & I, vecType<L, T, P> const & Nref)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
@ -106,19 +106,19 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_reflect
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & I, vecType<D, T, P> const & N)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & I, vecType<L, T, P> const & N)
|
||||
{
|
||||
return I - N * dot(N, I) * static_cast<T>(2);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_refract
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & I, vecType<D, T, P> const & N, T eta)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & I, vecType<L, T, P> const & N, T eta)
|
||||
{
|
||||
T const dotValue(dot(N, I));
|
||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||
@ -136,12 +136,12 @@ namespace detail
|
||||
return abs(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T length(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T length(vecType<L, T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs");
|
||||
|
||||
return detail::compute_length<vecType, D, T, P, detail::is_aligned<P>::value>::call(v);
|
||||
return detail::compute_length<vecType, L, T, P, detail::is_aligned<P>::value>::call(v);
|
||||
}
|
||||
|
||||
// distance
|
||||
@ -153,10 +153,10 @@ namespace detail
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance(vecType<D, T, P> const & p0, vecType<D, T, P> const & p1)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance(vecType<L, T, P> const & p0, vecType<L, T, P> const & p1)
|
||||
{
|
||||
return detail::compute_distance<vecType, D, T, P, detail::is_aligned<P>::value>::call(p0, p1);
|
||||
return detail::compute_distance<vecType, L, T, P, detail::is_aligned<P>::value>::call(p0, p1);
|
||||
}
|
||||
|
||||
// dot
|
||||
@ -167,11 +167,11 @@ namespace detail
|
||||
return x * y;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T dot(vec<D, T, P> const & x, vec<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T dot(vec<L, T, P> const & x, vec<L, T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||
return detail::compute_dot<vec<D, T, P>, T, detail::is_aligned<P>::value>::call(x, y);
|
||||
return detail::compute_dot<vec<L, T, P>, T, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
template<typename T, precision P>
|
||||
@ -197,12 +197,12 @@ namespace detail
|
||||
return x < genType(0) ? genType(-1) : genType(1);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> normalize(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> normalize(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
return detail::compute_normalize<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_normalize<L, T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// faceforward
|
||||
@ -212,10 +212,10 @@ namespace detail
|
||||
return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> faceforward(vecType<D, T, P> const & N, vecType<D, T, P> const & I, vecType<D, T, P> const & Nref)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> faceforward(vecType<L, T, P> const & N, vecType<L, T, P> const & I, vecType<L, T, P> const & Nref)
|
||||
{
|
||||
return detail::compute_faceforward<D, T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref);
|
||||
return detail::compute_faceforward<L, T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref);
|
||||
}
|
||||
|
||||
// reflect
|
||||
@ -225,10 +225,10 @@ namespace detail
|
||||
return I - N * dot(N, I) * genType(2);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> reflect(vecType<D, T, P> const & I, vecType<D, T, P> const & N)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> reflect(vecType<L, T, P> const & I, vecType<L, T, P> const & N)
|
||||
{
|
||||
return detail::compute_reflect<D, T, P, vecType, detail::is_aligned<P>::value>::call(I, N);
|
||||
return detail::compute_reflect<L, T, P, vecType, detail::is_aligned<P>::value>::call(I, N);
|
||||
}
|
||||
|
||||
// refract
|
||||
@ -241,11 +241,11 @@ namespace detail
|
||||
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> refract(vecType<D, T, P> const & I, vecType<D, T, P> const & N, T eta)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> refract(vecType<L, T, P> const & I, vecType<L, T, P> const & N, T eta)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs");
|
||||
return detail::compute_refract<D, T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta);
|
||||
return detail::compute_refract<L, T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -30,11 +30,11 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uint, P> uaddCarry(
|
||||
vecType<D, uint, P> const & x,
|
||||
vecType<D, uint, P> const & y,
|
||||
vecType<D, uint, P> & carry);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uint, P> uaddCarry(
|
||||
vecType<L, uint, P> const & x,
|
||||
vecType<L, uint, P> const & y,
|
||||
vecType<L, uint, P> & carry);
|
||||
|
||||
/// Subtracts the 32-bit unsigned integer y from x, returning
|
||||
/// the difference if non-negative, or pow(2, 32) plus the difference
|
||||
@ -44,11 +44,11 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uint, P> usubBorrow(
|
||||
vecType<D, uint, P> const & x,
|
||||
vecType<D, uint, P> const & y,
|
||||
vecType<D, uint, P> & borrow);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uint, P> usubBorrow(
|
||||
vecType<L, uint, P> const & x,
|
||||
vecType<L, uint, P> const & y,
|
||||
vecType<L, uint, P> & borrow);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
@ -58,12 +58,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL void umulExtended(
|
||||
vecType<D, uint, P> const & x,
|
||||
vecType<D, uint, P> const & y,
|
||||
vecType<D, uint, P> & msb,
|
||||
vecType<D, uint, P> & lsb);
|
||||
vecType<L, uint, P> const & x,
|
||||
vecType<L, uint, P> const & y,
|
||||
vecType<L, uint, P> & msb,
|
||||
vecType<L, uint, P> & lsb);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
@ -73,12 +73,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL void imulExtended(
|
||||
vecType<D, int, P> const & x,
|
||||
vecType<D, int, P> const & y,
|
||||
vecType<D, int, P> & msb,
|
||||
vecType<D, int, P> & lsb);
|
||||
vecType<L, int, P> const & x,
|
||||
vecType<L, int, P> const & y,
|
||||
vecType<L, int, P> & msb,
|
||||
vecType<L, int, P> & lsb);
|
||||
|
||||
/// Extracts bits [offset, offset + bits - 1] from value,
|
||||
/// returning them in the least significant bits of the result.
|
||||
@ -95,9 +95,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldExtract(
|
||||
vecType<D, T, P> const & Value,
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldExtract(
|
||||
vecType<L, T, P> const& Value,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
@ -115,10 +115,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldInsert(
|
||||
vecType<D, T, P> const & Base,
|
||||
vecType<D, T, P> const & Insert,
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldInsert(
|
||||
vecType<L, T, P> const& Base,
|
||||
vecType<L, T, P> const& Insert,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
@ -130,8 +130,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldReverse(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldReverse(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
@ -148,8 +148,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, int, P> bitCount(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, int, P> bitCount(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
@ -170,8 +170,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, int, P> findLSB(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, int, P> findLSB(vecType<L, T, P> const & v);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
@ -194,8 +194,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, int, P> findMSB(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, int, P> findMSB(vecType<L, T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -30,37 +30,37 @@ namespace detail
|
||||
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned, bool EXEC>
|
||||
template<length_t L, typename T, glm::precision P, template<length_t, typename, precision> class vecType, bool Aligned, bool EXEC>
|
||||
struct compute_bitfieldReverseStep
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_bitfieldReverseStep<D, T, P, vecType, Aligned, true>
|
||||
template<length_t L, typename T, glm::precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_bitfieldReverseStep<L, T, P, vecType, Aligned, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned, bool EXEC>
|
||||
template<length_t L, typename T, glm::precision P, template<length_t, typename, precision> class vecType, bool Aligned, bool EXEC>
|
||||
struct compute_bitfieldBitCountStep
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_bitfieldBitCountStep<D, T, P, vecType, Aligned, true>
|
||||
template<length_t L, typename T, glm::precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_bitfieldBitCountStep<L, T, P, vecType, Aligned, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) + ((v >> Shift) & Mask);
|
||||
}
|
||||
@ -104,37 +104,37 @@ namespace detail
|
||||
# endif
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool EXEC = true>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool EXEC = true>
|
||||
struct compute_findMSB_step_vec
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, T Shift)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x, T Shift)
|
||||
{
|
||||
return x | (x >> Shift);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_findMSB_step_vec<D, T, P, vecType, false>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_findMSB_step_vec<L, T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, T)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& x, T)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, int>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, int>
|
||||
struct compute_findMSB_vec
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int, P> call(vecType<D, T, P> const & vec)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int, P> call(vecType<L, T, P> const& v)
|
||||
{
|
||||
vecType<D, T, P> x(vec);
|
||||
x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 1));
|
||||
x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 2));
|
||||
x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 4));
|
||||
x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 16>::call(x, static_cast<T>( 8));
|
||||
x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 32>::call(x, static_cast<T>(16));
|
||||
x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32));
|
||||
return vecType<D, int, P>(sizeof(T) * 8 - 1) - glm::bitCount(~x);
|
||||
vecType<L, T, P> x(v);
|
||||
x = compute_findMSB_step_vec<L, T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 1));
|
||||
x = compute_findMSB_step_vec<L, T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 2));
|
||||
x = compute_findMSB_step_vec<L, T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 4));
|
||||
x = compute_findMSB_step_vec<L, T, P, vecType, sizeof(T) * 8 >= 16>::call(x, static_cast<T>( 8));
|
||||
x = compute_findMSB_step_vec<L, T, P, vecType, sizeof(T) * 8 >= 32>::call(x, static_cast<T>(16));
|
||||
x = compute_findMSB_step_vec<L, T, P, vecType, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32));
|
||||
return vecType<L, int, P>(sizeof(T) * 8 - 1) - glm::bitCount(~x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -147,12 +147,12 @@ namespace detail
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template<int, typename, precision> class vecType>
|
||||
struct compute_findMSB_vec<D, T, P, vecType, 32>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_findMSB_vec<L, T, P, vecType, 32>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int, P> call(vecType<L, T, P> const& x)
|
||||
{
|
||||
return detail::functor1<D, int, T, P>::call(compute_findMSB_32, x);
|
||||
return detail::functor1<L, int, T, P>::call(compute_findMSB_32, x);
|
||||
}
|
||||
};
|
||||
|
||||
@ -165,12 +165,12 @@ namespace detail
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_findMSB_vec<D, T, P, vecType, 64>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_findMSB_vec<L, T, P, vecType, 64>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int, P> call(vecType<L, T, P> const& x)
|
||||
{
|
||||
return detail::functor1<D, int, T, P>::call(compute_findMSB_64, x);
|
||||
return detail::functor1<L, int, T, P>::call(compute_findMSB_64, x);
|
||||
}
|
||||
};
|
||||
# endif
|
||||
@ -186,13 +186,13 @@ namespace detail
|
||||
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> uaddCarry(vecType<D, uint, P> const & x, vecType<D, uint, P> const & y, vecType<D, uint, P> & Carry)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> uaddCarry(vecType<L, uint, P> const& x, vecType<L, uint, P> const& y, vecType<L, uint, P>& Carry)
|
||||
{
|
||||
vecType<D, uint64, P> Value64(vecType<D, uint64, P>(x) + vecType<D, uint64, P>(y));
|
||||
vecType<D, uint64, P> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = mix(vecType<D, uint32, P>(0), vecType<D, uint32, P>(1), greaterThan(Value64, Max32));
|
||||
return vecType<D, uint32,P>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
vecType<L, uint64, P> Value64(vecType<L, uint64, P>(x) + vecType<L, uint64, P>(y));
|
||||
vecType<L, uint64, P> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = mix(vecType<L, uint32, P>(0), vecType<L, uint32, P>(1), greaterThan(Value64, Max32));
|
||||
return vecType<L, uint32,P>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
// usubBorrow
|
||||
@ -207,12 +207,12 @@ namespace detail
|
||||
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> usubBorrow(vecType<D, uint, P> const & x, vecType<D, uint, P> const & y, vecType<D, uint, P> & Borrow)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> usubBorrow(vecType<L, uint, P> const& x, vecType<L, uint, P> const& y, vecType<L, uint, P>& Borrow)
|
||||
{
|
||||
Borrow = mix(vecType<D, uint, P>(1), vecType<D, uint, P>(0), greaterThanEqual(x, y));
|
||||
vecType<D, uint, P> const YgeX(y - x);
|
||||
vecType<D, uint, P> const XgeY(vecType<D, uint32, P>((static_cast<int64>(1) << static_cast<int64>(32)) + (vecType<D, int64, P>(y) - vecType<D, int64, P>(x))));
|
||||
Borrow = mix(vecType<L, uint, P>(1), vecType<L, uint, P>(0), greaterThanEqual(x, y));
|
||||
vecType<L, uint, P> const YgeX(y - x);
|
||||
vecType<L, uint, P> const XgeY(vecType<L, uint32, P>((static_cast<int64>(1) << static_cast<int64>(32)) + (vecType<L, int64, P>(y) - vecType<L, int64, P>(x))));
|
||||
return mix(XgeY, YgeX, greaterThanEqual(y, x));
|
||||
}
|
||||
|
||||
@ -226,14 +226,14 @@ namespace detail
|
||||
lsb = static_cast<uint>(Value64);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void umulExtended(vecType<D, uint, P> const & x, vecType<D, uint, P> const & y, vecType<D, uint, P> & msb, vecType<D, uint, P> & lsb)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void umulExtended(vecType<L, uint, P> const& x, vecType<L, uint, P> const& y, vecType<L, uint, P>& msb, vecType<L, uint, P>& lsb)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
vecType<D, uint64, P> Value64(vecType<D, uint64, P>(x) * vecType<D, uint64, P>(y));
|
||||
msb = vecType<D, uint32, P>(Value64 >> static_cast<uint64>(32));
|
||||
lsb = vecType<D, uint32, P>(Value64);
|
||||
vecType<L, uint64, P> Value64(vecType<L, uint64, P>(x) * vecType<L, uint64, P>(y));
|
||||
msb = vecType<L, uint32, P>(Value64 >> static_cast<uint64>(32));
|
||||
lsb = vecType<L, uint32, P>(Value64);
|
||||
}
|
||||
|
||||
// imulExtended
|
||||
@ -246,14 +246,14 @@ namespace detail
|
||||
lsb = static_cast<int>(Value64);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void imulExtended(vecType<D, int, P> const & x, vecType<D, int, P> const & y, vecType<D, int, P> & msb, vecType<D, int, P> & lsb)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void imulExtended(vecType<L, int, P> const& x, vecType<L, int, P> const& y, vecType<L, int, P>& msb, vecType<L, int, P>& lsb)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
vecType<D, int64, P> Value64(vecType<D, int64, P>(x) * vecType<D, int64, P>(y));
|
||||
lsb = vecType<D, int32, P>(Value64 & static_cast<int64>(0xFFFFFFFF));
|
||||
msb = vecType<D, int32, P>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
|
||||
vecType<L, int64, P> Value64(vecType<L, int64, P>(x) * vecType<L, int64, P>(y));
|
||||
lsb = vecType<L, int32, P>(Value64 & static_cast<int64>(0xFFFFFFFF));
|
||||
msb = vecType<L, int32, P>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
|
||||
}
|
||||
|
||||
// bitfieldExtract
|
||||
@ -263,8 +263,8 @@ namespace detail
|
||||
return bitfieldExtract(vec<1, genIUType>(Value), Offset, Bits).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldExtract(vecType<D, T, P> const & Value, int Offset, int Bits)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldExtract(vecType<L, T, P> const& Value, int Offset, int Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldExtract' only accept integer inputs");
|
||||
|
||||
@ -278,8 +278,8 @@ namespace detail
|
||||
return bitfieldInsert(vec<1, genIUType>(Base), vec<1, genIUType>(Insert), Offset, Bits).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldInsert(vecType<D, T, P> const & Base, vecType<D, T, P> const & Insert, int Offset, int Bits)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldInsert(vecType<L, T, P> const& Base, vecType<L, T, P> const& Insert, int Offset, int Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldInsert' only accept integer values");
|
||||
|
||||
@ -294,16 +294,16 @@ namespace detail
|
||||
return bitfieldReverse(glm::vec<1, genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverse(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, glm::precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverse(vecType<L, T, P> const& v)
|
||||
{
|
||||
vecType<D, T, P> x(v);
|
||||
x = detail::compute_bitfieldReverseStep<D, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<D, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<D, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<D, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<D, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<D, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
vecType<L, T, P> x(v);
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -314,21 +314,21 @@ namespace detail
|
||||
return bitCount(glm::vec<1, genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> bitCount(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, glm::precision P, template<length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> bitCount(vecType<L, T, P> const& v)
|
||||
{
|
||||
#if GLM_COMPILER & GLM_COMPILER_VC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4310) //cast truncates constant value
|
||||
#endif
|
||||
vecType<D, typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<D, typename detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = detail::compute_bitfieldBitCountStep<D, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||
x = detail::compute_bitfieldBitCountStep<D, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||
x = detail::compute_bitfieldBitCountStep<D, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||
x = detail::compute_bitfieldBitCountStep<D, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||
x = detail::compute_bitfieldBitCountStep<D, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||
x = detail::compute_bitfieldBitCountStep<D, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||
return vecType<D, int, P>(x);
|
||||
vecType<L, typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<L, typename detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||
return vecType<L, int, P>(x);
|
||||
#if GLM_COMPILER & GLM_COMPILER_VC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
@ -343,29 +343,29 @@ namespace detail
|
||||
return detail::compute_findLSB<genIUType, sizeof(genIUType) * 8>::call(Value);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> findLSB(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> findLSB(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findLSB' only accept integer values");
|
||||
|
||||
return detail::functor1<D, int, T, P>::call(findLSB, x);
|
||||
return detail::functor1<L, int, T, P>::call(findLSB, x);
|
||||
}
|
||||
|
||||
// findMSB
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB(genIUType x)
|
||||
GLM_FUNC_QUALIFIER int findMSB(genIUType v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
|
||||
return findMSB(vec<1, genIUType>(x)).x;
|
||||
return findMSB(vec<1, genIUType>(v)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> findMSB(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> findMSB(vecType<L, T, P> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findMSB' only accept integer values");
|
||||
|
||||
return detail::compute_findMSB_vec<D, T, P, vecType, sizeof(T) * 8>::call(x);
|
||||
return detail::compute_findMSB_vec<L, T, P, vecType, sizeof(T) * 8>::call(v);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -111,7 +111,7 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template <int DA, int DB, typename T, precision P, template <int, typename, precision> class vecTypeA, template <int, typename, precision> class vecTypeB>
|
||||
template<int DA, int DB, typename T, precision P, template<length_t, typename, precision> class vecTypeA, template<length_t, typename, precision> class vecTypeB>
|
||||
GLM_FUNC_DECL typename detail::outerProduct_trait<DA, DB, T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<DA, T, P> const & c, vecTypeB<DB, T, P> const & r);
|
||||
|
||||
/// Returns the transposed matrix of x
|
||||
|
@ -362,7 +362,7 @@ namespace detail
|
||||
return detail::compute_matrixCompMult<matType, C, R, T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
template<int DA, int DB, typename T, precision P, template <int, typename, precision> class vecTypeA, template <int, typename, precision> class vecTypeB>
|
||||
template<int DA, int DB, typename T, precision P, template<length_t, typename, precision> class vecTypeA, template<length_t, typename, precision> class vecTypeB>
|
||||
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<DA, DB, T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<DA, T, P> const & c, vecTypeB<DB, T, P> const & r)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs");
|
||||
|
@ -28,8 +28,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vecType<D, T, P> radians(vecType<D, T, P> const & degrees);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vecType<L, T, P> radians(vecType<L, T, P> const & degrees);
|
||||
|
||||
/// Converts radians to degrees and returns the result.
|
||||
///
|
||||
@ -37,8 +37,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vecType<D, T, P> degrees(vecType<D, T, P> const & radians);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vecType<L, T, P> degrees(vecType<L, T, P> const & radians);
|
||||
|
||||
/// The standard trigonometric sine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
@ -47,8 +47,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> sin(vecType<D, T, P> const & angle);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> sin(vecType<L, T, P> const & angle);
|
||||
|
||||
/// The standard trigonometric cosine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
@ -57,8 +57,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> cos(vecType<D, T, P> const & angle);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> cos(vecType<L, T, P> const & angle);
|
||||
|
||||
/// The standard trigonometric tangent function.
|
||||
///
|
||||
@ -66,8 +66,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> tan(vecType<D, T, P> const & angle);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> tan(vecType<L, T, P> const & angle);
|
||||
|
||||
/// Arc sine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
@ -77,8 +77,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> asin(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> asin(vecType<L, T, P> const & x);
|
||||
|
||||
/// Arc cosine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [0, PI].
|
||||
@ -88,8 +88,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> acos(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> acos(vecType<L, T, P> const & x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y/x.
|
||||
/// The signs of x and y are used to determine what
|
||||
@ -101,8 +101,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> atan(vecType<D, T, P> const & y, vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> atan(vecType<L, T, P> const & y, vecType<L, T, P> const & x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y_over_x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
@ -111,8 +111,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> atan(vecType<D, T, P> const & y_over_x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> atan(vecType<L, T, P> const & y_over_x);
|
||||
|
||||
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
||||
///
|
||||
@ -120,8 +120,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> sinh(vecType<D, T, P> const & angle);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> sinh(vecType<L, T, P> const & angle);
|
||||
|
||||
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
||||
///
|
||||
@ -129,8 +129,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> cosh(vecType<D, T, P> const & angle);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> cosh(vecType<L, T, P> const & angle);
|
||||
|
||||
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
||||
///
|
||||
@ -138,8 +138,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> tanh(vecType<D, T, P> const & angle);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> tanh(vecType<L, T, P> const & angle);
|
||||
|
||||
/// Arc hyperbolic sine; returns the inverse of sinh.
|
||||
///
|
||||
@ -147,8 +147,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> asinh(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> asinh(vecType<L, T, P> const & x);
|
||||
|
||||
/// Arc hyperbolic cosine; returns the non-negative inverse
|
||||
/// of cosh. Results are undefined if x < 1.
|
||||
@ -157,8 +157,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> acosh(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> acosh(vecType<L, T, P> const & x);
|
||||
|
||||
/// Arc hyperbolic tangent; returns the inverse of tanh.
|
||||
/// Results are undefined if abs(x) >= 1.
|
||||
@ -167,8 +167,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> atanh(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> atanh(vecType<L, T, P> const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -16,10 +16,10 @@ namespace glm
|
||||
return degrees * static_cast<genType>(0.01745329251994329576923690768489);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<D, T, P> radians(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<L, T, P> radians(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(radians, v);
|
||||
return detail::functor1<L, T, T, P>::call(radians, v);
|
||||
}
|
||||
|
||||
// degrees
|
||||
@ -31,55 +31,55 @@ namespace glm
|
||||
return radians * static_cast<genType>(57.295779513082320876798154814105);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<D, T, P> degrees(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<L, T, P> degrees(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(degrees, v);
|
||||
return detail::functor1<L, T, T, P>::call(degrees, v);
|
||||
}
|
||||
|
||||
// sin
|
||||
using ::std::sin;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sin(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sin(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(sin, v);
|
||||
return detail::functor1<L, T, T, P>::call(sin, v);
|
||||
}
|
||||
|
||||
// cos
|
||||
using std::cos;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> cos(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> cos(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(cos, v);
|
||||
return detail::functor1<L, T, T, P>::call(cos, v);
|
||||
}
|
||||
|
||||
// tan
|
||||
using std::tan;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> tan(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> tan(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(tan, v);
|
||||
return detail::functor1<L, T, T, P>::call(tan, v);
|
||||
}
|
||||
|
||||
// asin
|
||||
using std::asin;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> asin(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> asin(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(asin, v);
|
||||
return detail::functor1<L, T, T, P>::call(asin, v);
|
||||
}
|
||||
|
||||
// acos
|
||||
using std::acos;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acos(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acos(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(acos, v);
|
||||
return detail::functor1<L, T, T, P>::call(acos, v);
|
||||
}
|
||||
|
||||
// atan
|
||||
@ -91,45 +91,45 @@ namespace glm
|
||||
return ::std::atan2(y, x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> atan(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> atan(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(::std::atan2, a, b);
|
||||
return detail::functor2<L, T, P>::call(::std::atan2, a, b);
|
||||
}
|
||||
|
||||
using std::atan;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> atan(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> atan(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(atan, v);
|
||||
return detail::functor1<L, T, T, P>::call(atan, v);
|
||||
}
|
||||
|
||||
// sinh
|
||||
using std::sinh;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sinh(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sinh(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(sinh, v);
|
||||
return detail::functor1<L, T, T, P>::call(sinh, v);
|
||||
}
|
||||
|
||||
// cosh
|
||||
using std::cosh;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> cosh(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> cosh(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(cosh, v);
|
||||
return detail::functor1<L, T, T, P>::call(cosh, v);
|
||||
}
|
||||
|
||||
// tanh
|
||||
using std::tanh;
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> tanh(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> tanh(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(tanh, v);
|
||||
return detail::functor1<L, T, T, P>::call(tanh, v);
|
||||
}
|
||||
|
||||
// asinh
|
||||
@ -145,10 +145,10 @@ namespace glm
|
||||
}
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> asinh(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> asinh(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(asinh, v);
|
||||
return detail::functor1<L, T, T, P>::call(asinh, v);
|
||||
}
|
||||
|
||||
// acosh
|
||||
@ -166,10 +166,10 @@ namespace glm
|
||||
}
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acosh(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acosh(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(acosh, v);
|
||||
return detail::functor1<L, T, T, P>::call(acosh, v);
|
||||
}
|
||||
|
||||
// atanh
|
||||
@ -187,10 +187,10 @@ namespace glm
|
||||
}
|
||||
# endif
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> atanh(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> atanh(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(atanh, v);
|
||||
return detail::functor1<L, T, T, P>::call(atanh, v);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -29,8 +29,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> lessThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> lessThan(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
///
|
||||
@ -38,8 +38,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> lessThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> lessThanEqual(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
///
|
||||
@ -47,8 +47,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> greaterThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> greaterThan(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
///
|
||||
@ -56,8 +56,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> greaterThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> greaterThanEqual(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
///
|
||||
@ -65,8 +65,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> equal(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> equal(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
///
|
||||
@ -74,8 +74,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> notEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> notEqual(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns true if any component of x is true.
|
||||
///
|
||||
@ -83,8 +83,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool any(vecType<D, bool, P> const & v);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool any(vecType<L, bool, P> const & v);
|
||||
|
||||
/// Returns true if all components of x are true.
|
||||
///
|
||||
@ -92,8 +92,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool all(vecType<D, bool, P> const & v);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool all(vecType<L, bool, P> const & v);
|
||||
|
||||
/// Returns the component-wise logical complement of x.
|
||||
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
|
||||
@ -102,8 +102,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> not_(vecType<D, bool, P> const & v);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> not_(vecType<L, bool, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -5,75 +5,75 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> lessThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> lessThan(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] < y[i];
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> lessThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> lessThanEqual(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] <= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> greaterThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> greaterThan(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] > y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> greaterThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> greaterThanEqual(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] >= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> equal(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> equal(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] == y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> notEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> notEqual(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] != y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool any(vecType<D, bool, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool any(vecType<L, bool, P> const & v)
|
||||
{
|
||||
bool Result = false;
|
||||
for(length_t i = 0; i < v.length(); ++i)
|
||||
@ -81,8 +81,8 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool all(vecType<D, bool, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool all(vecType<L, bool, P> const & v)
|
||||
{
|
||||
bool Result = true;
|
||||
for(length_t i = 0; i < v.length(); ++i)
|
||||
@ -90,10 +90,10 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> not_(vecType<D, bool, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> not_(vecType<L, bool, P> const & v)
|
||||
{
|
||||
vecType<D, bool, P> Result(uninitialize);
|
||||
vecType<L, bool, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < v.length(); ++i)
|
||||
Result[i] = !v[i];
|
||||
return Result;
|
||||
|
@ -50,8 +50,8 @@ namespace glm
|
||||
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldRotateRight(vecType<D, T, P> const & In, int Shift);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldRotateRight(vecType<L, T, P> const & In, int Shift);
|
||||
|
||||
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
|
||||
///
|
||||
@ -62,8 +62,8 @@ namespace glm
|
||||
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldRotateLeft(vecType<D, T, P> const & In, int Shift);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldRotateLeft(vecType<L, T, P> const & In, int Shift);
|
||||
|
||||
/// Set to 1 a range of bits.
|
||||
///
|
||||
@ -74,8 +74,8 @@ namespace glm
|
||||
/// Set to 1 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldFillOne(vecType<D, T, P> const & Value, int FirstBit, int BitCount);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldFillOne(vecType<L, T, P> const & Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Set to 0 a range of bits.
|
||||
///
|
||||
@ -86,8 +86,8 @@ namespace glm
|
||||
/// Set to 0 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldFillZero(vecType<D, T, P> const & Value, int FirstBit, int BitCount);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldFillZero(vecType<L, T, P> const & Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
|
@ -230,12 +230,12 @@ namespace detail
|
||||
return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<D, T, P> mask(vecIUType<D, T, P> const& v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<L, T, P> mask(vecIUType<L, T, P> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
return detail::functor1<D, T, T, P>::call(mask, v);
|
||||
return detail::functor1<L, T, T, P>::call(mask, v);
|
||||
}
|
||||
|
||||
template<typename genIType>
|
||||
@ -247,8 +247,8 @@ namespace detail
|
||||
return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldRotateRight(vecType<D, T, P> const & In, int Shift)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldRotateRight(vecType<L, T, P> const & In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateRight' accepts only integer values");
|
||||
|
||||
@ -265,8 +265,8 @@ namespace detail
|
||||
return (In >> static_cast<genIType>(Shift)) | (In << static_cast<genIType>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldRotateLeft(vecType<D, T, P> const& In, int Shift)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldRotateLeft(vecType<L, T, P> const& In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
|
||||
|
||||
@ -280,8 +280,8 @@ namespace detail
|
||||
return Value | static_cast<genIUType>(mask(BitCount) << FirstBit);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldFillOne(vecType<D, T, P> const& Value, int FirstBit, int BitCount)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldFillOne(vecType<L, T, P> const& Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value | static_cast<T>(mask(BitCount) << FirstBit);
|
||||
}
|
||||
@ -292,8 +292,8 @@ namespace detail
|
||||
return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldFillZero(vecType<D, T, P> const& Value, int FirstBit, int BitCount)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldFillZero(vecType<L, T, P> const& Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
@ -32,23 +32,23 @@ namespace glm
|
||||
|
||||
/// Convert a linear color to sRGB color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const & ColorLinear);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const & ColorLinear);
|
||||
|
||||
/// Convert a linear color to sRGB color using a custom gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const & ColorLinear, T Gamma);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const & ColorLinear, T Gamma);
|
||||
|
||||
/// Convert a sRGB color to linear color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const & ColorSRGB);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const & ColorSRGB);
|
||||
|
||||
/// Convert a sRGB color to linear color using a custom gamma correction.
|
||||
// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const & ColorSRGB, T Gamma);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const & ColorSRGB, T Gamma);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
@ -4,17 +4,17 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rgbToSrgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const& ColorRGB, T GammaCorrection)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& ColorRGB, T GammaCorrection)
|
||||
{
|
||||
vecType<D, T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
vecType<L, T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
|
||||
return mix(
|
||||
pow(ClampedColor, vecType<D, T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
pow(ClampedColor, vecType<L, T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
ClampedColor * static_cast<T>(12.92),
|
||||
lessThan(ClampedColor, vecType<D, T, P>(static_cast<T>(0.0031308))));
|
||||
lessThan(ClampedColor, vecType<L, T, P>(static_cast<T>(0.0031308))));
|
||||
}
|
||||
};
|
||||
|
||||
@ -27,15 +27,15 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_srgbToRgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const& ColorSRGB, T Gamma)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return mix(
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<D, T, P>(Gamma)),
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<L, T, P>(Gamma)),
|
||||
ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
|
||||
lessThanEqual(ColorSRGB, vecType<D, T, P>(static_cast<T>(0.04045))));
|
||||
lessThanEqual(ColorSRGB, vecType<L, T, P>(static_cast<T>(0.04045))));
|
||||
}
|
||||
};
|
||||
|
||||
@ -49,10 +49,10 @@ namespace detail
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const& ColorLinear)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const& ColorLinear)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<D, T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
return detail::compute_rgbToSrgb<L, T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
}
|
||||
|
||||
// Based on Ian Taylor http://chilliant.blogspot.fr/2012/08/srgb-approximations-for-hlsl.html
|
||||
@ -65,21 +65,21 @@ namespace detail
|
||||
return 0.662002687f * S1 + 0.684122060f * S2 - 0.323583601f * S3 - 0.0225411470f * ColorLinear;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const& ColorLinear, T Gamma)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const& ColorLinear, T Gamma)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<D, T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
return detail::compute_rgbToSrgb<L, T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const& ColorSRGB)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const& ColorSRGB)
|
||||
{
|
||||
return detail::compute_srgbToRgb<D, T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
return detail::compute_srgbToRgb<L, T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const& ColorSRGB, T Gamma)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return detail::compute_srgbToRgb<D, T, P, vecType>::call(ColorSRGB, Gamma);
|
||||
return detail::compute_srgbToRgb<L, T, P, vecType>::call(ColorSRGB, Gamma);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -30,10 +30,10 @@ namespace glm
|
||||
/// True if this expression is satisfied.
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> epsilonEqual(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> epsilonEqual(
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
T const & epsilon);
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| < epsilon.
|
||||
|
@ -55,48 +55,48 @@ namespace glm
|
||||
return abs(x - y) >= epsilon;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
return lessThan(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return lessThan(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<D, T, P> const & epsilon
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
vecType<L, T, P> const& epsilon
|
||||
)
|
||||
{
|
||||
return lessThan(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return lessThan(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonNotEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonNotEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return greaterThanEqual(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonNotEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonNotEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<D, T, P> const & epsilon
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
vecType<L, T, P> const& epsilon
|
||||
)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return greaterThanEqual(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template<typename T, precision P>
|
||||
|
@ -55,8 +55,8 @@ namespace glm
|
||||
/// @see gtc_integer
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, T y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mod(vecType<L, T, P> const & x, T y);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
/// for each component in x using the floating point value y.
|
||||
@ -67,8 +67,8 @@ namespace glm
|
||||
/// @see gtc_integer
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mod(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@ -80,8 +80,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see gtc_integer
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, int, P> iround(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, int, P> iround(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@ -93,8 +93,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see gtc_integer
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uint, P> uround(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uint, P> uround(vecType<L, T, P> const & x);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
@ -4,14 +4,14 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_log2<D, T, P, vecType, false, Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_log2<L, T, P, vecType, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & vec)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& v)
|
||||
{
|
||||
//Equivalent to return findMSB(vec); but save one function call in ASM with VC
|
||||
//return findMSB(vec);
|
||||
return vecType<D, T, P>(detail::compute_findMSB_vec<D, T, P, vecType, sizeof(T) * 8>::call(vec));
|
||||
return vecType<L, T, P>(detail::compute_findMSB_vec<L, T, P, vecType, sizeof(T) * 8>::call(v));
|
||||
}
|
||||
};
|
||||
|
||||
@ -42,13 +42,13 @@ namespace detail
|
||||
return static_cast<int>(x + static_cast<genType>(0.5));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> iround(vecType<D, T, P> const& x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> iround(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs");
|
||||
assert(all(lessThanEqual(vecType<D, T, P>(0), x)));
|
||||
assert(all(lessThanEqual(vecType<L, T, P>(0), x)));
|
||||
|
||||
return vecType<D, int, P>(x + static_cast<T>(0.5));
|
||||
return vecType<L, int, P>(x + static_cast<T>(0.5));
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
@ -60,12 +60,12 @@ namespace detail
|
||||
return static_cast<uint>(x + static_cast<genType>(0.5));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> uround(vecType<D, T, P> const& x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> uround(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs");
|
||||
assert(all(lessThanEqual(vecType<D, T, P>(0), x)));
|
||||
assert(all(lessThanEqual(vecType<L, T, P>(0), x)));
|
||||
|
||||
return vecType<D, uint, P>(x + static_cast<T>(0.5));
|
||||
return vecType<L, uint, P>(x + static_cast<T>(0.5));
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -37,22 +37,22 @@ namespace glm
|
||||
|
||||
/// Classic perlin noise.
|
||||
/// @see gtc_noise
|
||||
template <int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T perlin(
|
||||
vecType<D, T, P> const & p);
|
||||
vecType<L, T, P> const& p);
|
||||
|
||||
/// Periodic perlin noise.
|
||||
/// @see gtc_noise
|
||||
template <int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T perlin(
|
||||
vecType<D, T, P> const & p,
|
||||
vecType<D, T, P> const & rep);
|
||||
vecType<L, T, P> const& p,
|
||||
vecType<L, T, P> const& rep);
|
||||
|
||||
/// Simplex noise.
|
||||
/// @see gtc_noise
|
||||
template <int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T simplex(
|
||||
vecType<D, T, P> const & p);
|
||||
vecType<L, T, P> const& p);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -477,7 +477,7 @@ namespace glm
|
||||
/// @see gtc_packing
|
||||
/// @see vec<3, T, P> unpackRGBM(vec<4, T, P> const & p)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, T, P> packRGBM(vec<3, T, P> const & rgb);
|
||||
|
||||
/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
|
||||
@ -487,7 +487,7 @@ namespace glm
|
||||
/// @see gtc_packing
|
||||
/// @see vec<4, T, P> packRGBM(vec<3, float, P> const & v)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> unpackRGBM(vec<4, T, P> const & rgbm);
|
||||
|
||||
/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
|
||||
@ -496,48 +496,48 @@ namespace glm
|
||||
/// the forth component specifies the 16 most-significant bits.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & p)
|
||||
/// @see vecType<L, float, P> unpackHalf(vecType<L, uint16, P> const & p)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uint16, P> packHalf(vecType<L, float, P> const & v);
|
||||
|
||||
/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
|
||||
/// The first component of the vector is obtained from the 16 least-significant bits of v;
|
||||
/// the forth component is obtained from the 16 most-significant bits of v.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v)
|
||||
/// @see vecType<L, uint16, P> packHalf(vecType<L, float, P> const & v)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & p);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, float, P> unpackHalf(vecType<L, uint16, P> const & p);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into unsigned integer values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, floatType, P> unpackUnorm(vecType<D, intType, P> const & p);
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uintType, P> packUnorm(vecType<D, floatType, P> const & v);
|
||||
/// @see vecType<L, floatType, P> unpackUnorm(vecType<L, intType, P> const & p);
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uintType, P> packUnorm(vecType<L, floatType, P> const & v);
|
||||
|
||||
/// Convert each unsigned integer components of a vector to normalized floating-point values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, intType, P> packUnorm(vecType<D, floatType, P> const & v)
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, floatType, P> unpackUnorm(vecType<D, uintType, P> const & v);
|
||||
/// @see vecType<L, intType, P> packUnorm(vecType<L, floatType, P> const & v)
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, floatType, P> unpackUnorm(vecType<L, uintType, P> const & v);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into signed integer values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & p);
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v);
|
||||
/// @see vecType<L, floatType, P> unpackSnorm(vecType<L, intType, P> const & p);
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, intType, P> packSnorm(vecType<L, floatType, P> const & v);
|
||||
|
||||
/// Convert each signed integer components of a vector to normalized floating-point values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v)
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & v);
|
||||
/// @see vecType<L, intType, P> packSnorm(vecType<L, floatType, P> const & v)
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, floatType, P> unpackSnorm(vecType<L, intType, P> const & v);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into unsigned integer values.
|
||||
///
|
||||
|
@ -270,7 +270,7 @@ namespace detail
|
||||
uint32 pack;
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_half
|
||||
{};
|
||||
|
||||
@ -655,52 +655,52 @@ namespace detail
|
||||
return vec<3, T, P>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint16, P> packHalf(vecType<L, float, P> const & v)
|
||||
{
|
||||
return detail::compute_half<D, P, vecType>::pack(v);
|
||||
return detail::compute_half<L, P, vecType>::pack(v);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> unpackHalf(vecType<L, uint16, P> const & v)
|
||||
{
|
||||
return detail::compute_half<D, P, vecType>::unpack(v);
|
||||
return detail::compute_half<L, P, vecType>::unpack(v);
|
||||
}
|
||||
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uintType, P> packUnorm(vecType<D, floatType, P> const & v)
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uintType, P> packUnorm(vecType<L, floatType, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return vecType<D, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
|
||||
return vecType<L, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
|
||||
}
|
||||
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, floatType, P> unpackUnorm(vecType<D, uintType, P> const & v)
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, floatType, P> unpackUnorm(vecType<L, uintType, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return vecType<D, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
|
||||
return vecType<L, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
|
||||
}
|
||||
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v)
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, intType, P> packSnorm(vecType<L, floatType, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return vecType<D, intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
|
||||
return vecType<L, intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
|
||||
}
|
||||
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & v)
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, floatType, P> unpackSnorm(vecType<L, intType, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return clamp(vecType<D, floatType, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
|
||||
return clamp(vecType<L, floatType, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const & v)
|
||||
|
@ -44,10 +44,10 @@ namespace glm
|
||||
/// @tparam T Value type. Currently supported: float or double.
|
||||
/// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible
|
||||
/// @see gtc_random
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> linearRand(
|
||||
vecType<D, T, P> const & Min,
|
||||
vecType<D, T, P> const & Max);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> linearRand(
|
||||
vecType<L, T, P> const& Min,
|
||||
vecType<L, T, P> const& Max);
|
||||
|
||||
/// Generate random numbers in the interval [Min, Max], according a gaussian distribution
|
||||
///
|
||||
|
@ -10,10 +10,10 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, class, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<int, class, precision> class vecType>
|
||||
struct compute_rand
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call();
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call();
|
||||
};
|
||||
|
||||
template<precision P>
|
||||
@ -62,195 +62,195 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_rand<D, uint16, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rand<L, uint16, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint16, P> call()
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint16, P> call()
|
||||
{
|
||||
return
|
||||
(vecType<D, uint16, P>(compute_rand<D, uint8, P, vecType>::call()) << static_cast<uint16>(8)) |
|
||||
(vecType<D, uint16, P>(compute_rand<D, uint8, P, vecType>::call()) << static_cast<uint16>(0));
|
||||
(vecType<L, uint16, P>(compute_rand<L, uint8, P, vecType>::call()) << static_cast<uint16>(8)) |
|
||||
(vecType<L, uint16, P>(compute_rand<L, uint8, P, vecType>::call()) << static_cast<uint16>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_rand<D, uint32, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rand<L, uint32, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint32, P> call()
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint32, P> call()
|
||||
{
|
||||
return
|
||||
(vecType<D, uint32, P>(compute_rand<D, uint16, P, vecType>::call()) << static_cast<uint32>(16)) |
|
||||
(vecType<D, uint32, P>(compute_rand<D, uint16, P, vecType>::call()) << static_cast<uint32>(0));
|
||||
(vecType<L, uint32, P>(compute_rand<L, uint16, P, vecType>::call()) << static_cast<uint32>(16)) |
|
||||
(vecType<L, uint32, P>(compute_rand<L, uint16, P, vecType>::call()) << static_cast<uint32>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_rand<D, uint64, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rand<L, uint64, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint64, P> call()
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint64, P> call()
|
||||
{
|
||||
return
|
||||
(vecType<D, uint64, P>(compute_rand<D, uint32, P, vecType>::call()) << static_cast<uint64>(32)) |
|
||||
(vecType<D, uint64, P>(compute_rand<D, uint32, P, vecType>::call()) << static_cast<uint64>(0));
|
||||
(vecType<L, uint64, P>(compute_rand<L, uint32, P, vecType>::call()) << static_cast<uint64>(32)) |
|
||||
(vecType<L, uint64, P>(compute_rand<L, uint32, P, vecType>::call()) << static_cast<uint64>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & Min, vecType<D, T, P> const & Max);
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & Min, vecType<L, T, P> const & Max);
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int8, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int8, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int8, P> call(vecType<D, int8, P> const & Min, vecType<D, int8, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int8, P> call(vecType<L, int8, P> const & Min, vecType<L, int8, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int8, P>(compute_rand<D, uint8, P, vecType>::call() % vecType<D, uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
|
||||
return (vecType<L, int8, P>(compute_rand<L, uint8, P, vecType>::call() % vecType<L, uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint8, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint8, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint8, P> call(vecType<D, uint8, P> const & Min, vecType<D, uint8, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint8, P> call(vecType<L, uint8, P> const & Min, vecType<L, uint8, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int16, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int16, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int16, P> call(vecType<D, int16, P> const & Min, vecType<D, int16, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int16, P> call(vecType<L, int16, P> const & Min, vecType<L, int16, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int16, P>(compute_rand<D, uint16, P, vecType>::call() % vecType<D, uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
|
||||
return (vecType<L, int16, P>(compute_rand<L, uint16, P, vecType>::call() % vecType<L, uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint16, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint16, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint16, P> call(vecType<D, uint16, P> const & Min, vecType<D, uint16, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint16, P> call(vecType<L, uint16, P> const & Min, vecType<L, uint16, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int32, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int32, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int32, P> call(vecType<D, int32, P> const & Min, vecType<D, int32, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int32, P> call(vecType<L, int32, P> const & Min, vecType<L, int32, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int32, P>(compute_rand<D, uint32, P, vecType>::call() % vecType<D, uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
|
||||
return (vecType<L, int32, P>(compute_rand<L, uint32, P, vecType>::call() % vecType<L, uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint32, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint32, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint32, P> call(vecType<D, uint32, P> const & Min, vecType<D, uint32, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint32, P> call(vecType<L, uint32, P> const & Min, vecType<L, uint32, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int64, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int64, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int64, P> call(vecType<D, int64, P> const & Min, vecType<D, int64, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int64, P> call(vecType<L, int64, P> const & Min, vecType<L, int64, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int64, P>(compute_rand<D, uint64, P, vecType>::call() % vecType<D, uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
|
||||
return (vecType<L, int64, P>(compute_rand<L, uint64, P, vecType>::call() % vecType<L, uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint64, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint64, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint64, P> call(vecType<D, uint64, P> const & Min, vecType<D, uint64, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint64, P> call(vecType<L, uint64, P> const & Min, vecType<L, uint64, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, float, lowp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, float, lowp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, float, lowp> call(vecType<D, float, lowp> const & Min, vecType<D, float, lowp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, float, lowp> call(vecType<L, float, lowp> const & Min, vecType<L, float, lowp> const & Max)
|
||||
{
|
||||
return vecType<D, float, lowp>(compute_rand<D, uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, float, lowp>(compute_rand<L, uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, float, mediump, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, float, mediump, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, float, mediump> call(vecType<D, float, mediump> const & Min, vecType<D, float, mediump> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, float, mediump> call(vecType<L, float, mediump> const & Min, vecType<L, float, mediump> const & Max)
|
||||
{
|
||||
return vecType<D, float, mediump>(compute_rand<D, uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, float, mediump>(compute_rand<L, uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, float, highp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, float, highp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, float, highp> call(vecType<D, float, highp> const & Min, vecType<D, float, highp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, float, highp> call(vecType<L, float, highp> const & Min, vecType<L, float, highp> const & Max)
|
||||
{
|
||||
return vecType<D, float, highp>(compute_rand<D, uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, float, highp>(compute_rand<L, uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, double, lowp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, double, lowp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, double, lowp> call(vecType<D, double, lowp> const & Min, vecType<D, double, lowp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, double, lowp> call(vecType<L, double, lowp> const & Min, vecType<L, double, lowp> const & Max)
|
||||
{
|
||||
return vecType<D, double, lowp>(compute_rand<D, uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, double, lowp>(compute_rand<L, uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, double, mediump, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, double, mediump, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, double, mediump> call(vecType<D, double, mediump> const & Min, vecType<D, double, mediump> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, double, mediump> call(vecType<L, double, mediump> const & Min, vecType<L, double, mediump> const & Max)
|
||||
{
|
||||
return vecType<D, double, mediump>(compute_rand<D, uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, double, mediump>(compute_rand<L, uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, double, highp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, double, highp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, double, highp> call(vecType<D, double, highp> const & Min, vecType<D, double, highp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, double, highp> call(vecType<L, double, highp> const & Min, vecType<L, double, highp> const & Max)
|
||||
{
|
||||
return vecType<D, double, highp>(compute_rand<D, uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, double, highp>(compute_rand<L, uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, long double, lowp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, long double, lowp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, long double, lowp> call(vecType<D, long double, lowp> const & Min, vecType<D, long double, lowp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, long double, lowp> call(vecType<L, long double, lowp> const & Min, vecType<L, long double, lowp> const & Max)
|
||||
{
|
||||
return vecType<D, long double, lowp>(compute_rand<D, uint32, lowp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, long double, lowp>(compute_rand<L, uint32, lowp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, long double, mediump, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, long double, mediump, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, long double, mediump> call(vecType<D, long double, mediump> const & Min, vecType<D, long double, mediump> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, long double, mediump> call(vecType<L, long double, mediump> const & Min, vecType<L, long double, mediump> const & Max)
|
||||
{
|
||||
return vecType<D, long double, mediump>(compute_rand<D, uint64, mediump, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, long double, mediump>(compute_rand<L, uint64, mediump, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, long double, highp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, long double, highp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, long double, highp> call(vecType<D, long double, highp> const & Min, vecType<D, long double, highp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, long double, highp> call(vecType<L, long double, highp> const & Min, vecType<L, long double, highp> const & Max)
|
||||
{
|
||||
return vecType<D, long double, highp>(compute_rand<D, uint64, highp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, long double, highp>(compute_rand<L, uint64, highp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
@ -263,10 +263,10 @@ namespace detail
|
||||
vec<1, genType, highp>(Max)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> linearRand(vecType<D, T, P> const & Min, vecType<D, T, P> const & Max)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> linearRand(vecType<L, T, P> const & Min, vecType<L, T, P> const & Max)
|
||||
{
|
||||
return detail::compute_linearRand<D, T, P, vecType>::call(Min, Max);
|
||||
return detail::compute_linearRand<L, T, P, vecType>::call(Min, Max);
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
@ -285,10 +285,10 @@ namespace detail
|
||||
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> gaussRand(vecType<D, T, P> const & Mean, vecType<D, T, P> const & Deviation)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> gaussRand(vecType<L, T, P> const & Mean, vecType<L, T, P> const & Deviation)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(gaussRand, Mean, Deviation);
|
||||
return detail::functor2<L, T, P>::call(gaussRand, Mean, Deviation);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -14,11 +14,11 @@ namespace glm
|
||||
return genType(1) / glm::cos(angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sec(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sec(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(sec, x);
|
||||
return detail::functor1<L, T, T, P>::call(sec, x);
|
||||
}
|
||||
|
||||
// csc
|
||||
@ -29,11 +29,11 @@ namespace glm
|
||||
return genType(1) / glm::sin(angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> csc(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> csc(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(csc, x);
|
||||
return detail::functor1<L, T, T, P>::call(csc, x);
|
||||
}
|
||||
|
||||
// cot
|
||||
@ -46,11 +46,11 @@ namespace glm
|
||||
return glm::tan(pi_over_2 - angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> cot(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> cot(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(cot, x);
|
||||
return detail::functor1<L, T, T, P>::call(cot, x);
|
||||
}
|
||||
|
||||
// asec
|
||||
@ -61,11 +61,11 @@ namespace glm
|
||||
return acos(genType(1) / x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> asec(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> asec(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(asec, x);
|
||||
return detail::functor1<L, T, T, P>::call(asec, x);
|
||||
}
|
||||
|
||||
// acsc
|
||||
@ -76,11 +76,11 @@ namespace glm
|
||||
return asin(genType(1) / x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acsc(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acsc(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acsc, x);
|
||||
return detail::functor1<L, T, T, P>::call(acsc, x);
|
||||
}
|
||||
|
||||
// acot
|
||||
@ -93,11 +93,11 @@ namespace glm
|
||||
return pi_over_2 - atan(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acot(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acot(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acot, x);
|
||||
return detail::functor1<L, T, T, P>::call(acot, x);
|
||||
}
|
||||
|
||||
// sech
|
||||
@ -108,11 +108,11 @@ namespace glm
|
||||
return genType(1) / glm::cosh(angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sech(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sech(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(sech, x);
|
||||
return detail::functor1<L, T, T, P>::call(sech, x);
|
||||
}
|
||||
|
||||
// csch
|
||||
@ -123,11 +123,11 @@ namespace glm
|
||||
return genType(1) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> csch(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> csch(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(csch, x);
|
||||
return detail::functor1<L, T, T, P>::call(csch, x);
|
||||
}
|
||||
|
||||
// coth
|
||||
@ -138,11 +138,11 @@ namespace glm
|
||||
return glm::cosh(angle) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> coth(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> coth(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(coth, x);
|
||||
return detail::functor1<L, T, T, P>::call(coth, x);
|
||||
}
|
||||
|
||||
// asech
|
||||
@ -153,11 +153,11 @@ namespace glm
|
||||
return acosh(genType(1) / x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> asech(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> asech(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(asech, x);
|
||||
return detail::functor1<L, T, T, P>::call(asech, x);
|
||||
}
|
||||
|
||||
// acsch
|
||||
@ -168,11 +168,11 @@ namespace glm
|
||||
return acsch(genType(1) / x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acsch(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acsch(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acsch, x);
|
||||
return detail::functor1<L, T, T, P>::call(acsch, x);
|
||||
}
|
||||
|
||||
// acoth
|
||||
@ -183,10 +183,10 @@ namespace glm
|
||||
return atanh(genType(1) / x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acoth(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acoth(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acoth, x);
|
||||
return detail::functor1<L, T, T, P>::call(acoth, x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -39,8 +39,8 @@ namespace glm
|
||||
/// Return true if the value is a power of two number.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is just higher the input value,
|
||||
/// round up to a power of two.
|
||||
@ -53,8 +53,8 @@ namespace glm
|
||||
/// round up to a power of two.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> ceilPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> ceilPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is just lower the input value,
|
||||
/// round down to a power of two.
|
||||
@ -67,8 +67,8 @@ namespace glm
|
||||
/// round down to a power of two.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> floorPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> floorPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
///
|
||||
@ -79,8 +79,8 @@ namespace glm
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> roundPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> roundPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
@ -91,14 +91,14 @@ namespace glm
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, T Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, T Multiple);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, vecType<L, T, P> const & Multiple);
|
||||
|
||||
/// Higher multiple number of Source.
|
||||
///
|
||||
@ -117,8 +117,8 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> ceilMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> ceilMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple);
|
||||
|
||||
/// Lower multiple number of Source.
|
||||
///
|
||||
@ -139,10 +139,10 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> floorMultiple(
|
||||
vecType<D, T, P> const & Source,
|
||||
vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> floorMultiple(
|
||||
vecType<L, T, P> const& Source,
|
||||
vecType<L, T, P> const& Multiple);
|
||||
|
||||
/// Lower multiple number of Source.
|
||||
///
|
||||
@ -163,10 +163,10 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> roundMultiple(
|
||||
vecType<D, T, P> const & Source,
|
||||
vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> roundMultiple(
|
||||
vecType<L, T, P> const& Source,
|
||||
vecType<L, T, P> const& Multiple);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
@ -6,62 +6,62 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool compute = false>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool compute = false>
|
||||
struct compute_ceilShift
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_ceilShift<D, T, P, vecType, true>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_ceilShift<L, T, P, vecType, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Shift)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Shift)
|
||||
{
|
||||
return v | (v >> Shift);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isSigned = true>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool isSigned = true>
|
||||
struct compute_ceilPowerOfTwo
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vecType<D, T, P> const Sign(sign(x));
|
||||
vecType<L, T, P> const Sign(sign(x));
|
||||
|
||||
vecType<D, T, P> v(abs(x));
|
||||
vecType<L, T, P> v(abs(x));
|
||||
|
||||
v = v - static_cast<T>(1);
|
||||
v = v | (v >> static_cast<T>(1));
|
||||
v = v | (v >> static_cast<T>(2));
|
||||
v = v | (v >> static_cast<T>(4));
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
return (v + static_cast<T>(1)) * Sign;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_ceilPowerOfTwo<D, T, P, vecType, false>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_ceilPowerOfTwo<L, T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vecType<D, T, P> v(x);
|
||||
vecType<L, T, P> v(x);
|
||||
|
||||
v = v - static_cast<T>(1);
|
||||
v = v | (v >> static_cast<T>(1));
|
||||
v = v | (v >> static_cast<T>(2));
|
||||
v = v | (v >> static_cast<T>(4));
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
return v + static_cast<T>(1);
|
||||
}
|
||||
};
|
||||
@ -219,11 +219,11 @@ namespace detail
|
||||
return !(Result & (Result - 1));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isPowerOfTwo(vecType<D, T, P> const & Value)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isPowerOfTwo(vecType<L, T, P> const & Value)
|
||||
{
|
||||
vecType<D, T, P> const Result(abs(Value));
|
||||
return equal(Result & (Result - 1), vecType<D, T, P>(0));
|
||||
vecType<L, T, P> const Result(abs(Value));
|
||||
return equal(Result & (Result - 1), vecType<L, T, P>(0));
|
||||
}
|
||||
|
||||
//////////////////
|
||||
@ -235,10 +235,10 @@ namespace detail
|
||||
return detail::compute_ceilPowerOfTwo<1, genType, defaultp, vec, std::numeric_limits<genType>::is_signed>::call(vec<1, genType, defaultp>(value)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> ceilPowerOfTwo(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> ceilPowerOfTwo(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::compute_ceilPowerOfTwo<D, T, P, vecType, std::numeric_limits<T>::is_signed>::call(v);
|
||||
return detail::compute_ceilPowerOfTwo<L, T, P, vecType, std::numeric_limits<T>::is_signed>::call(v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@ -250,10 +250,10 @@ namespace detail
|
||||
return isPowerOfTwo(value) ? value : static_cast<genType>(1) << findMSB(value);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> floorPowerOfTwo(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> floorPowerOfTwo(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(floorPowerOfTwo, v);
|
||||
return detail::functor1<L, T, T, P>::call(floorPowerOfTwo, v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@ -270,10 +270,10 @@ namespace detail
|
||||
return (next - value) < (value - prev) ? next : prev;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> roundPowerOfTwo(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> roundPowerOfTwo(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(roundPowerOfTwo, v);
|
||||
return detail::functor1<L, T, T, P>::call(roundPowerOfTwo, v);
|
||||
}
|
||||
|
||||
////////////////
|
||||
@ -285,16 +285,16 @@ namespace detail
|
||||
return isMultiple(vec<1, genType>(Value), vec<1, genType>(Multiple)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, T Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, T Multiple)
|
||||
{
|
||||
return (Value % Multiple) == vecType<D, T, P>(0);
|
||||
return (Value % Multiple) == vecType<L, T, P>(0);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return (Value % Multiple) == vecType<D, T, P>(0);
|
||||
return (Value % Multiple) == vecType<L, T, P>(0);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@ -306,10 +306,10 @@ namespace detail
|
||||
return detail::compute_ceilMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> ceilMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> ceilMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(ceilMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, P>::call(ceilMultiple, Source, Multiple);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@ -321,10 +321,10 @@ namespace detail
|
||||
return detail::compute_floorMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> floorMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> floorMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(floorMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, P>::call(floorMultiple, Source, Multiple);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@ -336,9 +336,9 @@ namespace detail
|
||||
return detail::compute_roundMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> roundMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> roundMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(roundMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, P>::call(roundMultiple, Source, Multiple);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -60,7 +60,7 @@ namespace glm
|
||||
/// Return the constant address to the data of the input parameter.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type const * value_ptr(genType const & vec);
|
||||
GLM_FUNC_DECL typename genType::value_type const * value_ptr(genType const& v);
|
||||
|
||||
/// Build a vector from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
|
@ -11,271 +11,199 @@ namespace glm
|
||||
/// Return the constant address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
vec<2, T, P> const & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<2, T, P> const& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
vec<2, T, P> & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<2, T, P>& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
vec<3, T, P> const & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(vec<3, T, P> const& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
vec<3, T, P> & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<3, T, P>& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
vec<4, T, P> const & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<4, T, P> const& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the vector input.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
vec<4, T, P> & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<4, T, P>& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<2, 2, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 2, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<2, 2, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 2, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<3, 3, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 3, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<3, 3, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 3, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<4, 4, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 4, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<4, 4, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 4, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<2, 3, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 3, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<2, 3, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 3, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<3, 2, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 2, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<3, 2, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 2, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<2, 4, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 4, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<2, 4, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 4, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<4, 2, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 2, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<4, 2, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 2, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<3, 4, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 4, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
mat<3, 4, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 4, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
mat<4, 3, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 3, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr(mat<4, 3, T, P> & mat)
|
||||
GLM_FUNC_QUALIFIER T * value_ptr(mat<4, 3, T, P>& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the input parameter.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
tquat<T, P> const & q
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(tquat<T, P> const& q)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
@ -283,10 +211,7 @@ namespace glm
|
||||
/// Return the address to the data of the quaternion input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
tquat<T, P> & q
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(tquat<T, P>& q)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
|
@ -199,10 +199,10 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> next_float(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> next_float(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = next_float(x[i]);
|
||||
return Result;
|
||||
@ -234,10 +234,10 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> prev_float(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> prev_float(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = prev_float(x[i]);
|
||||
return Result;
|
||||
@ -252,10 +252,10 @@ namespace glm
|
||||
return temp;
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> next_float(vecType<D, T, P> const & x, vecType<D, uint, P> const & ulps)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> next_float(vecType<L, T, P> const & x, vecType<L, uint, P> const & ulps)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = next_float(x[i], ulps[i]);
|
||||
return Result;
|
||||
@ -270,10 +270,10 @@ namespace glm
|
||||
return temp;
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> prev_float(vecType<D, T, P> const & x, vecType<D, uint, P> const & ulps)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> prev_float(vecType<L, T, P> const & x, vecType<L, uint, P> const & ulps)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = prev_float(x[i], ulps[i]);
|
||||
return Result;
|
||||
@ -310,10 +310,10 @@ namespace glm
|
||||
return ulp;
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> float_distance(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> float_distance(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
vecType<D, uint, P> Result(uninitialize);
|
||||
vecType<L, uint, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = float_distance(x[i], y[i]);
|
||||
return Result;
|
||||
|
@ -35,24 +35,24 @@ namespace glm
|
||||
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vec<2, U, P> associatedMin(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b);
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b);
|
||||
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMin(
|
||||
T x, const vecType<D, U, P>& a,
|
||||
T y, const vecType<D, U, P>& b);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMin(
|
||||
T x, const vecType<L, U, P>& a,
|
||||
T y, const vecType<L, U, P>& b);
|
||||
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMin(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMin(
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b);
|
||||
|
||||
/// Minimum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
@ -64,11 +64,11 @@ namespace glm
|
||||
|
||||
/// Minimum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMin(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMin(
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
@ -81,30 +81,30 @@ namespace glm
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMin(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c,
|
||||
vecType<D, T, P> const & w, vecType<D, U, P> const & d);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMin(
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c,
|
||||
vecType<L, T, P> const& w, vecType<L, U, P> const & d);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMin(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b,
|
||||
T z, vecType<D, U, P> const & c,
|
||||
T w, vecType<D, U, P> const & d);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMin(
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b,
|
||||
T z, vecType<L, U, P> const & c,
|
||||
T w, vecType<L, U, P> const & d);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMin(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b,
|
||||
vecType<D, T, P> const & z, U c,
|
||||
vecType<D, T, P> const & w, U d);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMin(
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b,
|
||||
vecType<L, T, P> const& z, U c,
|
||||
vecType<L, T, P> const& w, U d);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
@ -113,24 +113,24 @@ namespace glm
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vec<2, U, P> associatedMax(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b);
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> associatedMax(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> associatedMax(
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMax(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMax(
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
@ -142,27 +142,27 @@ namespace glm
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMax(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMax(
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> associatedMax(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b,
|
||||
T z, vecType<D, U, P> const & c);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> associatedMax(
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b,
|
||||
T z, vecType<L, U, P> const & c);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMax(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b,
|
||||
vecType<D, T, P> const & z, U c);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMax(
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b,
|
||||
vecType<L, T, P> const& z, U c);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
@ -175,30 +175,30 @@ namespace glm
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMax(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c,
|
||||
vecType<D, T, P> const & w, vecType<D, U, P> const & d);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMax(
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c,
|
||||
vecType<L, T, P> const& w, vecType<L, U, P> const & d);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMax(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b,
|
||||
T z, vecType<D, U, P> const & c,
|
||||
T w, vecType<D, U, P> const & d);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMax(
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b,
|
||||
T z, vecType<L, U, P> const & c,
|
||||
T w, vecType<L, U, P> const & d);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, U, P> associatedMax(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b,
|
||||
vecType<D, T, P> const & z, U c,
|
||||
vecType<D, T, P> const & w, U d);
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, U, P> associatedMax(
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b,
|
||||
vecType<L, T, P> const& z, U c,
|
||||
vecType<L, T, P> const& w, U d);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
@ -10,40 +10,40 @@ GLM_FUNC_QUALIFIER U associatedMin(T x, U a, T y, U b)
|
||||
return x < y ? a : b;
|
||||
}
|
||||
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vec<2, U, P> associatedMin
|
||||
(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] < y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMin
|
||||
(
|
||||
T x, const vecType<D, U, P>& a,
|
||||
T y, const vecType<D, U, P>& b
|
||||
T x, const vecType<L, U, P>& a,
|
||||
T y, const vecType<L, U, P>& b
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x < y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMin
|
||||
(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] < y[i] ? a : b;
|
||||
return Result;
|
||||
@ -62,15 +62,15 @@ GLM_FUNC_QUALIFIER U associatedMin
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMin
|
||||
(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
@ -95,16 +95,16 @@ GLM_FUNC_QUALIFIER U associatedMin
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMin
|
||||
(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c,
|
||||
vecType<D, T, P> const & w, vecType<D, U, P> const & d
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c,
|
||||
vecType<L, T, P> const& w, vecType<L, U, P> const & d
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
@ -117,19 +117,19 @@ GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMin
|
||||
(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b,
|
||||
T z, vecType<D, U, P> const & c,
|
||||
T w, vecType<D, U, P> const & d
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b,
|
||||
T z, vecType<L, U, P> const & c,
|
||||
T w, vecType<L, U, P> const & d
|
||||
)
|
||||
{
|
||||
T Test1 = min(x, y);
|
||||
T Test2 = min(z, w);
|
||||
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
{
|
||||
U Result1 = x < y ? a[i] : b[i];
|
||||
@ -140,16 +140,16 @@ GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMin
|
||||
(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b,
|
||||
vecType<D, T, P> const & z, U c,
|
||||
vecType<D, T, P> const & w, U d
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b,
|
||||
vecType<L, T, P> const& z, U c,
|
||||
vecType<L, T, P> const& w, U d
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
@ -169,42 +169,42 @@ GLM_FUNC_QUALIFIER U associatedMax(T x, U a, T y, U b)
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vec<2, U, P> associatedMax
|
||||
(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] > y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> associatedMax
|
||||
(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x > y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMax
|
||||
(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b
|
||||
)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] > y[i] ? a : b;
|
||||
return Result;
|
||||
@ -224,45 +224,45 @@ GLM_FUNC_QUALIFIER U associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMax
|
||||
(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> associatedMax
|
||||
(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b,
|
||||
T z, vecType<D, U, P> const & c
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b,
|
||||
T z, vecType<L, U, P> const & c
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMax
|
||||
(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b,
|
||||
vecType<D, T, P> const & z, U c
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b,
|
||||
vecType<L, T, P> const& z, U c
|
||||
)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
|
||||
return Result;
|
||||
@ -287,16 +287,16 @@ GLM_FUNC_QUALIFIER U associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMax
|
||||
(
|
||||
vecType<D, T, P> const & x, vecType<D, U, P> const & a,
|
||||
vecType<D, T, P> const & y, vecType<D, U, P> const & b,
|
||||
vecType<D, T, P> const & z, vecType<D, U, P> const & c,
|
||||
vecType<D, T, P> const & w, vecType<D, U, P> const & d
|
||||
vecType<L, T, P> const& x, vecType<L, U, P> const & a,
|
||||
vecType<L, T, P> const& y, vecType<L, U, P> const & b,
|
||||
vecType<L, T, P> const& z, vecType<L, U, P> const & c,
|
||||
vecType<L, T, P> const& w, vecType<L, U, P> const & d
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
@ -309,19 +309,19 @@ GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMax
|
||||
(
|
||||
T x, vecType<D, U, P> const & a,
|
||||
T y, vecType<D, U, P> const & b,
|
||||
T z, vecType<D, U, P> const & c,
|
||||
T w, vecType<D, U, P> const & d
|
||||
T x, vecType<L, U, P> const & a,
|
||||
T y, vecType<L, U, P> const & b,
|
||||
T z, vecType<L, U, P> const & c,
|
||||
T w, vecType<L, U, P> const & d
|
||||
)
|
||||
{
|
||||
T Test1 = max(x, y);
|
||||
T Test2 = max(z, w);
|
||||
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
{
|
||||
U Result1 = x > y ? a[i] : b[i];
|
||||
@ -332,16 +332,16 @@ GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
|
||||
template<length_t L, typename T, typename U, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, U, P> associatedMax
|
||||
(
|
||||
vecType<D, T, P> const & x, U a,
|
||||
vecType<D, T, P> const & y, U b,
|
||||
vecType<D, T, P> const & z, U c,
|
||||
vecType<D, T, P> const & w, U d
|
||||
vecType<L, T, P> const& x, U a,
|
||||
vecType<L, T, P> const& y, U b,
|
||||
vecType<L, T, P> const& z, U c,
|
||||
vecType<L, T, P> const& w, U d
|
||||
)
|
||||
{
|
||||
vecType<D, U, P> Result(uninitialize);
|
||||
vecType<L, U, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
|
@ -39,8 +39,8 @@ namespace glm
|
||||
/// Find the highest bit set to 1 in a integer variable and return its value.
|
||||
///
|
||||
/// @see gtx_bit
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> highestBitValue(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> highestBitValue(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is just higher the input value.
|
||||
/// Deprecated, use ceilPowerOfTwo from GTC_round instead
|
||||
@ -55,8 +55,8 @@ namespace glm
|
||||
///
|
||||
/// @see gtc_round
|
||||
/// @see gtx_bit
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_DEPRECATED GLM_FUNC_DECL vecType<D, T, P> powerOfTwoAbove(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_DEPRECATED GLM_FUNC_DECL vecType<L, T, P> powerOfTwoAbove(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is just lower the input value.
|
||||
/// Deprecated, use floorPowerOfTwo from GTC_round instead
|
||||
@ -71,8 +71,8 @@ namespace glm
|
||||
///
|
||||
/// @see gtc_round
|
||||
/// @see gtx_bit
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_DEPRECATED GLM_FUNC_DECL vecType<D, T, P> powerOfTwoBelow(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_DEPRECATED GLM_FUNC_DECL vecType<L, T, P> powerOfTwoBelow(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
/// Deprecated, use roundPowerOfTwo from GTC_round instead
|
||||
@ -87,8 +87,8 @@ namespace glm
|
||||
///
|
||||
/// @see gtc_round
|
||||
/// @see gtx_bit
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_DEPRECATED GLM_FUNC_DECL vecType<D, T, P> powerOfTwoNearest(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_DEPRECATED GLM_FUNC_DECL vecType<L, T, P> powerOfTwoNearest(vecType<L, T, P> const & value);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
@ -19,10 +19,10 @@ namespace glm
|
||||
return result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> highestBitValue(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> highestBitValue(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(highestBitValue, v);
|
||||
return detail::functor1<L, T, T, P>::call(highestBitValue, v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@ -34,10 +34,10 @@ namespace glm
|
||||
return (Value & (~Value + 1));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> lowestBitValue(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> lowestBitValue(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(lowestBitValue, v);
|
||||
return detail::functor1<L, T, T, P>::call(lowestBitValue, v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@ -49,10 +49,10 @@ namespace glm
|
||||
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> powerOfTwoAbove(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> powerOfTwoAbove(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(powerOfTwoAbove, v);
|
||||
return detail::functor1<L, T, T, P>::call(powerOfTwoAbove, v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@ -64,10 +64,10 @@ namespace glm
|
||||
return isPowerOfTwo(value) ? value : highestBitValue(value);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> powerOfTwoBelow(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> powerOfTwoBelow(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(powerOfTwoBelow, v);
|
||||
return detail::functor1<L, T, T, P>::call(powerOfTwoBelow, v);
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
@ -84,10 +84,10 @@ namespace glm
|
||||
return (next - value) < (value - prev) ? next : prev;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> powerOfTwoNearest(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> powerOfTwoNearest(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(powerOfTwoNearest, v);
|
||||
return detail::functor1<L, T, T, P>::call(powerOfTwoNearest, v);
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
@ -47,8 +47,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://stackoverflow.com/questions/7610631/glsl-mod-vs-hlsl-fmod">GLSL mod vs HLSL fmod</a>
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fmod(vecType<D, T, P> const & v);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fmod(vecType<L, T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -6,19 +6,19 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isFloat = true>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool isFloat = true>
|
||||
struct compute_fmod
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(std::fmod, a, b);
|
||||
return detail::functor2<L, T, P>::call(std::fmod, a, b);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_fmod<D, T, P, vecType, false>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_fmod<L, T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
|
||||
{
|
||||
return a % b;
|
||||
}
|
||||
@ -98,15 +98,15 @@ namespace detail
|
||||
return fmod(vec<1, genType>(x), y).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fmod(vecType<D, T, P> const & x, T y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fmod(vecType<L, T, P> const & x, T y)
|
||||
{
|
||||
return detail::compute_fmod<D, T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, vecType<D, T, P>(y));
|
||||
return detail::compute_fmod<L, T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, vecType<L, T, P>(y));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fmod(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fmod(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return detail::compute_fmod<D, T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, y);
|
||||
return detail::compute_fmod<L, T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, y);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -34,14 +34,14 @@ namespace glm
|
||||
/// Convert an integer vector to a normalized float vector.
|
||||
/// If the parameter value type is already a floating precision type, the value is passed through.
|
||||
/// @see gtx_component_wise
|
||||
template <typename floatType, int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, floatType, P> compNormalize(vecType<D, T, P> const & v);
|
||||
template<typename floatType, length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, floatType, P> compNormalize(vecType<L, T, P> const & v);
|
||||
|
||||
/// Convert a normalized float vector to an integer vector.
|
||||
/// If the parameter value type is already a floating precision type, the value is passed through.
|
||||
/// @see gtx_component_wise
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> compScale(vecType<D, floatType, P> const & v);
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> compScale(vecType<L, floatType, P> const & v);
|
||||
|
||||
/// Add all vector components together.
|
||||
/// @see gtx_component_wise
|
||||
|
@ -6,92 +6,92 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType, bool isInteger, bool signedType>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType, bool isInteger, bool signedType>
|
||||
struct compute_compNormalize
|
||||
{};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_compNormalize<D, T, floatType, P, vecType, true, true>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_compNormalize<L, T, floatType, P, vecType, true, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, floatType, P> call(vecType<D, T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, floatType, P> call(vecType<L, T, P> const & v)
|
||||
{
|
||||
floatType const Min = static_cast<floatType>(std::numeric_limits<T>::min());
|
||||
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max());
|
||||
return (vecType<D, floatType, P>(v) - Min) / (Max - Min) * static_cast<floatType>(2) - static_cast<floatType>(1);
|
||||
return (vecType<L, floatType, P>(v) - Min) / (Max - Min) * static_cast<floatType>(2) - static_cast<floatType>(1);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_compNormalize<D, T, floatType, P, vecType, true, false>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_compNormalize<L, T, floatType, P, vecType, true, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, floatType, P> call(vecType<D, T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, floatType, P> call(vecType<L, T, P> const & v)
|
||||
{
|
||||
return vecType<D, floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max());
|
||||
return vecType<L, floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max());
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_compNormalize<D, T, floatType, P, vecType, false, true>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_compNormalize<L, T, floatType, P, vecType, false, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, floatType, P> call(vecType<D, T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, floatType, P> call(vecType<L, T, P> const & v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType, bool isInteger, bool signedType>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType, bool isInteger, bool signedType>
|
||||
struct compute_compScale
|
||||
{};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_compScale<D, T, floatType, P, vecType, true, true>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_compScale<L, T, floatType, P, vecType, true, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, floatType, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, floatType, P> const & v)
|
||||
{
|
||||
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()) + static_cast<floatType>(0.5);
|
||||
vecType<D, floatType, P> const Scaled(v * Max);
|
||||
vecType<D, T, P> const Result(Scaled - static_cast<floatType>(0.5));
|
||||
vecType<L, floatType, P> const Scaled(v * Max);
|
||||
vecType<L, T, P> const Result(Scaled - static_cast<floatType>(0.5));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_compScale<D, T, floatType, P, vecType, true, false>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_compScale<L, T, floatType, P, vecType, true, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, floatType, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, floatType, P> const & v)
|
||||
{
|
||||
return vecType<D, T, P>(vecType<D, floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max()));
|
||||
return vecType<L, T, P>(vecType<L, floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max()));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_compScale<D, T, floatType, P, vecType, false, true>
|
||||
template<length_t L, typename T, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_compScale<L, T, floatType, P, vecType, false, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, floatType, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, floatType, P> const & v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template <typename floatType, int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, floatType, P> compNormalize(vecType<D, T, P> const & v)
|
||||
template<typename floatType, length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, floatType, P> compNormalize(vecType<L, T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter");
|
||||
|
||||
return detail::compute_compNormalize<D, T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
|
||||
return detail::compute_compNormalize<L, T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
|
||||
}
|
||||
|
||||
template <typename T, int D, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> compScale(vecType<D, floatType, P> const & v)
|
||||
template<typename T, length_t L, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> compScale(vecType<L, floatType, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter");
|
||||
|
||||
return detail::compute_compScale<D, T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
|
||||
return detail::compute_compScale<L, T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compAdd(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compAdd(vecType<L, T, P> const & v)
|
||||
{
|
||||
T Result(0);
|
||||
for(length_t i = 0, n = v.length(); i < n; ++i)
|
||||
@ -99,8 +99,8 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compMul(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compMul(vecType<L, T, P> const & v)
|
||||
{
|
||||
T Result(1);
|
||||
for(length_t i = 0, n = v.length(); i < n; ++i)
|
||||
@ -108,8 +108,8 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compMin(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compMin(vecType<L, T, P> const & v)
|
||||
{
|
||||
T Result(v[0]);
|
||||
for(length_t i = 1, n = v.length(); i < n; ++i)
|
||||
@ -117,8 +117,8 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compMax(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T compMax(vecType<L, T, P> const & v)
|
||||
{
|
||||
T Result(v[0]);
|
||||
for(length_t i = 1, n = v.length(); i < n; ++i)
|
||||
|
@ -36,8 +36,8 @@ namespace glm
|
||||
|
||||
/// Faster than the common pow function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastPow(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastPow(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Faster than the common pow function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
@ -46,8 +46,8 @@ namespace glm
|
||||
|
||||
/// Faster than the common pow function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastPow(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastPow(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common exp function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
@ -56,8 +56,8 @@ namespace glm
|
||||
|
||||
/// Faster than the common exp function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastExp(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastExp(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common log function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
@ -66,8 +66,8 @@ namespace glm
|
||||
|
||||
/// Faster than the common exp2 function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastLog(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastLog(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common exp2 function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
@ -76,8 +76,8 @@ namespace glm
|
||||
|
||||
/// Faster than the common exp2 function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastExp2(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastExp2(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common log2 function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
@ -86,8 +86,8 @@ namespace glm
|
||||
|
||||
/// Faster than the common log2 function but less accurate.
|
||||
/// @see gtx_fast_exponential
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastLog2(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastLog2(vecType<L, T, P> const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -10,8 +10,8 @@ namespace glm
|
||||
return exp(y * log(x));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastPow(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastPow(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return exp(y * log(x));
|
||||
}
|
||||
@ -25,10 +25,10 @@ namespace glm
|
||||
return f;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastPow(vecType<D, T, P> const & x, vecType<D, int, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastPow(vecType<L, T, P> const & x, vecType<L, int, P> const & y)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = x.length(); i < n; ++i)
|
||||
Result[i] = fastPow(x[i], y[i]);
|
||||
return Result;
|
||||
@ -81,10 +81,10 @@ namespace glm
|
||||
}
|
||||
*/
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastExp(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastExp(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastExp, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastExp, x);
|
||||
}
|
||||
|
||||
// fastLog
|
||||
@ -103,10 +103,10 @@ namespace glm
|
||||
}
|
||||
*/
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastLog(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastLog(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastLog, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastLog, x);
|
||||
}
|
||||
|
||||
//fastExp2, ln2 = 0.69314718055994530941723212145818f
|
||||
@ -116,10 +116,10 @@ namespace glm
|
||||
return fastExp(0.69314718055994530941723212145818f * x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastExp2(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastExp2(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastExp2, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastExp2, x);
|
||||
}
|
||||
|
||||
// fastLog2, ln2 = 0.69314718055994530941723212145818f
|
||||
@ -129,9 +129,9 @@ namespace glm
|
||||
return fastLog(x) / 0.69314718055994530941723212145818f;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastLog2(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastLog2(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastLog2, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastLog2, x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -41,8 +41,8 @@ namespace glm
|
||||
/// Faster than the common sqrt function but less accurate.
|
||||
///
|
||||
/// @see gtx_fast_square_root extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastSqrt(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastSqrt(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common inversesqrt function but less accurate.
|
||||
///
|
||||
@ -53,8 +53,8 @@ namespace glm
|
||||
/// Faster than the common inversesqrt function but less accurate.
|
||||
///
|
||||
/// @see gtx_fast_square_root extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> fastInverseSqrt(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> fastInverseSqrt(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common length function but less accurate.
|
||||
///
|
||||
@ -65,8 +65,8 @@ namespace glm
|
||||
/// Faster than the common length function but less accurate.
|
||||
///
|
||||
/// @see gtx_fast_square_root extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T fastLength(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T fastLength(vecType<L, T, P> const & x);
|
||||
|
||||
/// Faster than the common distance function but less accurate.
|
||||
///
|
||||
@ -77,8 +77,8 @@ namespace glm
|
||||
/// Faster than the common distance function but less accurate.
|
||||
///
|
||||
/// @see gtx_fast_square_root extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T fastDistance(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T fastDistance(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// Faster than the common normalize function but less accurate.
|
||||
///
|
||||
|
@ -12,10 +12,10 @@ namespace glm
|
||||
return genType(1) / fastInverseSqrt(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastSqrt(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastSqrt(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastSqrt, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastSqrt, x);
|
||||
}
|
||||
|
||||
// fastInversesqrt
|
||||
@ -30,10 +30,10 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastInverseSqrt(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastInverseSqrt(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::compute_inversesqrt<D, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
return detail::compute_inversesqrt<L, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// fastLength
|
||||
@ -45,8 +45,8 @@ namespace glm
|
||||
return abs(x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T fastLength(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T fastLength(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fastLength' only accept floating-point inputs");
|
||||
|
||||
@ -60,8 +60,8 @@ namespace glm
|
||||
return fastLength(y - x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T fastDistance(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T fastDistance(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return fastLength(y - x);
|
||||
}
|
||||
@ -73,8 +73,8 @@ namespace glm
|
||||
return x > genType(0) ? genType(1) : -genType(1);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastNormalize(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastNormalize(vecType<L, T, P> const & x)
|
||||
{
|
||||
return x * fastInverseSqrt(dot(x, x));
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorCos(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
return static_cast<T>(1)
|
||||
- (x * x) * (1.f / 2.f)
|
||||
@ -21,10 +21,10 @@ namespace detail
|
||||
return (T(0.9999932946) + xx * (T(-0.4999124376) + xx * (T(0.0414877472) + xx * T(-0.0012712095))));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> cos_52s(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> cos_52s(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(cos_52s, x);
|
||||
return detail::functor1<L, T, T, P>::call(cos_52s, x);
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
@ -35,10 +35,10 @@ namespace detail
|
||||
return abs<T>(mod<T>(angle, two_pi<T>()));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> wrapAngle(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> wrapAngle(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(wrapAngle, x);
|
||||
return detail::functor1<L, T, T, P>::call(wrapAngle, x);
|
||||
}
|
||||
|
||||
// cos
|
||||
@ -57,10 +57,10 @@ namespace detail
|
||||
return detail::cos_52s(two_pi<T>() - angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastCos(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastCos, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastCos, x);
|
||||
}
|
||||
|
||||
// sin
|
||||
@ -70,10 +70,10 @@ namespace detail
|
||||
return fastCos<T>(half_pi<T>() - x);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastSin(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastSin(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastSin, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastSin, x);
|
||||
}
|
||||
|
||||
// tan
|
||||
@ -83,10 +83,10 @@ namespace detail
|
||||
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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastTan(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastTan(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastTan, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastTan, x);
|
||||
}
|
||||
|
||||
// asin
|
||||
@ -96,10 +96,10 @@ namespace detail
|
||||
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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastAsin(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastAsin(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastAsin, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastAsin, x);
|
||||
}
|
||||
|
||||
// acos
|
||||
@ -109,10 +109,10 @@ namespace detail
|
||||
return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastAcos(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastAcos(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastAcos, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastAcos, x);
|
||||
}
|
||||
|
||||
// atan
|
||||
@ -123,10 +123,10 @@ namespace detail
|
||||
return abs(fastAtan(y / x)) * sgn;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastAtan(vecType<D, T, P> const & y, vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastAtan(vecType<L, T, P> const & y, vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(fastAtan, y, x);
|
||||
return detail::functor2<L, T, P>::call(fastAtan, y, x);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -135,9 +135,9 @@ namespace detail
|
||||
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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastAtan(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastAtan(vecType<L, T, P> const & x)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(fastAtan, x);
|
||||
return detail::functor1<L, T, T, P>::call(fastAtan, x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> floatNormalize(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> floatNormalize(vecType<L, T, P> const & v)
|
||||
{
|
||||
return vecType<D, float, P>(v) / static_cast<float>(std::numeric_limits<T>::max());
|
||||
return vecType<L, float, P>(v) / static_cast<float>(std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
@ -37,10 +37,10 @@ namespace glm
|
||||
|
||||
/// Logarithm for any base.
|
||||
/// From GLM_GTX_log_base.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> sign(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & base);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> sign(
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& base);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -10,8 +10,8 @@ namespace glm
|
||||
return glm::log(x) / glm::log(base);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> log(vecType<D, T, P> const & x, vecType<D, T, P> const & base)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> log(vecType<L, T, P> const & x, vecType<L, T, P> const & base)
|
||||
{
|
||||
return glm::log(x) / glm::log(base);
|
||||
}
|
||||
|
@ -32,16 +32,16 @@ namespace glm
|
||||
|
||||
/// Returns the squared length of x.
|
||||
/// From GLM_GTX_norm extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T length2(
|
||||
vecType<D, T, P> const & x);
|
||||
vecType<L, T, P> const& x);
|
||||
|
||||
/// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
|
||||
/// From GLM_GTX_norm extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T distance2(
|
||||
vecType<D, T, P> const & p0,
|
||||
vecType<D, T, P> const & p1);
|
||||
vecType<L, T, P> const& p0,
|
||||
vecType<L, T, P> const& p1);
|
||||
|
||||
//! Returns the L1 norm between x and y.
|
||||
//! From GLM_GTX_norm extension.
|
||||
|
@ -6,10 +6,10 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <template <int, typename, precision> class vecType, int D, typename T, precision P, bool Aligned>
|
||||
template<template<length_t, typename, precision> class vecType, length_t L, typename T, precision P, bool Aligned>
|
||||
struct compute_length2
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<D, T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<L, T, P> const & v)
|
||||
{
|
||||
return dot(v, v);
|
||||
}
|
||||
@ -23,11 +23,11 @@ namespace detail
|
||||
return x * x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T length2(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T length2(vecType<L, T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length2' accepts only floating-point inputs");
|
||||
return detail::compute_length2<vecType, D, T, P, detail::is_aligned<P>::value>::call(v);
|
||||
return detail::compute_length2<vecType, L, T, P, detail::is_aligned<P>::value>::call(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -37,8 +37,8 @@ namespace detail
|
||||
return length2(p1 - p0);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance2(vecType<D, T, P> const & p0, vecType<D, T, P> const & p1)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance2(vecType<L, T, P> const & p0, vecType<L, T, P> const & p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs");
|
||||
return length2(p1 - p0);
|
||||
|
@ -33,15 +33,15 @@ namespace glm
|
||||
/// It's faster that dot(normalize(x), normalize(y)).
|
||||
///
|
||||
/// @see gtx_normalize_dot extension.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T normalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T normalizeDot(vecType<L, T, P> const & x, vecType<L, T, P> 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T fastNormalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T fastNormalizeDot(vecType<L, T, P> const & x, vecType<L, T, P> const & y);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
@ -3,14 +3,14 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T normalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T normalizeDot(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
@ -52,15 +52,15 @@ namespace glm
|
||||
static length_t const rows = 0;
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P>
|
||||
struct type<vec<D, T, P>>
|
||||
template<length_t L, typename T, precision P>
|
||||
struct type<vec<L, T, P> >
|
||||
{
|
||||
static bool const is_vec = true;
|
||||
static bool const is_mat = false;
|
||||
static bool const is_quat = false;
|
||||
enum
|
||||
{
|
||||
components = D
|
||||
components = L
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -14,11 +14,11 @@ namespace glm
|
||||
return acos(clamp(dot(x, y), genType(-1), genType(1)));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T angle
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
|
||||
|
@ -32,33 +32,33 @@ namespace glm
|
||||
|
||||
//! Check whether two vectors are collinears.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areCollinear(vecType<D, T, P> const & v0, vecType<D, T, P> const & v1, T const & epsilon);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areCollinear(vecType<L, T, P> const & v0, vecType<L, T, P> const & v1, T const & epsilon);
|
||||
|
||||
//! Check whether two vectors are orthogonals.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areOrthogonal(vecType<D, T, P> const & v0, vecType<D, T, P> const & v1, T const & epsilon);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areOrthogonal(vecType<L, T, P> const & v0, vecType<L, T, P> const & v1, T const & epsilon);
|
||||
|
||||
//! Check whether a vector is normalized.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool isNormalized(vecType<D, T, P> const & v, T const & epsilon);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool isNormalized(vecType<L, T, P> const & v, T const & epsilon);
|
||||
|
||||
//! Check whether a vector is null.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool isNull(vecType<D, T, P> const & v, T const & epsilon);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool isNull(vecType<L, T, P> const & v, T const & epsilon);
|
||||
|
||||
//! Check whether a each component of a vector is null.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isCompNull(vecType<D, T, P> const & v, T const & epsilon);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isCompNull(vecType<L, T, P> const & v, T const & epsilon);
|
||||
|
||||
//! Check whether two vectors are orthonormal.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areOrthonormal(vecType<D, T, P> const & v0, vecType<D, T, P> const & v1, T const & epsilon);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areOrthonormal(vecType<L, T, P> const & v0, vecType<L, T, P> const & v1, T const & epsilon);
|
||||
|
||||
/// @}
|
||||
}// namespace glm
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_areCollinear{};
|
||||
|
||||
template<typename T, precision P>
|
||||
@ -36,7 +36,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_isCompNull{};
|
||||
|
||||
template<typename T, precision P>
|
||||
@ -77,24 +77,24 @@ namespace detail
|
||||
|
||||
}//namespace detail
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool areCollinear
|
||||
(
|
||||
vecType<D, T, P> const & v0,
|
||||
vecType<D, T, P> const & v1,
|
||||
vecType<L, T, P> const& v0,
|
||||
vecType<L, T, P> const& v1,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'areCollinear' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_areCollinear<D, T, P, vecType>::call(v0, v1, epsilon);
|
||||
return detail::compute_areCollinear<L, T, P, vecType>::call(v0, v1, epsilon);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool areOrthogonal
|
||||
(
|
||||
vecType<D, T, P> const & v0,
|
||||
vecType<D, T, P> const & v1,
|
||||
vecType<L, T, P> const& v0,
|
||||
vecType<L, T, P> const& v1,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
@ -105,10 +105,10 @@ namespace detail
|
||||
length(v0)) * max(static_cast<T>(1), length(v1)) * epsilon;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool isNormalized
|
||||
(
|
||||
vecType<D, T, P> const & v,
|
||||
vecType<L, T, P> const& v,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
@ -117,10 +117,10 @@ namespace detail
|
||||
return abs(length(v) - static_cast<T>(1)) <= static_cast<T>(2) * epsilon;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool isNull
|
||||
(
|
||||
vecType<D, T, P> const & v,
|
||||
vecType<L, T, P> const& v,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
@ -129,16 +129,16 @@ namespace detail
|
||||
return length(v) <= epsilon;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isCompNull
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isCompNull
|
||||
(
|
||||
vecType<D, T, P> const & v,
|
||||
vecType<L, T, P> const& v,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isCompNull' only accept floating-point inputs");
|
||||
|
||||
return detail::compute_isCompNull<D, T, P, vecType>::call(v, epsilon);
|
||||
return detail::compute_isCompNull<L, T, P, vecType>::call(v, epsilon);
|
||||
}
|
||||
|
||||
template<typename T, precision P>
|
||||
@ -179,11 +179,11 @@ namespace detail
|
||||
abs(v.w) < epsilon);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool areOrthonormal
|
||||
(
|
||||
vecType<D, T, P> const & v0,
|
||||
vecType<D, T, P> const & v1,
|
||||
vecType<L, T, P> const& v0,
|
||||
vecType<L, T, P> const& v1,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> clamp(vecType<D, T, P> const& Texcoord)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> clamp(vecType<L, T, P> const& Texcoord)
|
||||
{
|
||||
return glm::clamp(Texcoord, vecType<D, T, P>(0), vecType<D, T, P>(1));
|
||||
return glm::clamp(Texcoord, vecType<L, T, P>(0), vecType<L, T, P>(1));
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
@ -15,8 +15,8 @@ namespace glm
|
||||
return clamp(vec<1, genType, defaultp>(Texcoord)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> repeat(vecType<D, T, P> const& Texcoord)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> repeat(vecType<L, T, P> const& Texcoord)
|
||||
{
|
||||
return glm::fract(Texcoord);
|
||||
}
|
||||
@ -27,8 +27,8 @@ namespace glm
|
||||
return repeat(vec<1, genType, defaultp>(Texcoord)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> mirrorClamp(vecType<D, T, P> const& Texcoord)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> mirrorClamp(vecType<L, T, P> const& Texcoord)
|
||||
{
|
||||
return glm::fract(glm::abs(Texcoord));
|
||||
}
|
||||
@ -39,15 +39,15 @@ namespace glm
|
||||
return mirrorClamp(vec<1, genType, defaultp>(Texcoord)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> mirrorRepeat(vecType<D, T, P> const& Texcoord)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> mirrorRepeat(vecType<L, T, P> const& Texcoord)
|
||||
{
|
||||
vecType<D, T, P> const Abs = glm::abs(Texcoord);
|
||||
vecType<D, T, P> const Clamp = glm::mod(glm::floor(Abs), vecType<D, T, P>(2));
|
||||
vecType<D, T, P> const Floor = glm::floor(Abs);
|
||||
vecType<D, T, P> const Rest = Abs - Floor;
|
||||
vecType<D, T, P> const Mirror = Clamp + Rest;
|
||||
return mix(Rest, vecType<D, T, P>(1) - Rest, glm::greaterThanEqual(Mirror, vecType<D, T, P>(1)));
|
||||
vecType<L, T, P> const Abs = glm::abs(Texcoord);
|
||||
vecType<L, T, P> const Clamp = glm::mod(glm::floor(Abs), vecType<L, T, P>(2));
|
||||
vecType<L, T, P> const Floor = glm::floor(Abs);
|
||||
vecType<L, T, P> const Rest = Abs - Floor;
|
||||
vecType<L, T, P> const Mirror = Clamp + Rest;
|
||||
return mix(Rest, vecType<L, T, P>(1) - Rest, glm::greaterThanEqual(Mirror, vecType<L, T, P>(1)));
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
|
@ -151,17 +151,17 @@ namespace bitfieldReverse
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverseLoop(vecType<D, T, P> const & v)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverseLoop(vecType<L, T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldReverse' only accept integer values");
|
||||
|
||||
vecType<D, T, P> Result(0);
|
||||
vecType<L, T, P> Result(0);
|
||||
T const BitSize = static_cast<T>(sizeof(T) * 8);
|
||||
for(T i = 0; i < BitSize; ++i)
|
||||
{
|
||||
vecType<D, T, P> const BitSet(v & (static_cast<T>(1) << i));
|
||||
vecType<D, T, P> const BitFirst(BitSet >> i);
|
||||
vecType<L, T, P> const BitSet(v & (static_cast<T>(1) << i));
|
||||
vecType<L, T, P> const BitFirst(BitSet >> i);
|
||||
Result |= BitFirst << (BitSize - 1 - i);
|
||||
}
|
||||
return Result;
|
||||
@ -197,8 +197,8 @@ namespace bitfieldReverse
|
||||
template<bool EXEC = false>
|
||||
struct compute_bitfieldReverseStep
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
@ -207,17 +207,17 @@ namespace bitfieldReverse
|
||||
template<>
|
||||
struct compute_bitfieldReverseStep<true>
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverseOps(vecType<D, T, P> const & v)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverseOps(vecType<L, T, P> const & v)
|
||||
{
|
||||
vecType<D, T, P> x(v);
|
||||
vecType<L, T, P> x(v);
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
@ -1407,8 +1407,8 @@ namespace bitCount
|
||||
template<bool EXEC = false>
|
||||
struct compute_bitfieldBitCountStep
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
@ -1417,24 +1417,24 @@ namespace bitCount
|
||||
template<>
|
||||
struct compute_bitfieldBitCountStep<true>
|
||||
{
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) + ((v >> Shift) & Mask);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> bitCount_bitfield(vecType<D, T, P> const & v)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> bitCount_bitfield(vecType<L, T, P> const & v)
|
||||
{
|
||||
vecType<D, typename glm::detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<D, typename glm::detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
vecType<L, typename glm::detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<L, typename glm::detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename glm::detail::make_unsigned<T>::type(0x5555555555555555ull), typename glm::detail::make_unsigned<T>::type( 1));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename glm::detail::make_unsigned<T>::type(0x3333333333333333ull), typename glm::detail::make_unsigned<T>::type( 2));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename glm::detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename glm::detail::make_unsigned<T>::type( 4));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename glm::detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename glm::detail::make_unsigned<T>::type( 8));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename glm::detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename glm::detail::make_unsigned<T>::type(16));
|
||||
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename glm::detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename glm::detail::make_unsigned<T>::type(32));
|
||||
return vecType<D, int, P>(x);
|
||||
return vecType<L, int, P>(x);
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
|
@ -177,13 +177,13 @@ namespace taylorCos
|
||||
|
||||
glm::vec4 const AngleShift(0.0f, glm::pi<float>() * 0.5f, glm::pi<float>() * 1.0f, glm::pi<float>() * 1.5f);
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesNewCos(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorSeriesNewCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Powed2(x * x);
|
||||
vecType<D, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<D, T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<D, T, P> const Powed8(Powed4 * Powed4);
|
||||
vecType<L, T, P> const Powed2(x * x);
|
||||
vecType<L, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<L, T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<L, T, P> const Powed8(Powed4 * Powed4);
|
||||
|
||||
return static_cast<T>(1)
|
||||
- Powed2 * static_cast<T>(0.5)
|
||||
@ -192,12 +192,12 @@ namespace taylorCos
|
||||
+ Powed8 * static_cast<T>(2.4801587301587301587301587301587e-5);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesNewCos6(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorSeriesNewCos6(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Powed2(x * x);
|
||||
vecType<D, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<D, T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<L, T, P> const Powed2(x * x);
|
||||
vecType<L, T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<L, T, P> const Powed6(Powed4 * Powed2);
|
||||
|
||||
return static_cast<T>(1)
|
||||
- Powed2 * static_cast<T>(0.5)
|
||||
@ -205,8 +205,8 @@ namespace taylorCos
|
||||
- Powed6 * static_cast<T>(0.00138888888888888888888888888889);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> fastAbs(vecType<D, float, P> x)
|
||||
template<glm::length_t L, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> fastAbs(vecType<L, float, P> x)
|
||||
{
|
||||
int* Pointer = reinterpret_cast<int*>(&x[0]);
|
||||
Pointer[0] &= 0x7fffffff;
|
||||
@ -216,17 +216,17 @@ namespace taylorCos
|
||||
return x;
|
||||
}
|
||||
|
||||
template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastCosNew(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastCosNew(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<L, T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
return taylorSeriesNewCos6(x);
|
||||
/*
|
||||
vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
|
||||
vecType<L, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<L, T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
|
||||
vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
|
||||
vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
vecType<L, T, P> const RevertAngle(mix(vecType<L, T, P>(glm::pi<T>()), vecType<L, T, P>(0), FirstQuarterPi));
|
||||
vecType<L, T, P> const ReturnSign(mix(vecType<L, T, P>(-1), vecType<L, T, P>(1), FirstQuarterPi));
|
||||
vecType<L, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesNewCos(SectionAngle);
|
||||
*/
|
||||
@ -254,21 +254,21 @@ namespace taylorCos
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> deterministic_fmod(vecType<D, T, P> const & x, T y)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> deterministic_fmod(vecType<L, T, P> const & x, T y)
|
||||
{
|
||||
return x - y * trunc(x / y);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastCosDeterminisctic(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastCosDeterminisctic(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
|
||||
vecType<L, T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<L, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<L, T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
|
||||
vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
|
||||
vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
vecType<L, T, P> const RevertAngle(mix(vecType<L, T, P>(glm::pi<T>()), vecType<L, T, P>(0), FirstQuarterPi));
|
||||
vecType<L, T, P> const ReturnSign(mix(vecType<L, T, P>(-1), vecType<L, T, P>(1), FirstQuarterPi));
|
||||
vecType<L, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesNewCos(SectionAngle);
|
||||
}
|
||||
@ -295,8 +295,8 @@ namespace taylorCos
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesRefCos(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorSeriesRefCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
return static_cast<T>(1)
|
||||
- (x * x) / glm::factorial(static_cast<T>(2))
|
||||
@ -305,17 +305,17 @@ namespace taylorCos
|
||||
+ (x * x * x * x * x * x * x * x) / glm::factorial(static_cast<T>(8));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> fastRefCos(vecType<D, T, P> const & x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> fastRefCos(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<L, T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
// return taylorSeriesRefCos(Angle0_PI);
|
||||
|
||||
vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
|
||||
vecType<L, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<L, T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
|
||||
vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
|
||||
vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
vecType<L, T, P> const RevertAngle(mix(vecType<L, T, P>(glm::pi<T>()), vecType<L, T, P>(0), FirstQuarterPi));
|
||||
vecType<L, T, P> const ReturnSign(mix(vecType<L, T, P>(-1), vecType<L, T, P>(1), FirstQuarterPi));
|
||||
vecType<L, T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesRefCos(SectionAngle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user