parameterize number of dimensions of vector in tvec<D, T, P>

- specializes for 1, 2, 3 and 4-dimensional vector types
  which are then aliased as tvec1, tvec2, tvec3 and tvec4
- requires C++11 aliases; breaks compatability with C++03
- tested on:
  - clang-3.5.2, clang-3.8.0
  - gcc 4.8.5, gcc 5.4.1, gcc 6.2.0

TODO:
- still uses template template parameters - most can probably be removed
- some definitions might now be de-duplicated
This commit is contained in:
John McFarlane 2016-12-28 16:59:01 -08:00
parent 06f084063f
commit 506a487d24
94 changed files with 3453 additions and 3484 deletions

View File

@ -42,7 +42,7 @@ namespace detail
} }
/* /*
template <typename T, precision P, template<typename> class vecType> template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> permute(vecType<D, T, P> const & x)
{ {
return mod289(((x * T(34)) + T(1)) * x); return mod289(((x * T(34)) + T(1)) * x);
} }
@ -72,7 +72,7 @@ namespace detail
} }
/* /*
template <typename T, precision P, template<typename> class vecType> template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r) GLM_FUNC_QUALIFIER vecType<D, T, P> taylorInvSqrt(vecType<D, T, P> const & r)
{ {
return T(1.79284291400159) - T(0.85373472095314) * r; return T(1.79284291400159) - T(0.85373472095314) * r;
} }
@ -97,7 +97,7 @@ namespace detail
} }
/* /*
template <typename T, precision P, template <typename> class vecType> template <typename T, precision P, template <typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t) GLM_FUNC_QUALIFIER vecType<D, T, P> fade(vecType<D, T, P> const & t)
{ {
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
} }

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename R, typename T, precision P, template <typename, precision> class vecType> template <int D, typename R, typename T, precision P>
struct functor1{}; struct functor1{};
template <typename R, typename T, precision P> template <typename R, typename T, precision P>
struct functor1<R, T, P, tvec1> struct functor1<1, R, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec1<R, P> call(R (*Func) (T x), tvec1<T, P> const & v) GLM_FUNC_QUALIFIER static tvec1<R, P> call(R (*Func) (T x), tvec1<T, P> const & v)
{ {
@ -24,7 +24,7 @@ namespace detail
}; };
template <typename R, typename T, precision P> template <typename R, typename T, precision P>
struct functor1<R, T, P, tvec2> struct functor1<2, R, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v) GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v)
{ {
@ -33,7 +33,7 @@ namespace detail
}; };
template <typename R, typename T, precision P> template <typename R, typename T, precision P>
struct functor1<R, T, P, tvec3> struct functor1<3, R, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec3<R, P> call(R (*Func) (T x), tvec3<T, P> const & v) GLM_FUNC_QUALIFIER static tvec3<R, P> call(R (*Func) (T x), tvec3<T, P> const & v)
{ {
@ -42,7 +42,7 @@ namespace detail
}; };
template <typename R, typename T, precision P> template <typename R, typename T, precision P>
struct functor1<R, T, P, tvec4> struct functor1<4, R, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v) GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v)
{ {
@ -50,11 +50,11 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P>
struct functor2{}; struct functor2{};
template <typename T, precision P> template <typename T, precision P>
struct functor2<T, P, tvec1> struct functor2<1, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, tvec1<T, P> const & b) GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, tvec1<T, P> const & b)
{ {
@ -63,7 +63,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct functor2<T, P, tvec2> struct functor2<2, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, tvec2<T, P> const & b) GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, tvec2<T, P> const & b)
{ {
@ -72,7 +72,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct functor2<T, P, tvec3> struct functor2<3, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, tvec3<T, P> const & b) GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, tvec3<T, P> const & b)
{ {
@ -81,7 +81,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct functor2<T, P, tvec4> struct functor2<4, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, tvec4<T, P> const & b) GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, tvec4<T, P> const & b)
{ {
@ -89,11 +89,11 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P>
struct functor2_vec_sca{}; struct functor2_vec_sca{};
template <typename T, precision P> template <typename T, precision P>
struct functor2_vec_sca<T, P, tvec1> struct functor2_vec_sca<1, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, T b) GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, T b)
{ {
@ -102,7 +102,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct functor2_vec_sca<T, P, tvec2> struct functor2_vec_sca<2, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, T b) GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, T b)
{ {
@ -111,7 +111,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct functor2_vec_sca<T, P, tvec3> struct functor2_vec_sca<3, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, T b) GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, T b)
{ {
@ -120,7 +120,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct functor2_vec_sca<T, P, tvec4> struct functor2_vec_sca<4, T, P>
{ {
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, T b) GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, T b)
{ {

View File

@ -167,7 +167,7 @@ glm::vec3 lighting
/* /*
template <typename T, glm::precision P, template<typename, glm::precision> class vecType> template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y) T normalizeDotA(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
} }
@ -175,7 +175,7 @@ T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class #define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
template <GLM_TEMPLATE_GENTYPE vecType> template <GLM_TEMPLATE_GENTYPE vecType>
T normalizeDotB(vecType<T, P> const & x, vecType<T, P> const & y) T normalizeDotB(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
} }

View File

@ -29,8 +29,8 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType abs(genType x); GLM_FUNC_DECL genType abs(genType x);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> abs(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> abs(vecType<D, T, P> const & x);
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sign(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> sign(vecType<D, T, P> const & x);
/// Returns a value equal to the nearest integer that is less then or equal to 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> floor(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> floor(vecType<D, T, P> const & x);
/// Returns a value equal to the nearest integer to x /// Returns a value equal to the nearest integer to x
/// whose absolute value is not larger than the absolute value of 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> trunc(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> trunc(vecType<D, T, P> const & x);
/// Returns a value equal to the nearest integer to x. /// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> round(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> round(vecType<D, T, P> const & x);
/// Returns a value equal to the nearest integer to x. /// Returns a value equal to the nearest integer to x.
/// A fractional part of 0.5 will round toward the nearest even /// 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/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://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> /// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> roundEven(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> roundEven(vecType<D, T, P> const & x);
/// Returns a value equal to the nearest integer /// Returns a value equal to the nearest integer
/// that is greater than or equal to x. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> ceil(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> ceil(vecType<D, T, P> const & x);
/// Return x - floor(x). /// Return x - floor(x).
/// ///
@ -104,8 +104,8 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType fract(genType x); GLM_FUNC_DECL genType fract(genType x);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fract(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fract(vecType<D, T, P> const & x);
/// Modulus. Returns x - y * floor(x / y) /// Modulus. Returns x - y * floor(x / y)
/// for each component in x using the floating point value y. /// for each component in x using the floating point value y.
@ -117,11 +117,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType mod(genType x, genType y); GLM_FUNC_DECL genType mod(genType x, genType y);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, T y); GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, T y);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns the fractional part of x and sets i to the integer /// Returns the fractional part of x and sets i to the integer
/// part (as a whole number floating point value). Both the /// part (as a whole number floating point value). Both the
@ -144,11 +144,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType min(genType x, genType y); GLM_FUNC_DECL genType min(genType x, genType y);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> min(vecType<T, P> const & x, T y); GLM_FUNC_DECL vecType<D, T, P> min(vecType<D, T, P> const & x, T y);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> min(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, T, P> min(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns y if x < y; otherwise, it returns x. /// Returns y if x < y; otherwise, it returns x.
/// ///
@ -159,11 +159,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType max(genType x, genType y); GLM_FUNC_DECL genType max(genType x, genType y);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> max(vecType<T, P> const & x, T y); GLM_FUNC_DECL vecType<D, T, P> max(vecType<D, T, P> const & x, T y);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> max(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, T, P> max(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns min(max(x, minVal), maxVal) for each component in x /// Returns min(max(x, minVal), maxVal) for each component in x
/// using the floating-point values minVal and maxVal. /// using the floating-point values minVal and maxVal.
@ -175,11 +175,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal); GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal); GLM_FUNC_DECL vecType<D, T, P> clamp(vecType<D, T, P> const & x, T minVal, T maxVal);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal); 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);
/// If genTypeU is a floating scalar or vector: /// If genTypeU is a floating scalar or vector:
/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of /// 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::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. /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
/// @endcode /// @endcode
template <typename T, typename U, precision P, template <typename, precision> class vecType> template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a); 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 <typename T, typename U, precision P, template <typename, precision> class vecType> template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a); GLM_FUNC_DECL vecType<D, T, P> mix(vecType<D, T, P> const & x, vecType<D, T, P> const & y, U a);
template <typename genTypeT, typename genTypeU> template <typename genTypeT, typename genTypeU>
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a); 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/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> /// @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 <typename, precision> class vecType, typename T, precision P> template <template <int, typename, precision> class vecType, int D, typename T, precision P>
GLM_FUNC_DECL vecType<T, P> step(T edge, vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> step(T edge, vecType<D, T, P> const & x);
/// Returns 0.0 if x < edge, otherwise it returns 1.0. /// 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/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> /// @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 <typename, precision> class vecType, typename T, precision P> template <template <int, typename, precision> class vecType, int D, typename T, precision P>
GLM_FUNC_DECL vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> step(vecType<D, T, P> const & edge, vecType<D, T, P> const & x);
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and /// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
/// performs smooth Hermite interpolation between 0 and 1 /// performs smooth Hermite interpolation between 0 and 1
@ -270,11 +270,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x); GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> smoothstep(T edge0, T edge1, vecType<D, T, P> const & x);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x); 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);
/// Returns true if x holds a NaN (not a number) /// Returns true if x holds a NaN (not a number)
/// representation in the underlying implementation's set of /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> isnan(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, bool, P> isnan(vecType<D, T, P> const & x);
/// Returns true if x holds a positive infinity or negative /// Returns true if x holds a positive infinity or negative
/// infinity representation in the underlying implementation's /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> isinf(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, bool, P> isinf(vecType<D, T, P> const & x);
/// Returns a signed integer value representing /// Returns a signed integer value representing
/// the encoding of a floating-point value. The floating-point /// 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/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> /// @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 <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_DECL vecType<int, P> floatBitsToInt(vecType<float, P> const & v); GLM_FUNC_DECL vecType<D, int, P> floatBitsToInt(vecType<D, float, P> const & v);
/// Returns a unsigned integer value representing /// Returns a unsigned integer value representing
/// the encoding of a floating-point value. The floatingpoint /// 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/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> /// @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 <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_DECL vecType<uint, P> floatBitsToUint(vecType<float, P> const & v); GLM_FUNC_DECL vecType<D, uint, P> floatBitsToUint(vecType<D, float, P> const & v);
/// Returns a floating-point value corresponding to a signed /// Returns a floating-point value corresponding to a signed
/// integer encoding of a floating-point value. /// 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/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> /// @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 <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_DECL vecType<float, P> intBitsToFloat(vecType<int, P> const & v); GLM_FUNC_DECL vecType<D, float, P> intBitsToFloat(vecType<D, int, P> const & v);
/// Returns a floating-point value corresponding to a /// Returns a floating-point value corresponding to a
/// unsigned integer encoding of a floating-point value. /// 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/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> /// @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 <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_DECL vecType<float, P> uintBitsToFloat(vecType<uint, P> const & v); GLM_FUNC_DECL vecType<D, float, P> uintBitsToFloat(vecType<D, uint, P> const & v);
/// Computes and returns a * b + c. /// Computes and returns a * b + c.
/// ///

View File

@ -107,53 +107,53 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_abs_vector struct compute_abs_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(abs, x); return detail::functor1<D, T, T, P>::call(abs, x);
} }
}; };
template <typename T, typename U, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_mix_vector struct compute_mix_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a) 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_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator 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<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x)); return vecType<D, T, P>(vecType<D, U, P>(x) + a * vecType<D, U, P>(y - x));
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_mix_vector<T, bool, P, vecType, Aligned> struct compute_mix_vector<D, T, bool, P, vecType, Aligned>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a) 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)
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = a[i] ? y[i] : x[i]; Result[i] = a[i] ? y[i] : x[i];
return Result; return Result;
} }
}; };
template <typename T, typename U, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_mix_scalar struct compute_mix_scalar
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a) 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_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator 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<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x)); return vecType<D, T, P>(vecType<D, U, P>(x) + a * vecType<D, U, P>(y - x));
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_mix_scalar<T, bool, P, vecType, Aligned> struct compute_mix_scalar<D, T, bool, P, vecType, Aligned>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, bool const & a) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y, bool const & a)
{ {
return a ? y : x; return a ? y : x;
} }
@ -179,127 +179,127 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool isFloat, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isFloat, bool Aligned>
struct compute_sign struct compute_sign
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return vecType<T, P>(glm::lessThan(vecType<T, P>(0), x)) - vecType<T, P>(glm::lessThan(x, vecType<T, P>(0))); 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)));
} }
}; };
# if GLM_ARCH == GLM_ARCH_X86 # if GLM_ARCH == GLM_ARCH_X86
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_sign<T, P, vecType, false, Aligned> struct compute_sign<T, P, vecType, false, Aligned>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
T const Shift(static_cast<T>(sizeof(T) * 8 - 1)); T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
vecType<T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift)); vecType<D, T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
return (x >> Shift) | y; return (x >> Shift) | y;
} }
}; };
# endif # endif
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_floor struct compute_floor
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(std::floor, x); return detail::functor1<D, T, T, P>::call(std::floor, x);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_ceil struct compute_ceil
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(std::ceil, x); return detail::functor1<D, T, T, P>::call(std::ceil, x);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_fract struct compute_fract
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return x - floor(x); return x - floor(x);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_trunc struct compute_trunc
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(trunc, x); return detail::functor1<D, T, T, P>::call(trunc, x);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_round struct compute_round
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(round, x); return detail::functor1<D, T, T, P>::call(round, x);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_mod struct compute_mod
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, vecType<T, P> const & b) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & a, vecType<D, 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."); 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); return a - b * floor(a / b);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_min_vector struct compute_min_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return detail::functor2<T, P, vecType>::call(min, x, y); return detail::functor2<D, T, P>::call(min, x, y);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_max_vector struct compute_max_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return detail::functor2<T, P, vecType>::call(max, x, y); return detail::functor2<D, T, P>::call(max, x, y);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_clamp_vector struct compute_clamp_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal) 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)
{ {
return min(max(x, minVal), maxVal); return min(max(x, minVal), maxVal);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_step_vector struct compute_step_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & edge, vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & edge, vecType<D, T, P> const & x)
{ {
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, edge)); return mix(vecType<D, T, P>(1), vecType<D, T, P>(0), glm::lessThan(x, edge));
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_smoothstep_vector struct compute_smoothstep_vector
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x) 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_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs");
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1))); vecType<D, 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); 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); return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> abs(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> abs(vecType<D, T, P> const & x)
{ {
return detail::compute_abs_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_abs_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
// sign // sign
@ -326,40 +326,40 @@ namespace detail
std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer), std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
"'sign' only accept signed inputs"); "'sign' only accept signed inputs");
return detail::compute_sign<genFIType, defaultp, tvec1, std::numeric_limits<genFIType>::is_iec559, highp>::call(tvec1<genFIType>(x)).x; return detail::compute_sign<1, genFIType, defaultp, tvec, std::numeric_limits<genFIType>::is_iec559, highp>::call(tvec1<genFIType>(x)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sign(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> sign(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT( GLM_STATIC_ASSERT(
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer), std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
"'sign' only accept signed inputs"); "'sign' only accept signed inputs");
return detail::compute_sign<T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x); return detail::compute_sign<D, T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
} }
// floor // floor
using ::std::floor; using ::std::floor;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> floor(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> floor(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'floor' only accept floating-point inputs."); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'floor' only accept floating-point inputs.");
return detail::compute_floor<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_floor<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> trunc(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> trunc(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'trunc' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'trunc' only accept floating-point inputs");
return detail::compute_trunc<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_trunc<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> round(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> round(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'round' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'round' only accept floating-point inputs");
return detail::compute_round<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_round<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
/* /*
@ -405,20 +405,20 @@ namespace detail
//} //}
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> roundEven(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> roundEven(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'roundEven' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'roundEven' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(roundEven, x); return detail::functor1<D, T, T, P>::call(roundEven, x);
} }
// ceil // ceil
using ::std::ceil; using ::std::ceil;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> ceil(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> ceil(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ceil' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ceil' only accept floating-point inputs");
return detail::compute_ceil<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_ceil<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
// fract // fract
@ -428,11 +428,11 @@ namespace detail
return fract(tvec1<genType>(x)).x; return fract(tvec1<genType>(x)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fract(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fract(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fract' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fract' only accept floating-point inputs");
return detail::compute_fract<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_fract<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
// mod // mod
@ -448,16 +448,16 @@ namespace detail
# endif # endif
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, T y) GLM_FUNC_QUALIFIER vecType<D, T, P> mod(vecType<D, T, P> const & x, T y)
{ {
return detail::compute_mod<T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<T, P>(y)); return detail::compute_mod<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<D, T, P>(y));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return detail::compute_mod<T, P, vecType, detail::is_aligned<P>::value>::call(x, y); return detail::compute_mod<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, y);
} }
// modf // modf
@ -511,31 +511,31 @@ namespace detail
//CHAR_BIT - 1))); //CHAR_BIT - 1)));
// min // min
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, T b) GLM_FUNC_QUALIFIER vecType<D, T, P> min(vecType<D, 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"); 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<T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<T, P>(b)); return detail::compute_min_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<D, T, P>(b));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, vecType<T, P> const & b) GLM_FUNC_QUALIFIER vecType<D, T, P> min(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
{ {
return detail::compute_min_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, b); return detail::compute_min_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
} }
// max // max
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, T b) GLM_FUNC_QUALIFIER vecType<D, T, P> max(vecType<D, 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"); 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<T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<T, P>(b)); return detail::compute_max_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<D, T, P>(b));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, vecType<T, P> const & b) GLM_FUNC_QUALIFIER vecType<D, T, P> max(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
{ {
return detail::compute_max_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, b); return detail::compute_max_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
} }
// clamp // clamp
@ -546,18 +546,18 @@ namespace detail
return min(max(x, minVal), maxVal); return min(max(x, minVal), maxVal);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal) GLM_FUNC_QUALIFIER vecType<D, T, P> clamp(vecType<D, 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"); 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<T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<T, P>(minVal), vecType<T, P>(maxVal)); 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));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal) 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)
{ {
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"); 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<T, P, vecType, detail::is_aligned<P>::value>::call(x, minVal, maxVal); return detail::compute_clamp_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(x, minVal, maxVal);
} }
template <typename genTypeT, typename genTypeU> template <typename genTypeT, typename genTypeU>
@ -566,16 +566,16 @@ namespace detail
return detail::compute_mix<genTypeT, genTypeU>::call(x, y, a); return detail::compute_mix<genTypeT, genTypeU>::call(x, y, a);
} }
template <typename T, typename U, precision P, template <typename, precision> class vecType> template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a) GLM_FUNC_QUALIFIER vecType<D, T, P> mix(vecType<D, T, P> const & x, vecType<D, T, P> const & y, U a)
{ {
return detail::compute_mix_scalar<T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a); return detail::compute_mix_scalar<D, T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
} }
template <typename T, typename U, precision P, template <typename, precision> class vecType> template <int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a) 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)
{ {
return detail::compute_mix_vector<T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a); return detail::compute_mix_vector<D, T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
} }
// step // step
@ -585,16 +585,16 @@ namespace detail
return mix(static_cast<genType>(1), static_cast<genType>(0), glm::lessThan(x, edge)); return mix(static_cast<genType>(1), static_cast<genType>(0), glm::lessThan(x, edge));
} }
template <template <typename, precision> class vecType, typename T, precision P> template <template <int, typename, precision> class vecType, int D, typename T, precision P>
GLM_FUNC_QUALIFIER vecType<T, P> step(T edge, vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> step(T edge, vecType<D, T, P> const & x)
{ {
return detail::compute_step_vector<T, P, vecType, detail::is_aligned<P>::value>::call(vecType<T, P>(edge), x); return detail::compute_step_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(vecType<D, T, P>(edge), x);
} }
template <template <typename, precision> class vecType, typename T, precision P> template <template <int, typename, precision> class vecType, int D, typename T, precision P>
GLM_FUNC_QUALIFIER vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> step(vecType<D, T, P> const & edge, vecType<D, T, P> const & x)
{ {
return detail::compute_step_vector<T, P, vecType, detail::is_aligned<P>::value>::call(edge, x); return detail::compute_step_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(edge, x);
} }
// smoothstep // smoothstep
@ -607,16 +607,16 @@ namespace detail
return tmp * tmp * (genType(3) - genType(2) * tmp); return tmp * tmp * (genType(3) - genType(2) * tmp);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> smoothstep(T edge0, T edge1, vecType<D, T, P> const & x)
{ {
return detail::compute_smoothstep_vector<T, P, vecType, detail::is_aligned<P>::value>::call(vecType<T, P>(edge0), vecType<T, P>(edge1), 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);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x) 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)
{ {
return detail::compute_smoothstep_vector<T, P, vecType, detail::is_aligned<P>::value>::call(edge0, edge1, x); return detail::compute_smoothstep_vector<D, T, P, vecType, detail::is_aligned<P>::value>::call(edge0, edge1, x);
} }
# if GLM_HAS_CXX11_STL # if GLM_HAS_CXX11_STL
@ -647,12 +647,12 @@ namespace detail
} }
# endif # endif
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> isnan(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, bool, P> isnan(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
return detail::functor1<bool, T, P, vecType>::call(isnan, x); return detail::functor1<D, bool, T, P>::call(isnan, x);
} }
# if GLM_HAS_CXX11_STL # if GLM_HAS_CXX11_STL
@ -686,12 +686,12 @@ namespace detail
} }
# endif # endif
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> isinf(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, bool, P> isinf(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
return detail::functor1<bool, T, P, vecType>::call(isinf, x); return detail::functor1<D, bool, T, P>::call(isinf, x);
} }
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v) GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v)
@ -699,10 +699,10 @@ namespace detail
return reinterpret_cast<int&>(const_cast<float&>(v)); return reinterpret_cast<int&>(const_cast<float&>(v));
} }
template <template <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_QUALIFIER vecType<int, P> floatBitsToInt(vecType<float, P> const & v) GLM_FUNC_QUALIFIER vecType<D, int, P> floatBitsToInt(vecType<D, float, P> const & v)
{ {
return reinterpret_cast<vecType<int, P>&>(const_cast<vecType<float, P>&>(v)); return reinterpret_cast<vecType<D, int, P>&>(const_cast<vecType<D, float, P>&>(v));
} }
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v) GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
@ -710,10 +710,10 @@ namespace detail
return reinterpret_cast<uint&>(const_cast<float&>(v)); return reinterpret_cast<uint&>(const_cast<float&>(v));
} }
template <template <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_QUALIFIER vecType<uint, P> floatBitsToUint(vecType<float, P> const & v) GLM_FUNC_QUALIFIER vecType<D, uint, P> floatBitsToUint(vecType<D, float, P> const & v)
{ {
return reinterpret_cast<vecType<uint, P>&>(const_cast<vecType<float, P>&>(v)); return reinterpret_cast<vecType<D, uint, P>&>(const_cast<vecType<D, float, P>&>(v));
} }
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v) GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v)
@ -721,10 +721,10 @@ namespace detail
return reinterpret_cast<float&>(const_cast<int&>(v)); return reinterpret_cast<float&>(const_cast<int&>(v));
} }
template <template <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_QUALIFIER vecType<float, P> intBitsToFloat(vecType<int, P> const & v) GLM_FUNC_QUALIFIER vecType<D, float, P> intBitsToFloat(vecType<D, int, P> const & v)
{ {
return reinterpret_cast<vecType<float, P>&>(const_cast<vecType<int, P>&>(v)); return reinterpret_cast<vecType<D, float, P>&>(const_cast<vecType<D, int, P>&>(v));
} }
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v) GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v)
@ -732,10 +732,10 @@ namespace detail
return reinterpret_cast<float&>(const_cast<uint&>(v)); return reinterpret_cast<float&>(const_cast<uint&>(v));
} }
template <template <typename, precision> class vecType, precision P> template <template <int, typename, precision> class vecType, int D, precision P>
GLM_FUNC_QUALIFIER vecType<float, P> uintBitsToFloat(vecType<uint, P> const & v) GLM_FUNC_QUALIFIER vecType<D, float, P> uintBitsToFloat(vecType<D, uint, P> const & v)
{ {
return reinterpret_cast<vecType<float, P>&>(const_cast<vecType<uint, P>&>(v)); return reinterpret_cast<vecType<D, float, P>&>(const_cast<vecType<D, uint, P>&>(v));
} }
template <typename genType> template <typename genType>

View File

@ -11,7 +11,7 @@ namespace glm{
namespace detail namespace detail
{ {
template <precision P> template <precision P>
struct compute_abs_vector<float, P, tvec4, true> struct compute_abs_vector<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -22,7 +22,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_abs_vector<int, P, tvec4, true> struct compute_abs_vector<4, int, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<int, P> call(tvec4<int, P> const & v) GLM_FUNC_QUALIFIER static tvec4<int, P> call(tvec4<int, P> const & v)
{ {
@ -33,7 +33,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_floor<float, P, tvec4, true> struct compute_floor<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -44,7 +44,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_ceil<float, P, tvec4, true> struct compute_ceil<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -55,7 +55,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_fract<float, P, tvec4, true> struct compute_fract<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -66,7 +66,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_round<float, P, tvec4, true> struct compute_round<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -77,7 +77,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_mod<float, P, tvec4, true> struct compute_mod<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y)
{ {
@ -88,7 +88,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_min_vector<float, P, tvec4, true> struct compute_min_vector<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2)
{ {
@ -99,7 +99,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_min_vector<int32, P, tvec4, true> struct compute_min_vector<4, int32, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2) GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2)
{ {
@ -110,7 +110,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_min_vector<uint32, P, tvec4, true> struct compute_min_vector<4, uint32, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2) GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2)
{ {
@ -121,7 +121,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_max_vector<float, P, tvec4, true> struct compute_max_vector<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2)
{ {
@ -132,7 +132,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_max_vector<int32, P, tvec4, true> struct compute_max_vector<4, int32, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2) GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2)
{ {
@ -143,7 +143,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_max_vector<uint32, P, tvec4, true> struct compute_max_vector<4, uint32, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2) GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2)
{ {
@ -154,7 +154,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_clamp_vector<float, P, tvec4, true> struct compute_clamp_vector<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & minVal, tvec4<float, P> const & maxVal) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & minVal, tvec4<float, P> const & maxVal)
{ {
@ -165,7 +165,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_clamp_vector<int32, P, tvec4, true> struct compute_clamp_vector<4, int32, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & x, tvec4<int32, P> const & minVal, tvec4<int32, P> const & maxVal) GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & x, tvec4<int32, P> const & minVal, tvec4<int32, P> const & maxVal)
{ {
@ -176,7 +176,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_clamp_vector<uint32, P, tvec4, true> struct compute_clamp_vector<4, uint32, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & x, tvec4<uint32, P> const & minVal, tvec4<uint32, P> const & maxVal) GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & x, tvec4<uint32, P> const & minVal, tvec4<uint32, P> const & maxVal)
{ {
@ -187,7 +187,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_mix_vector<float, bool, P, tvec4, true> struct compute_mix_vector<4, float, bool, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y, tvec4<bool, P> const & a) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y, tvec4<bool, P> const & a)
{ {
@ -216,7 +216,7 @@ namespace detail
}; };
*/ */
template <precision P> template <precision P>
struct compute_smoothstep_vector<float, P, tvec4, true> struct compute_smoothstep_vector<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& edge0, tvec4<float, P> const& edge1, tvec4<float, P> const& x) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& edge0, tvec4<float, P> const& edge1, tvec4<float, P> const& x)
{ {

View File

@ -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/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent); GLM_FUNC_DECL vecType<D, T, P> pow(vecType<D, T, P> const & base, vecType<D, T, P> const & exponent);
/// Returns the natural exponentiation of x, i.e., e^x. /// 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/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> exp(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> exp(vecType<D, T, P> const & v);
/// Returns the natural logarithm of v, i.e., /// Returns the natural logarithm of v, i.e.,
/// returns the value y which satisfies the equation x = e^y. /// 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/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> /// @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 T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> log(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> log(vecType<D, T, P> const & v);
/// Returns 2 raised to the v power. /// 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/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> /// @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 T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> exp2(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> exp2(vecType<D, T, P> const & v);
/// Returns the base 2 log of x, i.e., returns the value y, /// Returns the base 2 log of x, i.e., returns the value y,
/// which satisfies the equation x = 2 ^ 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/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> /// @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 T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> log2(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> log2(vecType<D, T, P> const & v);
/// Returns the positive square root of 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> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
//template <typename genType> //template <typename genType>
//GLM_FUNC_DECL genType sqrt(genType const & x); //GLM_FUNC_DECL genType sqrt(genType const & x);
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> sqrt(vecType<D, T, P> const & v);
/// Returns the reciprocal of the positive square root of 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/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> /// @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 T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> inversesqrt(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> inversesqrt(vecType<D, T, P> const & v);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -20,43 +20,43 @@ namespace detail
} }
# endif # endif
template <typename T, precision P, template <class, precision> class vecType, bool isFloat, bool Aligned> template <int D, typename T, precision P, template <int, class, precision> class vecType, bool isFloat, bool Aligned>
struct compute_log2 struct compute_log2
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec) GLM_FUNC_QUALIFIER static tvec<D, T, P> call(tvec<D, T, P> const & vec)
{ {
return detail::functor1<T, T, P, vecType>::call(log2, vec); return detail::functor1<D, T, T, P>::call(log2, vec);
} }
}; };
template <template <class, precision> class vecType, typename T, precision P, bool Aligned> template <int D, typename T, precision P, bool Aligned>
struct compute_sqrt struct compute_sqrt
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static tvec<D, T, P> call(tvec<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(std::sqrt, x); return detail::functor1<D, T, T, P>::call(std::sqrt, x);
} }
}; };
template <template <class, precision> class vecType, typename T, precision P, bool Aligned> template <int D, typename T, precision P, bool Aligned>
struct compute_inversesqrt struct compute_inversesqrt
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static tvec<D, T, P> call(tvec<D, T, P> const & x)
{ {
return static_cast<T>(1) / sqrt(x); return static_cast<T>(1) / sqrt(x);
} }
}; };
template <template <class, precision> class vecType, bool Aligned> template <int D, bool Aligned>
struct compute_inversesqrt<vecType, float, lowp, Aligned> struct compute_inversesqrt<D, float, lowp, Aligned>
{ {
GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & x) GLM_FUNC_QUALIFIER static tvec<D, float, lowp> call(tvec<D, float, lowp> const & x)
{ {
vecType<float, lowp> tmp(x); tvec<D, float, lowp> tmp(x);
vecType<float, lowp> xhalf(tmp * 0.5f); tvec<D, float, lowp> xhalf(tmp * 0.5f);
vecType<uint, lowp>* p = reinterpret_cast<vecType<uint, lowp>*>(const_cast<vecType<float, lowp>*>(&x)); tvec<D, uint, lowp>* p = reinterpret_cast<tvec<D, uint, lowp>*>(const_cast<tvec<D, float, lowp>*>(&x));
vecType<uint, lowp> i = vecType<uint, lowp>(0x5f375a86) - (*p >> vecType<uint, lowp>(1)); tvec<D, uint, lowp> i = tvec<D, uint, lowp>(0x5f375a86) - (*p >> tvec<D, uint, lowp>(1));
vecType<float, lowp>* ptmp = reinterpret_cast<vecType<float, lowp>*>(&i); tvec<D, float, lowp>* ptmp = reinterpret_cast<tvec<D, float, lowp>*>(&i);
tmp = *ptmp; tmp = *ptmp;
tmp = tmp * (1.5f - xhalf * tmp * tmp); tmp = tmp * (1.5f - xhalf * tmp * tmp);
return tmp; return tmp;
@ -66,26 +66,26 @@ namespace detail
// pow // pow
using std::pow; using std::pow;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent) GLM_FUNC_QUALIFIER vecType<D, T, P> pow(vecType<D, T, P> const & base, vecType<D, T, P> const & exponent)
{ {
return detail::functor2<T, P, vecType>::call(pow, base, exponent); return detail::functor2<D, T, P>::call(pow, base, exponent);
} }
// exp // exp
using std::exp; using std::exp;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> exp(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> exp(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(exp, x); return detail::functor1<D, T, T, P>::call(exp, x);
} }
// log // log
using std::log; using std::log;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> log(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> log(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(log, x); return detail::functor1<D, T, T, P>::call(log, x);
} }
//exp2, ln2 = 0.69314718055994530941723212145818f //exp2, ln2 = 0.69314718055994530941723212145818f
@ -97,10 +97,10 @@ namespace detail
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x); return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> exp2(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> exp2(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(exp2, x); return detail::functor1<D, T, T, P>::call(exp2, x);
} }
// log2, ln2 = 0.69314718055994530941723212145818f // log2, ln2 = 0.69314718055994530941723212145818f
@ -110,19 +110,19 @@ namespace detail
return log2(tvec1<genType>(x)).x; return log2(tvec1<genType>(x)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> log2(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> log2(vecType<D, T, P> const & x)
{ {
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x); return detail::compute_log2<D, T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
} }
// sqrt // sqrt
using std::sqrt; using std::sqrt;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> sqrt(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
return detail::compute_sqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x); return detail::compute_sqrt<D, T, P, detail::is_aligned<P>::value>::call(x);
} }
// inversesqrt // inversesqrt
@ -132,11 +132,11 @@ namespace detail
return static_cast<genType>(1) / sqrt(x); return static_cast<genType>(1) / sqrt(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> inversesqrt(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
return detail::compute_inversesqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x); return detail::compute_inversesqrt<D, T, P, detail::is_aligned<P>::value>::call(x);
} }
}//namespace glm }//namespace glm

View File

@ -9,7 +9,7 @@ namespace glm{
namespace detail namespace detail
{ {
template <precision P> template <precision P>
struct compute_sqrt<tvec4, float, P, true> struct compute_sqrt<4, float, P, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -20,7 +20,7 @@ namespace detail
}; };
template <> template <>
struct compute_sqrt<tvec4, float, aligned_lowp, true> struct compute_sqrt<4, float, aligned_lowp, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, aligned_lowp> call(tvec4<float, aligned_lowp> const & v) GLM_FUNC_QUALIFIER static tvec4<float, aligned_lowp> call(tvec4<float, aligned_lowp> const & v)
{ {

View File

@ -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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T length( GLM_FUNC_DECL T length(
vecType<T, P> const & x); vecType<D, T, P> const & x);
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T distance( GLM_FUNC_DECL T distance(
vecType<T, P> const & p0, vecType<D, T, P> const & p0,
vecType<T, P> const & p1); vecType<D, T, P> const & p1);
/// Returns the dot product of x and y, i.e., result = x * y. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P>
GLM_FUNC_DECL T dot( GLM_FUNC_DECL T dot(
vecType<T, P> const & x, tvec<D, T, P> const & x,
vecType<T, P> const & y); tvec<D, T, P> const & y);
/// Returns the cross product of x and 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> normalize( GLM_FUNC_DECL vecType<D, T, P> normalize(
vecType<T, P> const & x); vecType<D, T, P> const & x);
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> faceforward( GLM_FUNC_DECL vecType<D, T, P> faceforward(
vecType<T, P> const & N, vecType<D, T, P> const & N,
vecType<T, P> const & I, vecType<D, T, P> const & I,
vecType<T, P> const & Nref); vecType<D, T, P> const & Nref);
/// For the incident vector I and surface orientation N, /// For the incident vector I and surface orientation N,
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> refract( GLM_FUNC_DECL vecType<D, T, P> refract(
vecType<T, P> const & I, vecType<D, T, P> const & I,
vecType<T, P> const & N, vecType<D, T, P> const & N,
T eta); T eta);
/// @} /// @}

View File

@ -10,62 +10,62 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned> template <template <int, typename, precision> class vecType, int D, typename T, precision P, bool Aligned>
struct compute_length struct compute_length
{ {
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static T call(vecType<D, T, P> const & v)
{ {
return sqrt(dot(v, v)); return sqrt(dot(v, v));
} }
}; };
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned> template <template <int, typename, precision> class vecType, int D, typename T, precision P, bool Aligned>
struct compute_distance struct compute_distance
{ {
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & p0, vecType<T, P> const & p1) GLM_FUNC_QUALIFIER static T call(vecType<D, T, P> const & p0, vecType<D, T, P> const & p1)
{ {
return length(p1 - p0); return length(p1 - p0);
} }
}; };
template <template <class, precision> class vecType, typename T, precision P, bool Aligned> template <typename V, typename T, bool Aligned>
struct compute_dot{}; struct compute_dot{};
template <typename T, precision P, bool Aligned> template <typename T, precision P, bool Aligned>
struct compute_dot<tvec1, T, P, Aligned> struct compute_dot<tvec<1, T, P>, T, Aligned>
{ {
GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b) GLM_FUNC_QUALIFIER static T call(tvec<1, T, P> const & a, tvec<1, T, P> const & b)
{ {
return a.x * b.x; return a.x * b.x;
} }
}; };
template <typename T, precision P, bool Aligned> template <typename T, precision P, bool Aligned>
struct compute_dot<tvec2, T, P, Aligned> struct compute_dot<tvec<2, T, P>, T, Aligned>
{ {
GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y) GLM_FUNC_QUALIFIER static T call(tvec<2, T, P> const & a, tvec<2, T, P> const & b)
{ {
tvec2<T, P> tmp(x * y); tvec<2, T, P> tmp(a * b);
return tmp.x + tmp.y; return tmp.x + tmp.y;
} }
}; };
template <typename T, precision P, bool Aligned> template <typename T, precision P, bool Aligned>
struct compute_dot<tvec3, T, P, Aligned> struct compute_dot<tvec<3, T, P>, T, Aligned>
{ {
GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y) GLM_FUNC_QUALIFIER static T call(tvec<3, T, P> const & a, tvec<3, T, P> const & b)
{ {
tvec3<T, P> tmp(x * y); tvec3<T, P> tmp(a * b);
return tmp.x + tmp.y + tmp.z; return tmp.x + tmp.y + tmp.z;
} }
}; };
template <typename T, precision P, bool Aligned> template <typename T, precision P, bool Aligned>
struct compute_dot<tvec4, T, P, Aligned> struct compute_dot<tvec<4, T, P>, T, Aligned>
{ {
GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y) GLM_FUNC_QUALIFIER static T call(tvec<4, T, P> const & a, tvec<4, T, P> const & b)
{ {
tvec4<T, P> tmp(x * y); tvec<4, T, P> tmp(a * b);
return (tmp.x + tmp.y) + (tmp.z + tmp.w); return (tmp.x + tmp.y) + (tmp.z + tmp.w);
} }
}; };
@ -84,10 +84,10 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_normalize struct compute_normalize
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
@ -95,10 +95,10 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_faceforward struct compute_faceforward
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref) 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_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
@ -106,19 +106,19 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_reflect struct compute_reflect
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & I, vecType<D, T, P> const & N)
{ {
return I - N * dot(N, I) * static_cast<T>(2); return I - N * dot(N, I) * static_cast<T>(2);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_refract struct compute_refract
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N, T eta) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & I, vecType<D, T, P> const & N, T eta)
{ {
T const dotValue(dot(N, I)); T const dotValue(dot(N, I));
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue)); T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
@ -136,12 +136,12 @@ namespace detail
return abs(x); return abs(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v) GLM_FUNC_QUALIFIER T length(vecType<D, T, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs");
return detail::compute_length<vecType, T, P, detail::is_aligned<P>::value>::call(v); return detail::compute_length<vecType, D, T, P, detail::is_aligned<P>::value>::call(v);
} }
// distance // distance
@ -153,10 +153,10 @@ namespace detail
return length(p1 - p0); return length(p1 - p0);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1) GLM_FUNC_QUALIFIER T distance(vecType<D, T, P> const & p0, vecType<D, T, P> const & p1)
{ {
return detail::compute_distance<vecType, T, P, detail::is_aligned<P>::value>::call(p0, p1); return detail::compute_distance<vecType, D, T, P, detail::is_aligned<P>::value>::call(p0, p1);
} }
// dot // dot
@ -167,11 +167,18 @@ namespace detail
return x * y; return x * y;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P>
GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER T dot(tvec<D, T, P> const & x, tvec<D, T, P> const & y)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
return detail::compute_dot<vecType, T, P, detail::is_aligned<P>::value>::call(x, y); return detail::compute_dot<tvec<D, T, P>, T, detail::is_aligned<P>::value>::call(x, y);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T dot(tquat<T, P> const & x, tquat<T, P> const & y)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
return detail::compute_dot<tquat<T, P>, T, detail::is_aligned<P>::value>::call(x, y);
} }
// cross // cross
@ -190,12 +197,12 @@ namespace detail
return x < genType(0) ? genType(-1) : genType(1); return x < genType(0) ? genType(-1) : genType(1);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> normalize(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
return detail::compute_normalize<T, P, vecType, detail::is_aligned<P>::value>::call(x); return detail::compute_normalize<D, T, P, vecType, detail::is_aligned<P>::value>::call(x);
} }
// faceforward // faceforward
@ -205,10 +212,10 @@ namespace detail
return dot(Nref, I) < static_cast<genType>(0) ? N : -N; return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> faceforward(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref) 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)
{ {
return detail::compute_faceforward<T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref); return detail::compute_faceforward<D, T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref);
} }
// reflect // reflect
@ -218,10 +225,10 @@ namespace detail
return I - N * dot(N, I) * genType(2); return I - N * dot(N, I) * genType(2);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> reflect(vecType<T, P> const & I, vecType<T, P> const & N) GLM_FUNC_QUALIFIER vecType<D, T, P> reflect(vecType<D, T, P> const & I, vecType<D, T, P> const & N)
{ {
return detail::compute_reflect<T, P, vecType, detail::is_aligned<P>::value>::call(I, N); return detail::compute_reflect<D, T, P, vecType, detail::is_aligned<P>::value>::call(I, N);
} }
// refract // refract
@ -234,11 +241,11 @@ namespace detail
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0)); return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta) GLM_FUNC_QUALIFIER vecType<D, T, P> refract(vecType<D, T, P> const & I, vecType<D, T, P> const & N, T eta)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs");
return detail::compute_refract<T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta); return detail::compute_refract<D, T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta);
} }
}//namespace glm }//namespace glm

View File

@ -9,16 +9,16 @@ namespace glm{
namespace detail namespace detail
{ {
template <precision P> template <precision P>
struct compute_length<tvec4, float, P, true> struct compute_length<tvec, 4, float, P, true>
{ {
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static float call(tvec<4, float, P> const & v)
{ {
return _mm_cvtss_f32(glm_vec4_length(v.data)); return _mm_cvtss_f32(glm_vec4_length(v.data));
} }
}; };
template <precision P> template <precision P>
struct compute_distance<tvec4, float, P, true> struct compute_distance<tvec, 4, float, P, true>
{ {
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & p0, tvec4<float, P> const & p1) GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & p0, tvec4<float, P> const & p1)
{ {
@ -27,9 +27,9 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_dot<tvec4, float, P, true> struct compute_dot<tvec<4, float, P>, float, true>
{ {
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const& x, tvec4<float, P> const& y) GLM_FUNC_QUALIFIER static float call(tvec<4, float, P> const& x, tvec<4, float, P> const& y)
{ {
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
} }
@ -51,7 +51,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_normalize<float, P, tvec4, true> struct compute_normalize<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
{ {
@ -62,7 +62,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_faceforward<float, P, tvec4, true> struct compute_faceforward<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& N, tvec4<float, P> const& I, tvec4<float, P> const& Nref) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& N, tvec4<float, P> const& I, tvec4<float, P> const& Nref)
{ {
@ -73,7 +73,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_reflect<float, P, tvec4, true> struct compute_reflect<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N)
{ {
@ -84,7 +84,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_refract<float, P, tvec4, true> struct compute_refract<4, float, P, tvec, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N, float eta) GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N, float eta)
{ {

View File

@ -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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<uint, P> uaddCarry( GLM_FUNC_DECL vecType<D, uint, P> uaddCarry(
vecType<uint, P> const & x, vecType<D, uint, P> const & x,
vecType<uint, P> const & y, vecType<D, uint, P> const & y,
vecType<uint, P> & carry); vecType<D, uint, P> & carry);
/// Subtracts the 32-bit unsigned integer y from x, returning /// Subtracts the 32-bit unsigned integer y from x, returning
/// the difference if non-negative, or pow(2, 32) plus the difference /// 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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<uint, P> usubBorrow( GLM_FUNC_DECL vecType<D, uint, P> usubBorrow(
vecType<uint, P> const & x, vecType<D, uint, P> const & x,
vecType<uint, P> const & y, vecType<D, uint, P> const & y,
vecType<uint, P> & borrow); vecType<D, uint, P> & borrow);
/// Multiplies 32-bit integers x and y, producing a 64-bit /// Multiplies 32-bit integers x and y, producing a 64-bit
/// result. The 32 least-significant bits are returned in lsb. /// 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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL void umulExtended( GLM_FUNC_DECL void umulExtended(
vecType<uint, P> const & x, vecType<D, uint, P> const & x,
vecType<uint, P> const & y, vecType<D, uint, P> const & y,
vecType<uint, P> & msb, vecType<D, uint, P> & msb,
vecType<uint, P> & lsb); vecType<D, uint, P> & lsb);
/// Multiplies 32-bit integers x and y, producing a 64-bit /// Multiplies 32-bit integers x and y, producing a 64-bit
/// result. The 32 least-significant bits are returned in lsb. /// 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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL void imulExtended( GLM_FUNC_DECL void imulExtended(
vecType<int, P> const & x, vecType<D, int, P> const & x,
vecType<int, P> const & y, vecType<D, int, P> const & y,
vecType<int, P> & msb, vecType<D, int, P> & msb,
vecType<int, P> & lsb); vecType<D, int, P> & lsb);
/// Extracts bits [offset, offset + bits - 1] from value, /// Extracts bits [offset, offset + bits - 1] from value,
/// returning them in the least significant bits of the result. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldExtract( GLM_FUNC_DECL vecType<D, T, P> bitfieldExtract(
vecType<T, P> const & Value, vecType<D, T, P> const & Value,
int Offset, int Offset,
int Bits); 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldInsert( GLM_FUNC_DECL vecType<D, T, P> bitfieldInsert(
vecType<T, P> const & Base, vecType<D, T, P> const & Base,
vecType<T, P> const & Insert, vecType<D, T, P> const & Insert,
int Offset, int Offset,
int Bits); 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldReverse(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> bitfieldReverse(vecType<D, T, P> const & v);
/// Returns the number of bits set to 1 in the binary representation of value. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<int, P> bitCount(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, int, P> bitCount(vecType<D, T, P> const & v);
/// Returns the bit number of the least significant bit set to /// Returns the bit number of the least significant bit set to
/// 1 in the binary representation of value. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<int, P> findLSB(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, int, P> findLSB(vecType<D, T, P> const & v);
/// Returns the bit number of the most significant bit in the binary representation of value. /// 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. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<int, P> findMSB(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, int, P> findMSB(vecType<D, T, P> const & v);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -30,37 +30,37 @@ namespace detail
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1); return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned, bool EXEC> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned, bool EXEC>
struct compute_bitfieldReverseStep struct compute_bitfieldReverseStep
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
{ {
return v; return v;
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_bitfieldReverseStep<T, P, vecType, Aligned, true> struct compute_bitfieldReverseStep<D, T, P, vecType, Aligned, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
{ {
return (v & Mask) << Shift | (v & (~Mask)) >> Shift; return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned, bool EXEC> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned, bool EXEC>
struct compute_bitfieldBitCountStep struct compute_bitfieldBitCountStep
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
{ {
return v; return v;
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_bitfieldBitCountStep<T, P, vecType, Aligned, true> struct compute_bitfieldBitCountStep<D, T, P, vecType, Aligned, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
{ {
return (v & Mask) + ((v >> Shift) & Mask); return (v & Mask) + ((v >> Shift) & Mask);
} }
@ -104,37 +104,37 @@ namespace detail
# endif # endif
# endif//GLM_HAS_BITSCAN_WINDOWS # endif//GLM_HAS_BITSCAN_WINDOWS
template <typename T, glm::precision P, template <class, glm::precision> class vecType, bool EXEC = true> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, bool EXEC = true>
struct compute_findMSB_step_vec struct compute_findMSB_step_vec
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, T Shift) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, T Shift)
{ {
return x | (x >> Shift); return x | (x >> Shift);
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
struct compute_findMSB_step_vec<T, P, vecType, false> struct compute_findMSB_step_vec<D, T, P, vecType, false>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, T) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x, T)
{ {
return x; return x;
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, int> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType, int>
struct compute_findMSB_vec struct compute_findMSB_vec
{ {
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & vec) GLM_FUNC_QUALIFIER static vecType<D, int, P> call(vecType<D, T, P> const & vec)
{ {
vecType<T, P> x(vec); vecType<D, T, P> x(vec);
x = compute_findMSB_step_vec<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>( 1));
x = compute_findMSB_step_vec<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>( 2));
x = compute_findMSB_step_vec<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 >= 8>::call(x, static_cast<T>( 4));
x = compute_findMSB_step_vec<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 >= 16>::call(x, static_cast<T>( 8));
x = compute_findMSB_step_vec<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 >= 32>::call(x, static_cast<T>(16));
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32)); x = compute_findMSB_step_vec<D, T, P, vecType, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32));
return vecType<int, P>(sizeof(T) * 8 - 1) - glm::bitCount(~x); return vecType<D, int, P>(sizeof(T) * 8 - 1) - glm::bitCount(~x);
} }
}; };
@ -147,12 +147,12 @@ namespace detail
return IsNotNull ? int(Result) : -1; return IsNotNull ? int(Result) : -1;
} }
template <typename T, glm::precision P, template<typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template<int, typename, precision> class vecType>
struct compute_findMSB_vec<T, P, vecType, 32> struct compute_findMSB_vec<D, T, P, vecType, 32>
{ {
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, int, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<int, T, P, vecType>::call(compute_findMSB_32, x); return detail::functor1<D, int, T, P>::call(compute_findMSB_32, x);
} }
}; };
@ -165,12 +165,12 @@ namespace detail
return IsNotNull ? int(Result) : -1; return IsNotNull ? int(Result) : -1;
} }
template <typename T, glm::precision P, template <class, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
struct compute_findMSB_vec<T, P, vecType, 64> struct compute_findMSB_vec<D, T, P, vecType, 64>
{ {
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, int, P> call(vecType<D, T, P> const & x)
{ {
return detail::functor1<int, T, P, vecType>::call(compute_findMSB_64, x); return detail::functor1<D, int, T, P>::call(compute_findMSB_64, x);
} }
}; };
# endif # endif
@ -186,13 +186,13 @@ namespace detail
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1))); return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint, P> uaddCarry(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & Carry) 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)
{ {
vecType<uint64, P> Value64(vecType<uint64, P>(x) + vecType<uint64, P>(y)); vecType<D, uint64, P> Value64(vecType<D, uint64, P>(x) + vecType<D, uint64, P>(y));
vecType<uint64, P> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1)); vecType<D, uint64, P> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
Carry = mix(vecType<uint32, P>(0), vecType<uint32, P>(1), greaterThan(Value64, Max32)); Carry = mix(vecType<D, uint32, P>(0), vecType<D, uint32, P>(1), greaterThan(Value64, Max32));
return vecType<uint32,P>(Value64 % (Max32 + static_cast<uint64>(1))); return vecType<D, uint32,P>(Value64 % (Max32 + static_cast<uint64>(1)));
} }
// usubBorrow // 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))); return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint, P> usubBorrow(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & Borrow) 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)
{ {
Borrow = mix(vecType<uint, P>(1), vecType<uint, P>(0), greaterThanEqual(x, y)); Borrow = mix(vecType<D, uint, P>(1), vecType<D, uint, P>(0), greaterThanEqual(x, y));
vecType<uint, P> const YgeX(y - x); vecType<D, uint, P> const YgeX(y - x);
vecType<uint, P> const XgeY(vecType<uint32, P>((static_cast<int64>(1) << static_cast<int64>(32)) + (vecType<int64, P>(y) - vecType<int64, P>(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))));
return mix(XgeY, YgeX, greaterThanEqual(y, x)); return mix(XgeY, YgeX, greaterThanEqual(y, x));
} }
@ -226,14 +226,14 @@ namespace detail
lsb = static_cast<uint>(Value64); lsb = static_cast<uint>(Value64);
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER void umulExtended(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & msb, vecType<uint, P> & lsb) 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)
{ {
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
vecType<uint64, P> Value64(vecType<uint64, P>(x) * vecType<uint64, P>(y)); vecType<D, uint64, P> Value64(vecType<D, uint64, P>(x) * vecType<D, uint64, P>(y));
msb = vecType<uint32, P>(Value64 >> static_cast<uint64>(32)); msb = vecType<D, uint32, P>(Value64 >> static_cast<uint64>(32));
lsb = vecType<uint32, P>(Value64); lsb = vecType<D, uint32, P>(Value64);
} }
// imulExtended // imulExtended
@ -246,14 +246,14 @@ namespace detail
lsb = static_cast<int>(Value64); lsb = static_cast<int>(Value64);
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER void imulExtended(vecType<int, P> const & x, vecType<int, P> const & y, vecType<int, P> & msb, vecType<int, P> & lsb) 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)
{ {
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch"); GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
vecType<int64, P> Value64(vecType<int64, P>(x) * vecType<int64, P>(y)); vecType<D, int64, P> Value64(vecType<D, int64, P>(x) * vecType<D, int64, P>(y));
lsb = vecType<int32, P>(Value64 & static_cast<int64>(0xFFFFFFFF)); lsb = vecType<D, int32, P>(Value64 & static_cast<int64>(0xFFFFFFFF));
msb = vecType<int32, P>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF)); msb = vecType<D, int32, P>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
} }
// bitfieldExtract // bitfieldExtract
@ -263,8 +263,8 @@ namespace detail
return bitfieldExtract(tvec1<genIUType>(Value), Offset, Bits).x; return bitfieldExtract(tvec1<genIUType>(Value), Offset, Bits).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldExtract(vecType<T, P> const & Value, int Offset, int Bits) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldExtract(vecType<D, T, P> const & Value, int Offset, int Bits)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldExtract' only accept integer inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldExtract' only accept integer inputs");
@ -278,8 +278,8 @@ namespace detail
return bitfieldInsert(tvec1<genIUType>(Base), tvec1<genIUType>(Insert), Offset, Bits).x; return bitfieldInsert(tvec1<genIUType>(Base), tvec1<genIUType>(Insert), Offset, Bits).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldInsert(vecType<T, P> const & Base, vecType<T, P> const & Insert, int Offset, int Bits) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldInsert(vecType<D, T, P> const & Base, vecType<D, T, P> const & Insert, int Offset, int Bits)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldInsert' only accept integer values"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldInsert' only accept integer values");
@ -294,16 +294,16 @@ namespace detail
return bitfieldReverse(glm::tvec1<genType, glm::defaultp>(x)).x; return bitfieldReverse(glm::tvec1<genType, glm::defaultp>(x)).x;
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverse(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverse(vecType<D, T, P> const & v)
{ {
vecType<T, P> x(v); vecType<D, T, P> x(v);
x = detail::compute_bitfieldReverseStep<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>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
x = detail::compute_bitfieldReverseStep<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>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
x = detail::compute_bitfieldReverseStep<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>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
x = detail::compute_bitfieldReverseStep<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>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
x = detail::compute_bitfieldReverseStep<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>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32)); 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));
return x; return x;
} }
@ -314,21 +314,21 @@ namespace detail
return bitCount(glm::tvec1<genType, glm::defaultp>(x)).x; return bitCount(glm::tvec1<genType, glm::defaultp>(x)).x;
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, int, P> bitCount(vecType<D, T, P> const & v)
{ {
#if GLM_COMPILER & GLM_COMPILER_VC #if GLM_COMPILER & GLM_COMPILER_VC
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4310) //cast truncates constant value #pragma warning(disable : 4310) //cast truncates constant value
#endif #endif
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v)); 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<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>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
x = detail::compute_bitfieldBitCountStep<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>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
x = detail::compute_bitfieldBitCountStep<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>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
x = detail::compute_bitfieldBitCountStep<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>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
x = detail::compute_bitfieldBitCountStep<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>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
x = detail::compute_bitfieldBitCountStep<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)); 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<int, P>(x); return vecType<D, int, P>(x);
#if GLM_COMPILER & GLM_COMPILER_VC #if GLM_COMPILER & GLM_COMPILER_VC
#pragma warning(pop) #pragma warning(pop)
#endif #endif
@ -343,12 +343,12 @@ namespace detail
return detail::compute_findLSB<genIUType, sizeof(genIUType) * 8>::call(Value); return detail::compute_findLSB<genIUType, sizeof(genIUType) * 8>::call(Value);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> findLSB(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, int, P> findLSB(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findLSB' only accept integer values"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findLSB' only accept integer values");
return detail::functor1<int, T, P, vecType>::call(findLSB, x); return detail::functor1<D, int, T, P>::call(findLSB, x);
} }
// findMSB // findMSB
@ -360,12 +360,12 @@ namespace detail
return findMSB(tvec1<genIUType>(x)).x; return findMSB(tvec1<genIUType>(x)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> findMSB(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, int, P> findMSB(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findMSB' only accept integer values"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findMSB' only accept integer values");
return detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(x); return detail::compute_findMSB_vec<D, T, P, vecType, sizeof(T) * 8>::call(x);
} }
}//namespace glm }//namespace glm

View File

@ -9,7 +9,7 @@ namespace glm{
namespace detail namespace detail
{ {
template <glm::precision P> template <glm::precision P>
struct compute_bitfieldReverseStep<uint32, P, tvec4, true, true> struct compute_bitfieldReverseStep<4, uint32, P, tvec, true, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift) GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
{ {
@ -30,7 +30,7 @@ namespace detail
}; };
template <glm::precision P> template <glm::precision P>
struct compute_bitfieldBitCountStep<uint32, P, tvec4, true, true> struct compute_bitfieldBitCountStep<4, uint32, P, tvec, true, true>
{ {
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift) GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
{ {

View File

@ -35,55 +35,55 @@ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec2> struct outerProduct_trait<2, 2, T, P, tvec, tvec>
{ {
typedef tmat2x2<T, P> type; typedef tmat2x2<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec3> struct outerProduct_trait<2, 3, T, P, tvec, tvec>
{ {
typedef tmat3x2<T, P> type; typedef tmat3x2<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec4> struct outerProduct_trait<2, 4, T, P, tvec, tvec>
{ {
typedef tmat4x2<T, P> type; typedef tmat4x2<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec2> struct outerProduct_trait<3, 2, T, P, tvec, tvec>
{ {
typedef tmat2x3<T, P> type; typedef tmat2x3<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec3> struct outerProduct_trait<3, 3, T, P, tvec, tvec>
{ {
typedef tmat3x3<T, P> type; typedef tmat3x3<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec4> struct outerProduct_trait<3, 4, T, P, tvec, tvec>
{ {
typedef tmat4x3<T, P> type; typedef tmat4x3<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec2> struct outerProduct_trait<4, 2, T, P, tvec, tvec>
{ {
typedef tmat2x4<T, P> type; typedef tmat2x4<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec3> struct outerProduct_trait<4, 3, T, P, tvec, tvec>
{ {
typedef tmat3x4<T, P> type; typedef tmat3x4<T, P> type;
}; };
template <typename T, precision P> template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec4> struct outerProduct_trait<4, 4, T, P, tvec, tvec>
{ {
typedef tmat4x4<T, P> type; typedef tmat4x4<T, P> type;
}; };
@ -111,8 +111,8 @@ 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB> template <int DA, int DB, typename T, precision P, template <int, typename, precision> class vecTypeA, template <int, typename, precision> class vecTypeB>
GLM_FUNC_DECL typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r); 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 /// Returns the transposed matrix of x
/// ///

View File

@ -362,12 +362,12 @@ namespace detail
return detail::compute_matrixCompMult<matType, T, P, detail::is_aligned<P>::value>::call(x, y); return detail::compute_matrixCompMult<matType, T, P, detail::is_aligned<P>::value>::call(x, y);
} }
template<typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB> template<int DA, int DB, typename T, precision P, template <int, typename, precision> class vecTypeA, template <int, typename, precision> class vecTypeB>
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r) 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"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs");
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize); typename detail::outerProduct_trait<DA, DB, T, P, vecTypeA, vecTypeB>::type m(uninitialize);
for(length_t i = 0; i < m.length(); ++i) for(length_t i = 0; i < m.length(); ++i)
m[i] = c * r[i]; m[i] = c * r[i];
return m; return m;

View File

@ -61,7 +61,7 @@ namespace detail
}//namespace detail }//namespace detail
template<> template<>
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_lowp> outerProduct<float, aligned_lowp, tvec4, tvec4>(tvec4<float, aligned_lowp> const & c, tvec4<float, aligned_lowp> const & r) GLM_FUNC_QUALIFIER tmat4x4<float, aligned_lowp> outerProduct<4, 4, float, aligned_lowp, tvec, tvec>(tvec4<float, aligned_lowp> const & c, tvec4<float, aligned_lowp> const & r)
{ {
tmat4x4<float, aligned_lowp> m(uninitialize); tmat4x4<float, aligned_lowp> m(uninitialize);
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
@ -69,7 +69,7 @@ namespace detail
} }
template<> template<>
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_mediump> outerProduct<float, aligned_mediump, tvec4, tvec4>(tvec4<float, aligned_mediump> const & c, tvec4<float, aligned_mediump> const & r) GLM_FUNC_QUALIFIER tmat4x4<float, aligned_mediump> outerProduct<4, 4, float, aligned_mediump, tvec, tvec>(tvec4<float, aligned_mediump> const & c, tvec4<float, aligned_mediump> const & r)
{ {
tmat4x4<float, aligned_mediump> m(uninitialize); tmat4x4<float, aligned_mediump> m(uninitialize);
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
@ -77,7 +77,7 @@ namespace detail
} }
template<> template<>
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_highp> outerProduct<float, aligned_highp, tvec4, tvec4>(tvec4<float, aligned_highp> const & c, tvec4<float, aligned_highp> const & r) GLM_FUNC_QUALIFIER tmat4x4<float, aligned_highp> outerProduct<4, 4, float, aligned_highp, tvec, tvec>(tvec4<float, aligned_highp> const & c, tvec4<float, aligned_highp> const & r)
{ {
tmat4x4<float, aligned_highp> m(uninitialize); tmat4x4<float, aligned_highp> m(uninitialize);
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));

View File

@ -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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & degrees); GLM_FUNC_DECL GLM_CONSTEXPR vecType<D, T, P> radians(vecType<D, T, P> const & degrees);
/// Converts radians to degrees and returns the result. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & radians); GLM_FUNC_DECL GLM_CONSTEXPR vecType<D, T, P> degrees(vecType<D, T, P> const & radians);
/// The standard trigonometric sine function. /// The standard trigonometric sine function.
/// The values returned by this function will range from [-1, 1]. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sin(vecType<T, P> const & angle); GLM_FUNC_DECL vecType<D, T, P> sin(vecType<D, T, P> const & angle);
/// The standard trigonometric cosine function. /// The standard trigonometric cosine function.
/// The values returned by this function will range from [-1, 1]. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> cos(vecType<T, P> const & angle); GLM_FUNC_DECL vecType<D, T, P> cos(vecType<D, T, P> const & angle);
/// The standard trigonometric tangent function. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> tan(vecType<T, P> const & angle); GLM_FUNC_DECL vecType<D, T, P> tan(vecType<D, T, P> const & angle);
/// Arc sine. Returns an angle whose sine is x. /// Arc sine. Returns an angle whose sine is x.
/// The range of values returned by this function is [-PI/2, PI/2]. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> asin(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> asin(vecType<D, T, P> const & x);
/// Arc cosine. Returns an angle whose sine is x. /// Arc cosine. Returns an angle whose sine is x.
/// The range of values returned by this function is [0, PI]. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> acos(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> acos(vecType<D, T, P> const & x);
/// Arc tangent. Returns an angle whose tangent is y/x. /// Arc tangent. Returns an angle whose tangent is y/x.
/// The signs of x and y are used to determine what /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> atan(vecType<T, P> const & y, vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> atan(vecType<D, T, P> const & y, vecType<D, T, P> const & x);
/// Arc tangent. Returns an angle whose tangent is y_over_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]. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> atan(vecType<T, P> const & y_over_x); GLM_FUNC_DECL vecType<D, T, P> atan(vecType<D, T, P> const & y_over_x);
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sinh(vecType<T, P> const & angle); GLM_FUNC_DECL vecType<D, T, P> sinh(vecType<D, T, P> const & angle);
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> cosh(vecType<T, P> const & angle); GLM_FUNC_DECL vecType<D, T, P> cosh(vecType<D, T, P> const & angle);
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> tanh(vecType<T, P> const & angle); GLM_FUNC_DECL vecType<D, T, P> tanh(vecType<D, T, P> const & angle);
/// Arc hyperbolic sine; returns the inverse of sinh. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> asinh(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> asinh(vecType<D, T, P> const & x);
/// Arc hyperbolic cosine; returns the non-negative inverse /// Arc hyperbolic cosine; returns the non-negative inverse
/// of cosh. Results are undefined if x < 1. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> acosh(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> acosh(vecType<D, T, P> const & x);
/// Arc hyperbolic tangent; returns the inverse of tanh. /// Arc hyperbolic tangent; returns the inverse of tanh.
/// Results are undefined if abs(x) >= 1. /// 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> atanh(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> atanh(vecType<D, T, P> const & x);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -16,10 +16,10 @@ namespace glm
return degrees * static_cast<genType>(0.01745329251994329576923690768489); return degrees * static_cast<genType>(0.01745329251994329576923690768489);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<D, T, P> radians(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(radians, v); return detail::functor1<D, T, T, P>::call(radians, v);
} }
// degrees // degrees
@ -31,55 +31,55 @@ namespace glm
return radians * static_cast<genType>(57.295779513082320876798154814105); return radians * static_cast<genType>(57.295779513082320876798154814105);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<D, T, P> degrees(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(degrees, v); return detail::functor1<D, T, T, P>::call(degrees, v);
} }
// sin // sin
using ::std::sin; using ::std::sin;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sin(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> sin(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(sin, v); return detail::functor1<D, T, T, P>::call(sin, v);
} }
// cos // cos
using std::cos; using std::cos;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> cos(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> cos(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(cos, v); return detail::functor1<D, T, T, P>::call(cos, v);
} }
// tan // tan
using std::tan; using std::tan;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> tan(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> tan(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(tan, v); return detail::functor1<D, T, T, P>::call(tan, v);
} }
// asin // asin
using std::asin; using std::asin;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> asin(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> asin(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(asin, v); return detail::functor1<D, T, T, P>::call(asin, v);
} }
// acos // acos
using std::acos; using std::acos;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> acos(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> acos(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(acos, v); return detail::functor1<D, T, T, P>::call(acos, v);
} }
// atan // atan
@ -91,45 +91,45 @@ namespace glm
return ::std::atan2(y, x); return ::std::atan2(y, x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & a, vecType<T, P> const & b) GLM_FUNC_QUALIFIER vecType<D, T, P> atan(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
{ {
return detail::functor2<T, P, vecType>::call(::std::atan2, a, b); return detail::functor2<D, T, P>::call(::std::atan2, a, b);
} }
using std::atan; using std::atan;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> atan(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(atan, v); return detail::functor1<D, T, T, P>::call(atan, v);
} }
// sinh // sinh
using std::sinh; using std::sinh;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sinh(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> sinh(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(sinh, v); return detail::functor1<D, T, T, P>::call(sinh, v);
} }
// cosh // cosh
using std::cosh; using std::cosh;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> cosh(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> cosh(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(cosh, v); return detail::functor1<D, T, T, P>::call(cosh, v);
} }
// tanh // tanh
using std::tanh; using std::tanh;
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> tanh(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> tanh(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(tanh, v); return detail::functor1<D, T, T, P>::call(tanh, v);
} }
// asinh // asinh
@ -145,10 +145,10 @@ namespace glm
} }
# endif # endif
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> asinh(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> asinh(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(asinh, v); return detail::functor1<D, T, T, P>::call(asinh, v);
} }
// acosh // acosh
@ -166,10 +166,10 @@ namespace glm
} }
# endif # endif
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> acosh(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> acosh(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(acosh, v); return detail::functor1<D, T, T, P>::call(acosh, v);
} }
// atanh // atanh
@ -187,10 +187,10 @@ namespace glm
} }
# endif # endif
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> atanh(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> atanh(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(atanh, v); return detail::functor1<D, T, T, P>::call(atanh, v);
} }
}//namespace glm }//namespace glm

View File

@ -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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, bool, P> lessThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns the component-wise comparison of result x <= 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, bool, P> lessThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns the component-wise comparison of result x > 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, bool, P> greaterThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns the component-wise comparison of result x >= 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, bool, P> greaterThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns the component-wise comparison of result x == 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, bool, P> equal(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns the component-wise comparison of result x != 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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, bool, P> notEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns true if any component of x is true. /// 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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool any(vecType<bool, P> const & v); GLM_FUNC_DECL bool any(vecType<D, bool, P> const & v);
/// Returns true if all components of x are true. /// 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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool all(vecType<bool, P> const & v); GLM_FUNC_DECL bool all(vecType<D, bool, P> const & v);
/// Returns the component-wise logical complement of x. /// Returns the component-wise logical complement of x.
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead. /// /!\ 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/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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> not_(vecType<bool, P> const & v); GLM_FUNC_DECL vecType<D, bool, P> not_(vecType<D, bool, P> const & v);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -5,75 +5,75 @@
namespace glm namespace glm
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, bool, P> lessThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
assert(x.length() == y.length()); assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i]; Result[i] = x[i] < y[i];
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, bool, P> lessThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
assert(x.length() == y.length()); assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i]; Result[i] = x[i] <= y[i];
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, bool, P> greaterThan(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
assert(x.length() == y.length()); assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i]; Result[i] = x[i] > y[i];
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, bool, P> greaterThanEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
assert(x.length() == y.length()); assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i]; Result[i] = x[i] >= y[i];
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, bool, P> equal(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
assert(x.length() == y.length()); assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i]; Result[i] = x[i] == y[i];
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, bool, P> notEqual(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
assert(x.length() == y.length()); assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < x.length(); ++i) for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i]; Result[i] = x[i] != y[i];
return Result; return Result;
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool any(vecType<bool, P> const & v) GLM_FUNC_QUALIFIER bool any(vecType<D, bool, P> const & v)
{ {
bool Result = false; bool Result = false;
for(length_t i = 0; i < v.length(); ++i) for(length_t i = 0; i < v.length(); ++i)
@ -81,8 +81,8 @@ namespace glm
return Result; return Result;
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool all(vecType<bool, P> const & v) GLM_FUNC_QUALIFIER bool all(vecType<D, bool, P> const & v)
{ {
bool Result = true; bool Result = true;
for(length_t i = 0; i < v.length(); ++i) for(length_t i = 0; i < v.length(); ++i)
@ -90,10 +90,10 @@ namespace glm
return Result; return Result;
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> not_(vecType<bool, P> const & v) GLM_FUNC_QUALIFIER vecType<D, bool, P> not_(vecType<D, bool, P> const & v)
{ {
vecType<bool, P> Result(uninitialize); vecType<D, bool, P> Result(uninitialize);
for(length_t i = 0; i < v.length(); ++i) for(length_t i = 0; i < v.length(); ++i)
Result[i] = !v[i]; Result[i] = !v[i];
return Result; return Result;

View File

@ -9,140 +9,140 @@
namespace glm namespace glm
{ {
// tvec1 type explicit instantiation // tvec1 type explicit instantiation
template struct tvec1<uint8, lowp>; template struct tvec<1, uint8, lowp>;
template struct tvec1<uint16, lowp>; template struct tvec<1, uint16, lowp>;
template struct tvec1<uint32, lowp>; template struct tvec<1, uint32, lowp>;
template struct tvec1<uint64, lowp>; template struct tvec<1, uint64, lowp>;
template struct tvec1<int8, lowp>; template struct tvec<1, int8, lowp>;
template struct tvec1<int16, lowp>; template struct tvec<1, int16, lowp>;
template struct tvec1<int32, lowp>; template struct tvec<1, int32, lowp>;
template struct tvec1<int64, lowp>; template struct tvec<1, int64, lowp>;
template struct tvec1<float32, lowp>; template struct tvec<1, float32, lowp>;
template struct tvec1<float64, lowp>; template struct tvec<1, float64, lowp>;
template struct tvec1<uint8, mediump>; template struct tvec<1, uint8, mediump>;
template struct tvec1<uint16, mediump>; template struct tvec<1, uint16, mediump>;
template struct tvec1<uint32, mediump>; template struct tvec<1, uint32, mediump>;
template struct tvec1<uint64, mediump>; template struct tvec<1, uint64, mediump>;
template struct tvec1<int8, mediump>; template struct tvec<1, int8, mediump>;
template struct tvec1<int16, mediump>; template struct tvec<1, int16, mediump>;
template struct tvec1<int32, mediump>; template struct tvec<1, int32, mediump>;
template struct tvec1<int64, mediump>; template struct tvec<1, int64, mediump>;
template struct tvec1<float32, mediump>; template struct tvec<1, float32, mediump>;
template struct tvec1<float64, mediump>; template struct tvec<1, float64, mediump>;
template struct tvec1<uint8, highp>; template struct tvec<1, uint8, highp>;
template struct tvec1<uint16, highp>; template struct tvec<1, uint16, highp>;
template struct tvec1<uint32, highp>; template struct tvec<1, uint32, highp>;
template struct tvec1<uint64, highp>; template struct tvec<1, uint64, highp>;
template struct tvec1<int8, highp>; template struct tvec<1, int8, highp>;
template struct tvec1<int16, highp>; template struct tvec<1, int16, highp>;
template struct tvec1<int32, highp>; template struct tvec<1, int32, highp>;
template struct tvec1<int64, highp>; template struct tvec<1, int64, highp>;
template struct tvec1<float32, highp>; template struct tvec<1, float32, highp>;
template struct tvec1<float64, highp>; template struct tvec<1, float64, highp>;
// tvec2 type explicit instantiation // tvec2 type explicit instantiation
template struct tvec2<uint8, lowp>; template struct tvec<2, uint8, lowp>;
template struct tvec2<uint16, lowp>; template struct tvec<2, uint16, lowp>;
template struct tvec2<uint32, lowp>; template struct tvec<2, uint32, lowp>;
template struct tvec2<uint64, lowp>; template struct tvec<2, uint64, lowp>;
template struct tvec2<int8, lowp>; template struct tvec<2, int8, lowp>;
template struct tvec2<int16, lowp>; template struct tvec<2, int16, lowp>;
template struct tvec2<int32, lowp>; template struct tvec<2, int32, lowp>;
template struct tvec2<int64, lowp>; template struct tvec<2, int64, lowp>;
template struct tvec2<float32, lowp>; template struct tvec<2, float32, lowp>;
template struct tvec2<float64, lowp>; template struct tvec<2, float64, lowp>;
template struct tvec2<uint8, mediump>; template struct tvec<2, uint8, mediump>;
template struct tvec2<uint16, mediump>; template struct tvec<2, uint16, mediump>;
template struct tvec2<uint32, mediump>; template struct tvec<2, uint32, mediump>;
template struct tvec2<uint64, mediump>; template struct tvec<2, uint64, mediump>;
template struct tvec2<int8, mediump>; template struct tvec<2, int8, mediump>;
template struct tvec2<int16, mediump>; template struct tvec<2, int16, mediump>;
template struct tvec2<int32, mediump>; template struct tvec<2, int32, mediump>;
template struct tvec2<int64, mediump>; template struct tvec<2, int64, mediump>;
template struct tvec2<float32, mediump>; template struct tvec<2, float32, mediump>;
template struct tvec2<float64, mediump>; template struct tvec<2, float64, mediump>;
template struct tvec2<uint8, highp>; template struct tvec<2, uint8, highp>;
template struct tvec2<uint16, highp>; template struct tvec<2, uint16, highp>;
template struct tvec2<uint32, highp>; template struct tvec<2, uint32, highp>;
template struct tvec2<uint64, highp>; template struct tvec<2, uint64, highp>;
template struct tvec2<int8, highp>; template struct tvec<2, int8, highp>;
template struct tvec2<int16, highp>; template struct tvec<2, int16, highp>;
template struct tvec2<int32, highp>; template struct tvec<2, int32, highp>;
template struct tvec2<int64, highp>; template struct tvec<2, int64, highp>;
template struct tvec2<float32, highp>; template struct tvec<2, float32, highp>;
template struct tvec2<float64, highp>; template struct tvec<2, float64, highp>;
// tvec3 type explicit instantiation // tvec3 type explicit instantiation
template struct tvec3<uint8, lowp>; template struct tvec<3, uint8, lowp>;
template struct tvec3<uint16, lowp>; template struct tvec<3, uint16, lowp>;
template struct tvec3<uint32, lowp>; template struct tvec<3, uint32, lowp>;
template struct tvec3<uint64, lowp>; template struct tvec<3, uint64, lowp>;
template struct tvec3<int8, lowp>; template struct tvec<3, int8, lowp>;
template struct tvec3<int16, lowp>; template struct tvec<3, int16, lowp>;
template struct tvec3<int32, lowp>; template struct tvec<3, int32, lowp>;
template struct tvec3<int64, lowp>; template struct tvec<3, int64, lowp>;
template struct tvec3<float32, lowp>; template struct tvec<3, float32, lowp>;
template struct tvec3<float64, lowp>; template struct tvec<3, float64, lowp>;
template struct tvec3<uint8, mediump>; template struct tvec<3, uint8, mediump>;
template struct tvec3<uint16, mediump>; template struct tvec<3, uint16, mediump>;
template struct tvec3<uint32, mediump>; template struct tvec<3, uint32, mediump>;
template struct tvec3<uint64, mediump>; template struct tvec<3, uint64, mediump>;
template struct tvec3<int8, mediump>; template struct tvec<3, int8, mediump>;
template struct tvec3<int16, mediump>; template struct tvec<3, int16, mediump>;
template struct tvec3<int32, mediump>; template struct tvec<3, int32, mediump>;
template struct tvec3<int64, mediump>; template struct tvec<3, int64, mediump>;
template struct tvec3<float32, mediump>; template struct tvec<3, float32, mediump>;
template struct tvec3<float64, mediump>; template struct tvec<3, float64, mediump>;
template struct tvec3<uint8, highp>; template struct tvec<3, uint8, highp>;
template struct tvec3<uint16, highp>; template struct tvec<3, uint16, highp>;
template struct tvec3<uint32, highp>; template struct tvec<3, uint32, highp>;
template struct tvec3<uint64, highp>; template struct tvec<3, uint64, highp>;
template struct tvec3<int8, highp>; template struct tvec<3, int8, highp>;
template struct tvec3<int16, highp>; template struct tvec<3, int16, highp>;
template struct tvec3<int32, highp>; template struct tvec<3, int32, highp>;
template struct tvec3<int64, highp>; template struct tvec<3, int64, highp>;
template struct tvec3<float32, highp>; template struct tvec<3, float32, highp>;
template struct tvec3<float64, highp>; template struct tvec<3, float64, highp>;
// tvec4 type explicit instantiation // tvec4 type explicit instantiation
template struct tvec4<uint8, lowp>; template struct tvec<4, uint8, lowp>;
template struct tvec4<uint16, lowp>; template struct tvec<4, uint16, lowp>;
template struct tvec4<uint32, lowp>; template struct tvec<4, uint32, lowp>;
template struct tvec4<uint64, lowp>; template struct tvec<4, uint64, lowp>;
template struct tvec4<int8, lowp>; template struct tvec<4, int8, lowp>;
template struct tvec4<int16, lowp>; template struct tvec<4, int16, lowp>;
template struct tvec4<int32, lowp>; template struct tvec<4, int32, lowp>;
template struct tvec4<int64, lowp>; template struct tvec<4, int64, lowp>;
template struct tvec4<float32, lowp>; template struct tvec<4, float32, lowp>;
template struct tvec4<float64, lowp>; template struct tvec<4, float64, lowp>;
template struct tvec4<uint8, mediump>; template struct tvec<4, uint8, mediump>;
template struct tvec4<uint16, mediump>; template struct tvec<4, uint16, mediump>;
template struct tvec4<uint32, mediump>; template struct tvec<4, uint32, mediump>;
template struct tvec4<uint64, mediump>; template struct tvec<4, uint64, mediump>;
template struct tvec4<int8, mediump>; template struct tvec<4, int8, mediump>;
template struct tvec4<int16, mediump>; template struct tvec<4, int16, mediump>;
template struct tvec4<int32, mediump>; template struct tvec<4, int32, mediump>;
template struct tvec4<int64, mediump>; template struct tvec<4, int64, mediump>;
template struct tvec4<float32, mediump>; template struct tvec<4, float32, mediump>;
template struct tvec4<float64, mediump>; template struct tvec<4, float64, mediump>;
template struct tvec4<uint8, highp>; template struct tvec<4, uint8, highp>;
template struct tvec4<uint16, highp>; template struct tvec<4, uint16, highp>;
template struct tvec4<uint32, highp>; template struct tvec<4, uint32, highp>;
template struct tvec4<uint64, highp>; template struct tvec<4, uint64, highp>;
template struct tvec4<int8, highp>; template struct tvec<4, int8, highp>;
template struct tvec4<int16, highp>; template struct tvec<4, int16, highp>;
template struct tvec4<int32, highp>; template struct tvec<4, int32, highp>;
template struct tvec4<int64, highp>; template struct tvec<4, int64, highp>;
template struct tvec4<float32, highp>; template struct tvec<4, float32, highp>;
template struct tvec4<float64, highp>; template struct tvec<4, float64, highp>;
// tmat2x2 type explicit instantiation // tmat2x2 type explicit instantiation
template struct tmat2x2<float32, lowp>; template struct tmat2x2<float32, lowp>;

View File

@ -8,13 +8,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <class, precision> class colType, template <class, precision> class rowType> template <int Columns, int Rows, typename T, precision P, template <int, class, precision> class colType, template <int, class, precision> class rowType>
struct outerProduct_trait{}; struct outerProduct_trait{};
}//namespace detail }//namespace detail
template <typename T, precision P> struct tvec2; template <int D, typename T, precision P> struct tvec;
template <typename T, precision P> struct tvec3;
template <typename T, precision P> struct tvec4;
template <typename T, precision P> struct tmat2x2; template <typename T, precision P> struct tmat2x2;
template <typename T, precision P> struct tmat2x3; template <typename T, precision P> struct tmat2x3;
template <typename T, precision P> struct tmat2x4; template <typename T, precision P> struct tmat2x4;

View File

@ -101,10 +101,12 @@ namespace detail
# endif # endif
}//namespace detail }//namespace detail
template <typename T, precision P> struct tvec1; template <int D, typename T, precision P = defaultp> struct tvec;
template <typename T, precision P> struct tvec2;
template <typename T, precision P> struct tvec3; template <typename T, precision P = defaultp> using tvec1 = tvec<1, T, P>;
template <typename T, precision P> struct tvec4; template <typename T, precision P = defaultp> using tvec2 = tvec<2, T, P>;
template <typename T, precision P = defaultp> using tvec3 = tvec<3, T, P>;
template <typename T, precision P = defaultp> using tvec4 = tvec<4, T, P>;
typedef tvec1<float, highp> highp_vec1_t; typedef tvec1<float, highp> highp_vec1_t;
typedef tvec1<float, mediump> mediump_vec1_t; typedef tvec1<float, mediump> mediump_vec1_t;

View File

@ -16,14 +16,14 @@
namespace glm namespace glm
{ {
template <typename T, precision P = defaultp> template <typename T, precision P>
struct tvec1 struct tvec<1, T, P>
{ {
// -- Implementation detail -- // -- Implementation detail --
typedef T value_type; typedef T value_type;
typedef tvec1<T, P> type; typedef tvec type;
typedef tvec1<bool, P> bool_type; typedef tvec<1, bool, P> bool_type;
// -- Data -- // -- Data --
@ -82,37 +82,37 @@ namespace glm
// -- Implicit basic constructors -- // -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tvec1() GLM_DEFAULT_CTOR; GLM_FUNC_DECL GLM_CONSTEXPR tvec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1<T, P> const & v) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec const & v) GLM_DEFAULT;
template <precision Q> template <precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec1(tvec1<T, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec<1, T, Q> const & v);
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec1(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec1(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec(T scalar);
// -- Conversion vector constructors -- // -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec2<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec2<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec3<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec3<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec4<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec1(tvec1<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec<1, U, Q> const & v);
// -- Swizzle constructors -- // -- Swizzle constructors --
/* /*
# if(GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)) # if(GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED))
template <int E0> template <int E0>
GLM_FUNC_DECL tvec1(detail::_swizzle<1, T, P, tvec1, E0, -1,-2,-3> const & that) GLM_FUNC_DECL tvec(detail::_swizzle<1, T, P, tvec1, E0, -1,-2,-3> const & that)
{ {
*this = that(); *this = that();
} }
@ -120,178 +120,178 @@ namespace glm
*/ */
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<T, P> const & v) GLM_DEFAULT; GLM_FUNC_DECL tvec & operator=(tvec const & v) GLM_DEFAULT;
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator+=(U scalar); GLM_FUNC_DECL tvec & operator+=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator+=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator+=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator-=(U scalar); GLM_FUNC_DECL tvec & operator-=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator-=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator-=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator*=(U scalar); GLM_FUNC_DECL tvec & operator*=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator*=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator*=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator/=(U scalar); GLM_FUNC_DECL tvec & operator/=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator/=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator/=(tvec<1, U, P> const & v);
// -- Increment and decrement operators -- // -- Increment and decrement operators --
GLM_FUNC_DECL tvec1<T, P> & operator++(); GLM_FUNC_DECL tvec & operator++();
GLM_FUNC_DECL tvec1<T, P> & operator--(); GLM_FUNC_DECL tvec & operator--();
GLM_FUNC_DECL tvec1<T, P> operator++(int); GLM_FUNC_DECL tvec operator++(int);
GLM_FUNC_DECL tvec1<T, P> operator--(int); GLM_FUNC_DECL tvec operator--(int);
// -- Unary bit operators -- // -- Unary bit operators --
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator%=(U scalar); GLM_FUNC_DECL tvec & operator%=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator%=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator%=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator&=(U scalar); GLM_FUNC_DECL tvec & operator&=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator&=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator&=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator|=(U scalar); GLM_FUNC_DECL tvec & operator|=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator|=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator|=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator^=(U scalar); GLM_FUNC_DECL tvec & operator^=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator^=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator^=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator<<=(U scalar); GLM_FUNC_DECL tvec & operator<<=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator<<=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator<<=(tvec<1, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator>>=(U scalar); GLM_FUNC_DECL tvec & operator>>=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator>>=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator>>=(tvec<1, U, P> const & v);
}; };
// -- Unary operators -- // -- Unary operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator+(tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator-(tvec<1, T, P> const & v);
// -- Binary operators -- // -- Binary operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator+(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator+(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator+(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator-(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator-(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator-(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator- (tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator- (tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator*(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator*(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator*(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator*(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator/(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator/(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator/(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator/(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator%(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator%(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator%(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator%(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator&(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator&(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator&(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator&(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator|(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator|(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator|(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator|(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator^(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator^(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator^(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator^(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator<<(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator<<(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator<<(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator<<(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<1, T, P> operator>>(tvec<1, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator>>(T scalar, tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator>>(T scalar, tvec<1, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<1, T, P> operator>>(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator~(tvec1<T, P> const & v); GLM_FUNC_DECL tvec<1, T, P> operator~(tvec<1, T, P> const & v);
// -- Boolean operators -- // -- Boolean operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL bool operator==(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL bool operator==(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec1<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL bool operator!=(tvec<1, T, P> const & v1, tvec<1, T, P> const & v2);
template <precision P> template <precision P>
GLM_FUNC_DECL tvec1<bool, P> operator&&(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2); GLM_FUNC_DECL tvec<1, bool, P> operator&&(tvec<1, bool, P> const & v1, tvec<1, bool, P> const & v2);
template <precision P> template <precision P>
GLM_FUNC_DECL tvec1<bool, P> operator||(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2); GLM_FUNC_DECL tvec<1, bool, P> operator||(tvec<1, bool, P> const & v1, tvec<1, bool, P> const & v2);
}//namespace glm }//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -7,7 +7,7 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1() GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec()
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
: x(0) : x(0)
# endif # endif
@ -16,25 +16,25 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(tvec1<T, P> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(tvec1<T, P> const & v)
: x(v.x) : x(v.x)
{} {}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS # endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
template <precision Q> template <precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(tvec1<T, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(tvec1<T, Q> const & v)
: x(v.x) : x(v.x)
{} {}
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1<T, P>::tvec1(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec1<T, P>::tvec(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(T scalar)
: x(scalar) : x(scalar)
{} {}
@ -42,25 +42,25 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(tvec1<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(tvec1<U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(tvec2<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(tvec2<U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(tvec3<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(tvec3<U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec1(tvec4<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec1<T, P>::tvec(tvec4<U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
{} {}

View File

@ -15,13 +15,13 @@
namespace glm namespace glm
{ {
template <typename T, precision P = defaultp> template <typename T, precision P>
struct tvec2 struct tvec<2, T, P>
{ {
// -- Implementation detail -- // -- Implementation detail --
typedef T value_type; typedef T value_type;
typedef tvec2<T, P> type; typedef tvec type;
typedef tvec2<bool, P> bool_type; typedef tvec2<bool, P> bool_type;
// -- Data -- // -- Data --
@ -44,15 +44,15 @@ namespace glm
struct{ T s, t; }; struct{ T s, t; };
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
_GLM_SWIZZLE2_2_MEMBERS(T, P, glm::tvec2, x, y) _GLM_SWIZZLE2_2_MEMBERS(T, P, x, y)
_GLM_SWIZZLE2_2_MEMBERS(T, P, glm::tvec2, r, g) _GLM_SWIZZLE2_2_MEMBERS(T, P, r, g)
_GLM_SWIZZLE2_2_MEMBERS(T, P, glm::tvec2, s, t) _GLM_SWIZZLE2_2_MEMBERS(T, P, s, t)
_GLM_SWIZZLE2_3_MEMBERS(T, P, glm::tvec3, x, y) _GLM_SWIZZLE2_3_MEMBERS(T, P, x, y)
_GLM_SWIZZLE2_3_MEMBERS(T, P, glm::tvec3, r, g) _GLM_SWIZZLE2_3_MEMBERS(T, P, r, g)
_GLM_SWIZZLE2_3_MEMBERS(T, P, glm::tvec3, s, t) _GLM_SWIZZLE2_3_MEMBERS(T, P, s, t)
_GLM_SWIZZLE2_4_MEMBERS(T, P, glm::tvec4, x, y) _GLM_SWIZZLE2_4_MEMBERS(T, P, x, y)
_GLM_SWIZZLE2_4_MEMBERS(T, P, glm::tvec4, r, g) _GLM_SWIZZLE2_4_MEMBERS(T, P, r, g)
_GLM_SWIZZLE2_4_MEMBERS(T, P, glm::tvec4, s, t) _GLM_SWIZZLE2_4_MEMBERS(T, P, s, t)
# endif//GLM_SWIZZLE # endif//GLM_SWIZZLE
}; };
@ -83,42 +83,42 @@ namespace glm
// -- Implicit basic constructors -- // -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tvec2() GLM_DEFAULT_CTOR; GLM_FUNC_DECL GLM_CONSTEXPR tvec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2<T, P> const& v) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec const& v) GLM_DEFAULT;
template <precision Q> template <precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec2<T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec2<T, Q> const& v);
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec2(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec2(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(T s1, T s2); GLM_FUNC_DECL GLM_CONSTEXPR tvec(T s1, T s2);
// -- Conversion constructors -- // -- Conversion constructors --
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B> template <typename A, typename B>
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(A x, B y); GLM_FUNC_DECL GLM_CONSTEXPR tvec(A x, B y);
template <typename A, typename B> template <typename A, typename B>
GLM_FUNC_DECL GLM_CONSTEXPR tvec2(tvec1<A, P> const & v1, tvec1<B, P> const & v2); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec1<A, P> const & v1, tvec1<B, P> const & v2);
// -- Conversion vector constructors -- // -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec3<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec3<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec4<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec2(tvec2<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec2<U, Q> const & v);
// -- Swizzle constructors -- // -- Swizzle constructors --
# if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec2(detail::_swizzle<2, T, P, glm::tvec2, E0, E1,-1,-2> const& that) GLM_FUNC_DECL tvec(detail::_swizzle<2, T, P, E0, E1,-1,-2> const& that)
{ {
*this = that(); *this = that();
} }
@ -126,80 +126,80 @@ namespace glm
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --
GLM_FUNC_DECL tvec2<T, P>& operator=(tvec2<T, P> const & v) GLM_DEFAULT; GLM_FUNC_DECL tvec& operator=(tvec const & v) GLM_DEFAULT;
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec& operator=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator+=(U scalar); GLM_FUNC_DECL tvec& operator+=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator+=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec& operator+=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator+=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec& operator+=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator-=(U scalar); GLM_FUNC_DECL tvec& operator-=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator-=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec& operator-=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator-=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec& operator-=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator*=(U scalar); GLM_FUNC_DECL tvec& operator*=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator*=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec& operator*=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator*=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec& operator*=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator/=(U scalar); GLM_FUNC_DECL tvec& operator/=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator/=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec& operator/=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator/=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec& operator/=(tvec2<U, P> const & v);
// -- Increment and decrement operators -- // -- Increment and decrement operators --
GLM_FUNC_DECL tvec2<T, P> & operator++(); GLM_FUNC_DECL tvec & operator++();
GLM_FUNC_DECL tvec2<T, P> & operator--(); GLM_FUNC_DECL tvec & operator--();
GLM_FUNC_DECL tvec2<T, P> operator++(int); GLM_FUNC_DECL tvec operator++(int);
GLM_FUNC_DECL tvec2<T, P> operator--(int); GLM_FUNC_DECL tvec operator--(int);
// -- Unary bit operators -- // -- Unary bit operators --
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%=(U scalar); GLM_FUNC_DECL tvec & operator%=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator%=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec & operator%=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&=(U scalar); GLM_FUNC_DECL tvec & operator&=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator&=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec & operator&=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|=(U scalar); GLM_FUNC_DECL tvec & operator|=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator|=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec & operator|=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^=(U scalar); GLM_FUNC_DECL tvec & operator^=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator^=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec & operator^=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U scalar); GLM_FUNC_DECL tvec & operator<<=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator<<=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec & operator<<=(tvec2<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U scalar); GLM_FUNC_DECL tvec & operator>>=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator>>=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec2<U, P> const & v); GLM_FUNC_DECL tvec & operator>>=(tvec2<U, P> const & v);
}; };
// -- Unary operators -- // -- Unary operators --

View File

@ -7,7 +7,7 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2() GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec()
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
: x(0), y(0) : x(0), y(0)
# endif # endif
@ -16,30 +16,30 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(tvec2<T, P> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(tvec<2, T, P> const & v)
: x(v.x), y(v.y) : x(v.x), y(v.y)
{} {}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS # endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
template <precision Q> template <precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(tvec2<T, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(tvec<2, T, Q> const & v)
: x(v.x), y(v.y) : x(v.x), y(v.y)
{} {}
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(ctor) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec<2, T, P>::tvec(ctor)
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(T scalar)
: x(scalar), y(scalar) : x(scalar), y(scalar)
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(T s1, T s2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(T s1, T s2)
: x(s1), y(s2) : x(s1), y(s2)
{} {}
@ -47,14 +47,14 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B> template <typename A, typename B>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(A a, B b) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(A a, B b)
: x(static_cast<T>(a)) : x(static_cast<T>(a))
, y(static_cast<T>(b)) , y(static_cast<T>(b))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B> template <typename A, typename B>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(tvec1<A, P> const & a, tvec1<B, P> const & b) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(tvec1<A, P> const & a, tvec1<B, P> const & b)
: x(static_cast<T>(a.x)) : x(static_cast<T>(a.x))
, y(static_cast<T>(b.x)) , y(static_cast<T>(b.x))
{} {}
@ -63,21 +63,21 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(tvec2<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(tvec<2, U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
, y(static_cast<T>(v.y)) , y(static_cast<T>(v.y))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(tvec3<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(tvec3<U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
, y(static_cast<T>(v.y)) , y(static_cast<T>(v.y))
{} {}
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec2<T, P>::tvec2(tvec4<U, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR tvec<2, T, P>::tvec(tvec4<U, Q> const & v)
: x(static_cast<T>(v.x)) : x(static_cast<T>(v.x))
, y(static_cast<T>(v.y)) , y(static_cast<T>(v.y))
{} {}
@ -85,14 +85,14 @@ namespace glm
// -- Component accesses -- // -- Component accesses --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) GLM_FUNC_QUALIFIER T & tvec<2, T, P>::operator[](typename tvec<2, T, P>::length_type i)
{ {
assert(i >= 0 && i < this->length()); assert(i >= 0 && i < this->length());
return (&x)[i]; return (&x)[i];
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) const GLM_FUNC_QUALIFIER T const & tvec<2, T, P>::operator[](typename tvec<2, T, P>::length_type i) const
{ {
assert(i >= 0 && i < this->length()); assert(i >= 0 && i < this->length());
return (&x)[i]; return (&x)[i];
@ -102,7 +102,7 @@ namespace glm
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator=(tvec<2, T, P> const & v)
{ {
this->x = v.x; this->x = v.x;
this->y = v.y; this->y = v.y;
@ -112,7 +112,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator=(tvec<2, U, P> const & v)
{ {
this->x = static_cast<T>(v.x); this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y); this->y = static_cast<T>(v.y);
@ -121,7 +121,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator+=(U scalar)
{ {
this->x += static_cast<T>(scalar); this->x += static_cast<T>(scalar);
this->y += static_cast<T>(scalar); this->y += static_cast<T>(scalar);
@ -130,7 +130,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator+=(tvec1<U, P> const & v)
{ {
this->x += static_cast<T>(v.x); this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.x); this->y += static_cast<T>(v.x);
@ -139,7 +139,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator+=(tvec<2, U, P> const & v)
{ {
this->x += static_cast<T>(v.x); this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.y); this->y += static_cast<T>(v.y);
@ -148,7 +148,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator-=(U scalar)
{ {
this->x -= static_cast<T>(scalar); this->x -= static_cast<T>(scalar);
this->y -= static_cast<T>(scalar); this->y -= static_cast<T>(scalar);
@ -157,7 +157,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator-=(tvec1<U, P> const & v)
{ {
this->x -= static_cast<T>(v.x); this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.x); this->y -= static_cast<T>(v.x);
@ -166,7 +166,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator-=(tvec<2, U, P> const & v)
{ {
this->x -= static_cast<T>(v.x); this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.y); this->y -= static_cast<T>(v.y);
@ -175,7 +175,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator*=(U scalar)
{ {
this->x *= static_cast<T>(scalar); this->x *= static_cast<T>(scalar);
this->y *= static_cast<T>(scalar); this->y *= static_cast<T>(scalar);
@ -184,7 +184,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator*=(tvec1<U, P> const & v)
{ {
this->x *= static_cast<T>(v.x); this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.x); this->y *= static_cast<T>(v.x);
@ -193,7 +193,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator*=(tvec<2, U, P> const & v)
{ {
this->x *= static_cast<T>(v.x); this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.y); this->y *= static_cast<T>(v.y);
@ -202,7 +202,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator/=(U scalar)
{ {
this->x /= static_cast<T>(scalar); this->x /= static_cast<T>(scalar);
this->y /= static_cast<T>(scalar); this->y /= static_cast<T>(scalar);
@ -211,7 +211,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator/=(tvec1<U, P> const & v)
{ {
this->x /= static_cast<T>(v.x); this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.x); this->y /= static_cast<T>(v.x);
@ -220,7 +220,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator/=(tvec<2, U, P> const & v)
{ {
this->x /= static_cast<T>(v.x); this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.y); this->y /= static_cast<T>(v.y);
@ -230,7 +230,7 @@ namespace glm
// -- Increment and decrement operators -- // -- Increment and decrement operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator++() GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator++()
{ {
++this->x; ++this->x;
++this->y; ++this->y;
@ -238,7 +238,7 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator--() GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator--()
{ {
--this->x; --this->x;
--this->y; --this->y;
@ -246,17 +246,17 @@ namespace glm
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::operator++(int) GLM_FUNC_QUALIFIER tvec<2, T, P> tvec<2, T, P>::operator++(int)
{ {
tvec2<T, P> Result(*this); tvec<2, T, P> Result(*this);
++*this; ++*this;
return Result; return Result;
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::operator--(int) GLM_FUNC_QUALIFIER tvec<2, T, P> tvec<2, T, P>::operator--(int)
{ {
tvec2<T, P> Result(*this); tvec<2, T, P> Result(*this);
--*this; --*this;
return Result; return Result;
} }
@ -265,7 +265,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator%=(U scalar)
{ {
this->x %= static_cast<T>(scalar); this->x %= static_cast<T>(scalar);
this->y %= static_cast<T>(scalar); this->y %= static_cast<T>(scalar);
@ -274,7 +274,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator%=(tvec1<U, P> const & v)
{ {
this->x %= static_cast<T>(v.x); this->x %= static_cast<T>(v.x);
this->y %= static_cast<T>(v.x); this->y %= static_cast<T>(v.x);
@ -283,7 +283,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator%=(tvec<2, U, P> const & v)
{ {
this->x %= static_cast<T>(v.x); this->x %= static_cast<T>(v.x);
this->y %= static_cast<T>(v.y); this->y %= static_cast<T>(v.y);
@ -292,7 +292,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator&=(U scalar)
{ {
this->x &= static_cast<T>(scalar); this->x &= static_cast<T>(scalar);
this->y &= static_cast<T>(scalar); this->y &= static_cast<T>(scalar);
@ -301,7 +301,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator&=(tvec1<U, P> const & v)
{ {
this->x &= static_cast<T>(v.x); this->x &= static_cast<T>(v.x);
this->y &= static_cast<T>(v.x); this->y &= static_cast<T>(v.x);
@ -310,7 +310,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator&=(tvec<2, U, P> const & v)
{ {
this->x &= static_cast<T>(v.x); this->x &= static_cast<T>(v.x);
this->y &= static_cast<T>(v.y); this->y &= static_cast<T>(v.y);
@ -319,7 +319,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator|=(U scalar)
{ {
this->x |= static_cast<T>(scalar); this->x |= static_cast<T>(scalar);
this->y |= static_cast<T>(scalar); this->y |= static_cast<T>(scalar);
@ -328,7 +328,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator|=(tvec1<U, P> const & v)
{ {
this->x |= static_cast<T>(v.x); this->x |= static_cast<T>(v.x);
this->y |= static_cast<T>(v.x); this->y |= static_cast<T>(v.x);
@ -337,7 +337,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator|=(tvec<2, U, P> const & v)
{ {
this->x |= static_cast<T>(v.x); this->x |= static_cast<T>(v.x);
this->y |= static_cast<T>(v.y); this->y |= static_cast<T>(v.y);
@ -346,7 +346,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator^=(U scalar)
{ {
this->x ^= static_cast<T>(scalar); this->x ^= static_cast<T>(scalar);
this->y ^= static_cast<T>(scalar); this->y ^= static_cast<T>(scalar);
@ -355,7 +355,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator^=(tvec1<U, P> const & v)
{ {
this->x ^= static_cast<T>(v.x); this->x ^= static_cast<T>(v.x);
this->y ^= static_cast<T>(v.x); this->y ^= static_cast<T>(v.x);
@ -364,7 +364,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator^=(tvec<2, U, P> const & v)
{ {
this->x ^= static_cast<T>(v.x); this->x ^= static_cast<T>(v.x);
this->y ^= static_cast<T>(v.y); this->y ^= static_cast<T>(v.y);
@ -373,7 +373,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator<<=(U scalar)
{ {
this->x <<= static_cast<T>(scalar); this->x <<= static_cast<T>(scalar);
this->y <<= static_cast<T>(scalar); this->y <<= static_cast<T>(scalar);
@ -382,7 +382,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator<<=(tvec1<U, P> const & v)
{ {
this->x <<= static_cast<T>(v.x); this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.x); this->y <<= static_cast<T>(v.x);
@ -391,7 +391,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator<<=(tvec<2, U, P> const & v)
{ {
this->x <<= static_cast<T>(v.x); this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.y); this->y <<= static_cast<T>(v.y);
@ -400,7 +400,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(U scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator>>=(U scalar)
{ {
this->x >>= static_cast<T>(scalar); this->x >>= static_cast<T>(scalar);
this->y >>= static_cast<T>(scalar); this->y >>= static_cast<T>(scalar);
@ -409,7 +409,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(tvec1<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator>>=(tvec1<U, P> const & v)
{ {
this->x >>= static_cast<T>(v.x); this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.x); this->y >>= static_cast<T>(v.x);
@ -418,7 +418,7 @@ namespace glm
template <typename T, precision P> template <typename T, precision P>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(tvec2<U, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> & tvec<2, T, P>::operator>>=(tvec<2, U, P> const & v)
{ {
this->x >>= static_cast<T>(v.x); this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y); this->y >>= static_cast<T>(v.y);
@ -428,15 +428,15 @@ namespace glm
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator+(tvec<2, T, P> const & v)
{ {
return v; return v;
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator-(tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
-v.x, -v.x,
-v.y); -v.y);
} }
@ -444,161 +444,161 @@ namespace glm
// -- Binary arithmetic operators -- // -- Binary arithmetic operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator+(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x + scalar, v.x + scalar,
v.y + scalar); v.y + scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator+(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x + v2.x, v1.x + v2.x,
v1.y + v2.x); v1.y + v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator+(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar + v.x, scalar + v.x,
scalar + v.y); scalar + v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator+(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x + v2.x, v1.x + v2.x,
v1.x + v2.y); v1.x + v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator+(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x + v2.x, v1.x + v2.x,
v1.y + v2.y); v1.y + v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator-(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x - scalar, v.x - scalar,
v.y - scalar); v.y - scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator-(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x - v2.x, v1.x - v2.x,
v1.y - v2.x); v1.y - v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator-(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar - v.x, scalar - v.x,
scalar - v.y); scalar - v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator-(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x - v2.x, v1.x - v2.x,
v1.x - v2.y); v1.x - v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator-(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x - v2.x, v1.x - v2.x,
v1.y - v2.y); v1.y - v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator*(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x * scalar, v.x * scalar,
v.y * scalar); v.y * scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator*(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x * v2.x, v1.x * v2.x,
v1.y * v2.x); v1.y * v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator*(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar * v.x, scalar * v.x,
scalar * v.y); scalar * v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator*(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x * v2.x, v1.x * v2.x,
v1.x * v2.y); v1.x * v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator*(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x * v2.x, v1.x * v2.x,
v1.y * v2.y); v1.y * v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator/(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x / scalar, v.x / scalar,
v.y / scalar); v.y / scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator/(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x / v2.x, v1.x / v2.x,
v1.y / v2.x); v1.y / v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator/(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar / v.x, scalar / v.x,
scalar / v.y); scalar / v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator/(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x / v2.x, v1.x / v2.x,
v1.x / v2.y); v1.x / v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator/(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x / v2.x, v1.x / v2.x,
v1.y / v2.y); v1.y / v2.y);
} }
@ -606,249 +606,249 @@ namespace glm
// -- Binary bit operators -- // -- Binary bit operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator%(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x % scalar, v.x % scalar,
v.y % scalar); v.y % scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator%(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x % v2.x, v1.x % v2.x,
v1.y % v2.x); v1.y % v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator%(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar % v.x, scalar % v.x,
scalar % v.y); scalar % v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator%(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x % v2.x, v1.x % v2.x,
v1.x % v2.y); v1.x % v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator%(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x % v2.x, v1.x % v2.x,
v1.y % v2.y); v1.y % v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator&(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x & scalar, v.x & scalar,
v.y & scalar); v.y & scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator&(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x & v2.x, v1.x & v2.x,
v1.y & v2.x); v1.y & v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator&(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar & v.x, scalar & v.x,
scalar & v.y); scalar & v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator&(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x & v2.x, v1.x & v2.x,
v1.x & v2.y); v1.x & v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator&(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x & v2.x, v1.x & v2.x,
v1.y & v2.y); v1.y & v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator|(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x | scalar, v.x | scalar,
v.y | scalar); v.y | scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator|(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x | v2.x, v1.x | v2.x,
v1.y | v2.x); v1.y | v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator|(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar | v.x, scalar | v.x,
scalar | v.y); scalar | v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator|(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x | v2.x, v1.x | v2.x,
v1.x | v2.y); v1.x | v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator|(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x | v2.x, v1.x | v2.x,
v1.y | v2.y); v1.y | v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator^(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x ^ scalar, v.x ^ scalar,
v.y ^ scalar); v.y ^ scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator^(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x ^ v2.x, v1.x ^ v2.x,
v1.y ^ v2.x); v1.y ^ v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator^(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar ^ v.x, scalar ^ v.x,
scalar ^ v.y); scalar ^ v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator^(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x ^ v2.x, v1.x ^ v2.x,
v1.x ^ v2.y); v1.x ^ v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator^(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x ^ v2.x, v1.x ^ v2.x,
v1.y ^ v2.y); v1.y ^ v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator<<(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x << scalar, v.x << scalar,
v.y << scalar); v.y << scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator<<(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x << v2.x, v1.x << v2.x,
v1.y << v2.x); v1.y << v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator<<(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar << v.x, scalar << v.x,
scalar << v.y); scalar << v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator<<(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x << v2.x, v1.x << v2.x,
v1.x << v2.y); v1.x << v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator<<(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x << v2.x, v1.x << v2.x,
v1.y << v2.y); v1.y << v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec<2, T, P> operator>>(tvec<2, T, P> const & v, T scalar)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v.x >> scalar, v.x >> scalar,
v.y >> scalar); v.y >> scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec1<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator>>(tvec<2, T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x >> v2.x, v1.x >> v2.x,
v1.y >> v2.x); v1.y >> v2.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(T scalar, tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator>>(T scalar, tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
scalar >> v.x, scalar >> v.x,
scalar >> v.y); scalar >> v.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec1<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator>>(tvec1<T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x >> v2.x, v1.x >> v2.x,
v1.x >> v2.y); v1.x >> v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, T, P> operator>>(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
v1.x >> v2.x, v1.x >> v2.x,
v1.y >> v2.y); v1.y >> v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator~(tvec2<T, P> const & v) GLM_FUNC_QUALIFIER tvec<2, T, P> operator~(tvec<2, T, P> const & v)
{ {
return tvec2<T, P>( return tvec<2, T, P>(
~v.x, ~v.x,
~v.y); ~v.y);
} }
@ -856,26 +856,26 @@ namespace glm
// -- Boolean operators -- // -- Boolean operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator==(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER bool operator==(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return (v1.x == v2.x) && (v1.y == v2.y); return (v1.x == v2.x) && (v1.y == v2.y);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER bool operator!=(tvec2<T, P> const & v1, tvec2<T, P> const & v2) GLM_FUNC_QUALIFIER bool operator!=(tvec<2, T, P> const & v1, tvec<2, T, P> const & v2)
{ {
return (v1.x != v2.x) || (v1.y != v2.y); return (v1.x != v2.x) || (v1.y != v2.y);
} }
template <precision P> template <precision P>
GLM_FUNC_QUALIFIER tvec2<bool, P> operator&&(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, bool, P> operator&&(tvec<2, bool, P> const & v1, tvec<2, bool, P> const & v2)
{ {
return tvec2<bool, P>(v1.x && v2.x, v1.y && v2.y); return tvec<2, bool, P>(v1.x && v2.x, v1.y && v2.y);
} }
template <precision P> template <precision P>
GLM_FUNC_QUALIFIER tvec2<bool, P> operator||(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2) GLM_FUNC_QUALIFIER tvec<2, bool, P> operator||(tvec<2, bool, P> const & v1, tvec<2, bool, P> const & v2)
{ {
return tvec2<bool, P>(v1.x || v2.x, v1.y || v2.y); return tvec<2, bool, P>(v1.x || v2.x, v1.y || v2.y);
} }
}//namespace glm }//namespace glm

View File

@ -15,13 +15,13 @@
namespace glm namespace glm
{ {
template <typename T, precision P = defaultp> template <typename T, precision P>
struct tvec3 struct tvec<3, T, P>
{ {
// -- Implementation detail -- // -- Implementation detail --
typedef T value_type; typedef T value_type;
typedef tvec3<T, P> type; typedef tvec type;
typedef tvec3<bool, P> bool_type; typedef tvec3<bool, P> bool_type;
// -- Data -- // -- Data --
@ -44,15 +44,15 @@ namespace glm
struct{ T s, t, p; }; struct{ T s, t, p; };
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
_GLM_SWIZZLE3_2_MEMBERS(T, P, glm::tvec2, x, y, z) _GLM_SWIZZLE3_2_MEMBERS(T, P, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(T, P, glm::tvec2, r, g, b) _GLM_SWIZZLE3_2_MEMBERS(T, P, r, g, b)
_GLM_SWIZZLE3_2_MEMBERS(T, P, glm::tvec2, s, t, p) _GLM_SWIZZLE3_2_MEMBERS(T, P, s, t, p)
_GLM_SWIZZLE3_3_MEMBERS(T, P, glm::tvec3, x, y, z) _GLM_SWIZZLE3_3_MEMBERS(T, P, x, y, z)
_GLM_SWIZZLE3_3_MEMBERS(T, P, glm::tvec3, r, g, b) _GLM_SWIZZLE3_3_MEMBERS(T, P, r, g, b)
_GLM_SWIZZLE3_3_MEMBERS(T, P, glm::tvec3, s, t, p) _GLM_SWIZZLE3_3_MEMBERS(T, P, s, t, p)
_GLM_SWIZZLE3_4_MEMBERS(T, P, glm::tvec4, x, y, z) _GLM_SWIZZLE3_4_MEMBERS(T, P, x, y, z)
_GLM_SWIZZLE3_4_MEMBERS(T, P, glm::tvec4, r, g, b) _GLM_SWIZZLE3_4_MEMBERS(T, P, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, glm::tvec4, s, t, p) _GLM_SWIZZLE3_4_MEMBERS(T, P, s, t, p)
# endif//GLM_SWIZZLE # endif//GLM_SWIZZLE
}; };
@ -83,144 +83,144 @@ namespace glm
// -- Implicit basic constructors -- // -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tvec3() GLM_DEFAULT_CTOR; GLM_FUNC_DECL GLM_CONSTEXPR tvec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3<T, P> const & v) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec const & v) GLM_DEFAULT;
template <precision Q> template <precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec3<T, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec3<T, Q> const & v);
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec3(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tvec(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec3(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR explicit tvec(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(T a, T b, T c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(T a, T b, T c);
// -- Conversion scalar constructors -- // -- Conversion scalar constructors --
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C> template <typename A, typename B, typename C>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(A a, B b, C c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(A a, B b, C c);
template <typename A, typename B, typename C> template <typename A, typename B, typename C>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c);
// -- Conversion vector constructors -- // -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec2<A, Q> const & a, B b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec2<A, Q> const & a, B b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(A a, tvec2<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(A a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec4<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec3(tvec3<U, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec3<U, Q> const & v);
// -- Swizzle constructors -- // -- Swizzle constructors --
# if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
template <int E0, int E1, int E2> template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(detail::_swizzle<3, T, P, glm::tvec3, E0, E1, E2, -1> const & that) GLM_FUNC_DECL tvec(detail::_swizzle<3, T, P, E0, E1, E2, -1> const & that)
{ {
*this = that(); *this = that();
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec3(detail::_swizzle<2, T, P, glm::tvec2, E0, E1, -1, -2> const & v, T const & scalar) GLM_FUNC_DECL tvec(detail::_swizzle<2, T, P, E0, E1, -1, -2> const & v, T const & scalar)
{ {
*this = tvec3<T, P>(v(), scalar); *this = tvec(v(), scalar);
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & scalar, detail::_swizzle<2, T, P, glm::tvec2, E0, E1, -1, -2> const & v) GLM_FUNC_DECL tvec(T const & scalar, detail::_swizzle<2, T, P, E0, E1, -1, -2> const & v)
{ {
*this = tvec3<T, P>(scalar, v()); *this = tvec(scalar, v());
} }
# endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) # endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --
GLM_FUNC_DECL tvec3<T, P> & operator=(tvec3<T, P> const & v) GLM_DEFAULT; GLM_FUNC_DECL tvec & operator=(tvec const & v) GLM_DEFAULT;
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(U scalar); GLM_FUNC_DECL tvec & operator+=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator+=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator+=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(U scalar); GLM_FUNC_DECL tvec & operator-=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator-=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator-=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(U scalar); GLM_FUNC_DECL tvec & operator*=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator*=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator*=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(U scalar); GLM_FUNC_DECL tvec & operator/=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator/=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator/=(tvec3<U, P> const & v);
// -- Increment and decrement operators -- // -- Increment and decrement operators --
GLM_FUNC_DECL tvec3<T, P> & operator++(); GLM_FUNC_DECL tvec & operator++();
GLM_FUNC_DECL tvec3<T, P> & operator--(); GLM_FUNC_DECL tvec & operator--();
GLM_FUNC_DECL tvec3<T, P> operator++(int); GLM_FUNC_DECL tvec operator++(int);
GLM_FUNC_DECL tvec3<T, P> operator--(int); GLM_FUNC_DECL tvec operator--(int);
// -- Unary bit operators -- // -- Unary bit operators --
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(U scalar); GLM_FUNC_DECL tvec & operator%=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator%=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator%=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(U scalar); GLM_FUNC_DECL tvec & operator&=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator&=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator&=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(U scalar); GLM_FUNC_DECL tvec & operator|=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator|=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator|=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(U scalar); GLM_FUNC_DECL tvec & operator^=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator^=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator^=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U scalar); GLM_FUNC_DECL tvec & operator<<=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator<<=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator<<=(tvec3<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U scalar); GLM_FUNC_DECL tvec & operator>>=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec & operator>>=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec3<U, P> const & v); GLM_FUNC_DECL tvec & operator>>=(tvec3<U, P> const & v);
}; };
// -- Unary operators -- // -- Unary operators --

File diff suppressed because it is too large Load Diff

View File

@ -15,14 +15,14 @@
namespace glm namespace glm
{ {
template <typename T, precision P = defaultp> template <typename T, precision P>
struct tvec4 struct tvec<4, T, P>
{ {
// -- Implementation detail -- // -- Implementation detail --
typedef T value_type; typedef T value_type;
typedef tvec4<T, P> type; typedef tvec<4, T, P> type;
typedef tvec4<bool, P> bool_type; typedef tvec<4, bool, P> bool_type;
// -- Data -- // -- Data --
@ -46,15 +46,15 @@ namespace glm
typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<P>::value>::type data; typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<P>::value>::type data;
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
_GLM_SWIZZLE4_2_MEMBERS(T, P, glm::tvec2, x, y, z, w) _GLM_SWIZZLE4_2_MEMBERS(T, P, x, y, z, w)
_GLM_SWIZZLE4_2_MEMBERS(T, P, glm::tvec2, r, g, b, a) _GLM_SWIZZLE4_2_MEMBERS(T, P, r, g, b, a)
_GLM_SWIZZLE4_2_MEMBERS(T, P, glm::tvec2, s, t, p, q) _GLM_SWIZZLE4_2_MEMBERS(T, P, s, t, p, q)
_GLM_SWIZZLE4_3_MEMBERS(T, P, glm::tvec3, x, y, z, w) _GLM_SWIZZLE4_3_MEMBERS(T, P, x, y, z, w)
_GLM_SWIZZLE4_3_MEMBERS(T, P, glm::tvec3, r, g, b, a) _GLM_SWIZZLE4_3_MEMBERS(T, P, r, g, b, a)
_GLM_SWIZZLE4_3_MEMBERS(T, P, glm::tvec3, s, t, p, q) _GLM_SWIZZLE4_3_MEMBERS(T, P, s, t, p, q)
_GLM_SWIZZLE4_4_MEMBERS(T, P, glm::tvec4, x, y, z, w) _GLM_SWIZZLE4_4_MEMBERS(T, P, x, y, z, w)
_GLM_SWIZZLE4_4_MEMBERS(T, P, glm::tvec4, r, g, b, a) _GLM_SWIZZLE4_4_MEMBERS(T, P, r, g, b, a)
_GLM_SWIZZLE4_4_MEMBERS(T, P, glm::tvec4, s, t, p, q) _GLM_SWIZZLE4_4_MEMBERS(T, P, s, t, p, q)
# endif//GLM_SWIZZLE # endif//GLM_SWIZZLE
}; };
@ -86,364 +86,364 @@ namespace glm
// -- Implicit basic constructors -- // -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4() GLM_DEFAULT_CTOR; GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(tvec4<T, P> const& v) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec(tvec<4, T, P> const& v) GLM_DEFAULT;
template <precision Q> template <precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(tvec4<T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec(tvec<4, T, Q> const& v);
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec4(ctor); GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec(ctor);
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec4(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit tvec(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(T a, T b, T c, T d); GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec(T a, T b, T c, T d);
// -- Conversion scalar constructors -- // -- Conversion scalar constructors --
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec4(A a, B b, C c, D d); GLM_FUNC_DECL GLM_CONSTEXPR_SIMD tvec(A a, B b, C c, D d);
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec4(tvec1<A, P> const& a, tvec1<B, P> const& b, tvec1<C, P> const& c, tvec1<D, P> const& d); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR tvec(tvec1<A, P> const& a, tvec1<B, P> const& b, tvec1<C, P> const& c, tvec1<D, P> const& d);
// -- Conversion vector constructors -- // -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2<A, Q> const & a, B b, C c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec2<A, Q> const & a, B b, C c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, tvec2<B, Q> const & b, C c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(A a, tvec2<B, Q> const & b, C c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, B b, tvec2<C, Q> const & c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(A a, B b, tvec2<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q> template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec3<A, Q> const & a, B b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec3<A, Q> const & a, B b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(A a, tvec3<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(A a, tvec3<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q> template <typename A, typename B, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b); GLM_FUNC_DECL GLM_CONSTEXPR tvec(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec4(tvec4<U, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tvec(tvec<4, U, Q> const& v);
// -- Swizzle constructors -- // -- Swizzle constructors --
# if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
template <int E0, int E1, int E2, int E3> template <int E0, int E1, int E2, int E3>
GLM_FUNC_DECL tvec4(detail::_swizzle<4, T, P, glm::tvec4, E0, E1, E2, E3> const & that) GLM_FUNC_DECL tvec(detail::_swizzle<4, T, P, E0, E1, E2, E3> const & that)
{ {
*this = that(); *this = that();
} }
template <int E0, int E1, int F0, int F1> template <int E0, int E1, int F0, int F1>
GLM_FUNC_DECL tvec4(detail::_swizzle<2, T, P, glm::tvec2, E0, E1, -1, -2> const & v, detail::_swizzle<2, T, P, glm::tvec2, F0, F1, -1, -2> const & u) GLM_FUNC_DECL tvec(detail::_swizzle<2, T, P, E0, E1, -1, -2> const & v, detail::_swizzle<2, T, P, F0, F1, -1, -2> const & u)
{ {
*this = tvec4<T, P>(v(), u()); *this = tvec<4, T, P>(v(), u());
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec4(T const & x, T const & y, detail::_swizzle<2, T, P, glm::tvec2, E0, E1, -1, -2> const & v) GLM_FUNC_DECL tvec(T const & x, T const & y, detail::_swizzle<2, T, P, E0, E1, -1, -2> const & v)
{ {
*this = tvec4<T, P>(x, y, v()); *this = tvec<4, T, P>(x, y, v());
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec4(T const & x, detail::_swizzle<2, T, P, glm::tvec2, E0, E1, -1, -2> const & v, T const & w) GLM_FUNC_DECL tvec(T const & x, detail::_swizzle<2, T, P, E0, E1, -1, -2> const & v, T const & w)
{ {
*this = tvec4<T, P>(x, v(), w); *this = tvec<4, T, P>(x, v(), w);
} }
template <int E0, int E1> template <int E0, int E1>
GLM_FUNC_DECL tvec4(detail::_swizzle<2, T, P, glm::tvec2, E0, E1, -1, -2> const & v, T const & z, T const & w) GLM_FUNC_DECL tvec(detail::_swizzle<2, T, P, E0, E1, -1, -2> const & v, T const & z, T const & w)
{ {
*this = tvec4<T, P>(v(), z, w); *this = tvec<4, T, P>(v(), z, w);
} }
template <int E0, int E1, int E2> template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec4(detail::_swizzle<3, T, P, glm::tvec3, E0, E1, E2, -1> const & v, T const & w) GLM_FUNC_DECL tvec(detail::_swizzle<3, T, P, E0, E1, E2, -1> const & v, T const & w)
{ {
*this = tvec4<T, P>(v(), w); *this = tvec<4, T, P>(v(), w);
} }
template <int E0, int E1, int E2> template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec4(T const & x, detail::_swizzle<3, T, P, glm::tvec3, E0, E1, E2, -1> const & v) GLM_FUNC_DECL tvec(T const & x, detail::_swizzle<3, T, P, E0, E1, E2, -1> const & v)
{ {
*this = tvec4<T, P>(x, v()); *this = tvec<4, T, P>(x, v());
} }
# endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED) # endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
// -- Unary arithmetic operators -- // -- Unary arithmetic operators --
GLM_FUNC_DECL tvec4<T, P> & operator=(tvec4<T, P> const & v) GLM_DEFAULT; GLM_FUNC_DECL tvec<4, T, P> & operator=(tvec<4, T, P> const & v) GLM_DEFAULT;
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator+=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator+=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator+=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator-=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator-=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator-=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator*=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec1<U, P> const& v); GLM_FUNC_DECL tvec<4, T, P> & operator*=(tvec1<U, P> const& v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P> const& v); GLM_FUNC_DECL tvec<4, T, P> & operator*=(tvec<4, U, P> const& v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator/=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator/=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator/=(tvec<4, U, P> const & v);
// -- Increment and decrement operators -- // -- Increment and decrement operators --
GLM_FUNC_DECL tvec4<T, P> & operator++(); GLM_FUNC_DECL tvec<4, T, P> & operator++();
GLM_FUNC_DECL tvec4<T, P> & operator--(); GLM_FUNC_DECL tvec<4, T, P> & operator--();
GLM_FUNC_DECL tvec4<T, P> operator++(int); GLM_FUNC_DECL tvec<4, T, P> operator++(int);
GLM_FUNC_DECL tvec4<T, P> operator--(int); GLM_FUNC_DECL tvec<4, T, P> operator--(int);
// -- Unary bit operators -- // -- Unary bit operators --
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator%=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator%=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator%=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator&=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator&=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator&=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator|=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator|=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator|=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator^=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator^=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator^=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator<<=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator<<=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator<<=(tvec<4, U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U scalar); GLM_FUNC_DECL tvec<4, T, P> & operator>>=(U scalar);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec1<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator>>=(tvec1<U, P> const & v);
template <typename U> template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P> const & v); GLM_FUNC_DECL tvec<4, T, P> & operator>>=(tvec<4, U, P> const & v);
}; };
// -- Unary operators -- // -- Unary operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator+(tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator-(tvec<4, T, P> const & v);
// -- Binary operators -- // -- Binary operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator+(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator+(tvec<4, T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator+(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator+(tvec1<T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator+(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator-(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator-(tvec<4, T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator-(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator-(tvec1<T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator-(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator*(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator*(tvec<4, T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator*(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator*(tvec1<T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator*(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator/(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec1<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator/(tvec<4, T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator/(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec1<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator/(tvec1<T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator/(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator%(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & scalar); GLM_FUNC_DECL tvec<4, T, P> operator%(tvec<4, T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator%(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec1<T, P> const & scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator%(tvec1<T, P> const & scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator%(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator&(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & scalar); GLM_FUNC_DECL tvec<4, T, P> operator&(tvec<4, T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator&(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec1<T, P> const & scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator&(tvec1<T, P> const & scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator&(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator|(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & scalar); GLM_FUNC_DECL tvec<4, T, P> operator|(tvec<4, T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator|(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec1<T, P> const & scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator|(tvec1<T, P> const & scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator|(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator^(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & scalar); GLM_FUNC_DECL tvec<4, T, P> operator^(tvec<4, T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator^(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec1<T, P> const & scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator^(tvec1<T, P> const & scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator^(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator<<(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & scalar); GLM_FUNC_DECL tvec<4, T, P> operator<<(tvec<4, T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator<<(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec1<T, P> const & scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator<<(tvec1<T, P> const & scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator<<(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, T scalar); GLM_FUNC_DECL tvec<4, T, P> operator>>(tvec<4, T, P> const & v, T scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & scalar); GLM_FUNC_DECL tvec<4, T, P> operator>>(tvec<4, T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(T scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator>>(T scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec1<T, P> const & scalar, tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator>>(tvec1<T, P> const & scalar, tvec<4, T, P> const & v);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL tvec<4, T, P> operator>>(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator~(tvec4<T, P> const & v); GLM_FUNC_DECL tvec<4, T, P> operator~(tvec<4, T, P> const & v);
// -- Boolean operators -- // -- Boolean operators --
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL bool operator==(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL bool operator==(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2); GLM_FUNC_DECL bool operator!=(tvec<4, T, P> const & v1, tvec<4, T, P> const & v2);
template <precision P> template <precision P>
GLM_FUNC_DECL tvec4<bool, P> operator&&(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2); GLM_FUNC_DECL tvec<4, bool, P> operator&&(tvec<4, bool, P> const & v1, tvec<4, bool, P> const & v2);
template <precision P> template <precision P>
GLM_FUNC_DECL tvec4<bool, P> operator||(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2); GLM_FUNC_DECL tvec<4, bool, P> operator||(tvec<4, bool, P> const & v1, tvec<4, bool, P> const & v2);
}//namespace glm }//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ namespace detail
{ {
# if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
template <precision P, int E0, int E1, int E2, int E3> template <precision P, int E0, int E1, int E2, int E3>
struct _swizzle_base1<4, float, P, glm::tvec4, E0,E1,E2,E3, true> : public _swizzle_base0<float, 4> struct _swizzle_base1<4, float, P, E0,E1,E2,E3, true> : public _swizzle_base0<float, 4>
{ {
GLM_FUNC_QUALIFIER tvec4<float, P> operator ()() const GLM_FUNC_QUALIFIER tvec4<float, P> operator ()() const
{ {
@ -25,7 +25,7 @@ namespace detail
}; };
template <precision P, int E0, int E1, int E2, int E3> template <precision P, int E0, int E1, int E2, int E3>
struct _swizzle_base1<4, int32, P, glm::tvec4, E0,E1,E2,E3, true> : public _swizzle_base0<int32, 4> struct _swizzle_base1<4, int32, P, E0,E1,E2,E3, true> : public _swizzle_base0<int32, 4>
{ {
GLM_FUNC_QUALIFIER tvec4<int32, P> operator ()() const GLM_FUNC_QUALIFIER tvec4<int32, P> operator ()() const
{ {
@ -38,7 +38,7 @@ namespace detail
}; };
template <precision P, int E0, int E1, int E2, int E3> template <precision P, int E0, int E1, int E2, int E3>
struct _swizzle_base1<4, uint32, P, glm::tvec4, E0,E1,E2,E3, true> : public _swizzle_base0<uint32, 4> struct _swizzle_base1<4, uint32, P, E0,E1,E2,E3, true> : public _swizzle_base0<uint32, 4>
{ {
GLM_FUNC_QUALIFIER tvec4<uint32, P> operator ()() const GLM_FUNC_QUALIFIER tvec4<uint32, P> operator ()() const
{ {
@ -341,21 +341,21 @@ namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec4() GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec()
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps()) : data(_mm_setzero_ps())
# endif # endif
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec4() GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec()
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps()) : data(_mm_setzero_ps())
# endif # endif
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec4() GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec()
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps()) : data(_mm_setzero_ps())
# endif # endif
@ -363,117 +363,117 @@ namespace detail
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS # endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec4(float s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec(float s) :
data(_mm_set1_ps(s)) data(_mm_set1_ps(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec4(float s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec(float s) :
data(_mm_set1_ps(s)) data(_mm_set1_ps(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec4(float s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec(float s) :
data(_mm_set1_ps(s)) data(_mm_set1_ps(s))
{} {}
# if GLM_ARCH & GLM_ARCH_AVX_BIT # if GLM_ARCH & GLM_ARCH_AVX_BIT
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_lowp>::tvec4(double s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_lowp>::tvec(double s) :
data(_mm256_set1_pd(s)) data(_mm256_set1_pd(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_mediump>::tvec4(double s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_mediump>::tvec(double s) :
data(_mm256_set1_pd(s)) data(_mm256_set1_pd(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_highp>::tvec4(double s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<double, aligned_highp>::tvec(double s) :
data(_mm256_set1_pd(s)) data(_mm256_set1_pd(s))
{} {}
# endif # endif
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_lowp>::tvec4(int32 s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_lowp>::tvec(int32 s) :
data(_mm_set1_epi32(s)) data(_mm_set1_epi32(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_mediump>::tvec4(int32 s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_mediump>::tvec(int32 s) :
data(_mm_set1_epi32(s)) data(_mm_set1_epi32(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_highp>::tvec4(int32 s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_highp>::tvec(int32 s) :
data(_mm_set1_epi32(s)) data(_mm_set1_epi32(s))
{} {}
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_lowp>::tvec4(int64 s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_lowp>::tvec(int64 s) :
data(_mm256_set1_epi64x(s)) data(_mm256_set1_epi64x(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_mediump>::tvec4(int64 s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_mediump>::tvec(int64 s) :
data(_mm256_set1_epi64x(s)) data(_mm256_set1_epi64x(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_highp>::tvec4(int64 s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int64, aligned_highp>::tvec(int64 s) :
data(_mm256_set1_epi64x(s)) data(_mm256_set1_epi64x(s))
{} {}
# endif # endif
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec4(float a, float b, float c, float d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a)) data(_mm_set_ps(d, c, b, a))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec4(float a, float b, float c, float d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a)) data(_mm_set_ps(d, c, b, a))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec4(float a, float b, float c, float d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a)) data(_mm_set_ps(d, c, b, a))
{} {}
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_lowp>::tvec4(int32 a, int32 b, int32 c, int32 d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_lowp>::tvec(int32 a, int32 b, int32 c, int32 d) :
data(_mm_set_epi32(d, c, b, a)) data(_mm_set_epi32(d, c, b, a))
{} {}
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_mediump>::tvec4(int32 a, int32 b, int32 c, int32 d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_mediump>::tvec(int32 a, int32 b, int32 c, int32 d) :
data(_mm_set_epi32(d, c, b, a)) data(_mm_set_epi32(d, c, b, a))
{} {}
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_highp>::tvec4(int32 a, int32 b, int32 c, int32 d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<int32, aligned_highp>::tvec(int32 a, int32 b, int32 c, int32 d) :
data(_mm_set_epi32(d, c, b, a)) data(_mm_set_epi32(d, c, b, a))
{} {}
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec4(int32 a, int32 b, int32 c, int32 d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_lowp>::tvec(int32 a, int32 b, int32 c, int32 d) :
data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a)))
{} {}
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec4(int32 a, int32 b, int32 c, int32 d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_mediump>::tvec(int32 a, int32 b, int32 c, int32 d) :
data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a)))
{} {}
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec4(int32 a, int32 b, int32 c, int32 d) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD tvec4<float, aligned_highp>::tvec(int32 a, int32 b, int32 c, int32 d) :
data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a))) data(_mm_castsi128_ps(_mm_set_epi32(d, c, b, a)))
{} {}
}//namespace glm }//namespace glm

View File

@ -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. /// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
/// ///
/// @see gtc_bitfield /// @see gtc_bitfield
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldRotateRight(vecType<T, P> const & In, int Shift); GLM_FUNC_DECL vecType<D, T, P> bitfieldRotateRight(vecType<D, 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. /// 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. /// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
/// ///
/// @see gtc_bitfield /// @see gtc_bitfield
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldRotateLeft(vecType<T, P> const & In, int Shift); GLM_FUNC_DECL vecType<D, T, P> bitfieldRotateLeft(vecType<D, T, P> const & In, int Shift);
/// Set to 1 a range of bits. /// Set to 1 a range of bits.
/// ///
@ -74,8 +74,8 @@ namespace glm
/// Set to 1 a range of bits. /// Set to 1 a range of bits.
/// ///
/// @see gtc_bitfield /// @see gtc_bitfield
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldFillOne(vecType<T, P> const & Value, int FirstBit, int BitCount); GLM_FUNC_DECL vecType<D, T, P> bitfieldFillOne(vecType<D, T, P> const & Value, int FirstBit, int BitCount);
/// Set to 0 a range of bits. /// Set to 0 a range of bits.
/// ///
@ -86,8 +86,8 @@ namespace glm
/// Set to 0 a range of bits. /// Set to 0 a range of bits.
/// ///
/// @see gtc_bitfield /// @see gtc_bitfield
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> bitfieldFillZero(vecType<T, P> const & Value, int FirstBit, int BitCount); GLM_FUNC_DECL vecType<D, T, P> bitfieldFillZero(vecType<D, T, P> const & Value, int FirstBit, int BitCount);
/// Interleaves the bits of x and y. /// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y. /// The first bit is the first bit of x followed by the first bit of y.

View File

@ -230,12 +230,12 @@ namespace detail
return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1); return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
} }
template <typename T, precision P, template <typename, precision> class vecIUType> template <int D, typename T, precision P, template <int, typename, precision> class vecIUType>
GLM_FUNC_QUALIFIER vecIUType<T, P> mask(vecIUType<T, P> const& v) GLM_FUNC_QUALIFIER vecIUType<D, T, P> mask(vecIUType<D, T, P> const& v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
return detail::functor1<T, T, P, vecIUType>::call(mask, v); return detail::functor1<D, T, T, P>::call(mask, v);
} }
template <typename genIType> template <typename genIType>
@ -247,8 +247,8 @@ namespace detail
return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift)); return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldRotateRight(vecType<T, P> const & In, int Shift) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldRotateRight(vecType<D, T, P> const & In, int Shift)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateRight' accepts only integer values"); 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)); return (In >> static_cast<genIType>(Shift)) | (In << static_cast<genIType>(BitSize - Shift));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldRotateLeft(vecType<T, P> const& In, int Shift) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldRotateLeft(vecType<D, T, P> const& In, int Shift)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateLeft' accepts only integer values"); 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); return Value | static_cast<genIUType>(mask(BitCount) << FirstBit);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldFillOne(vecType<T, P> const& Value, int FirstBit, int BitCount) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldFillOne(vecType<D, T, P> const& Value, int FirstBit, int BitCount)
{ {
return Value | static_cast<T>(mask(BitCount) << FirstBit); return Value | static_cast<T>(mask(BitCount) << FirstBit);
} }
@ -292,8 +292,8 @@ namespace detail
return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit)); return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldFillZero(vecType<T, P> const& Value, int FirstBit, int BitCount) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldFillZero(vecType<D, T, P> const& Value, int FirstBit, int BitCount)
{ {
return Value & static_cast<T>(~(mask(BitCount) << FirstBit)); return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
} }

View File

@ -32,23 +32,23 @@ namespace glm
/// Convert a linear color to sRGB color using a standard gamma correction. /// 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 /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear); GLM_FUNC_DECL vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const & ColorLinear);
/// Convert a linear color to sRGB color using a custom gamma correction. /// 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 /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear, T Gamma); GLM_FUNC_DECL vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const & ColorLinear, T Gamma);
/// Convert a sRGB color to linear color using a standard gamma correction. /// 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 /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB); GLM_FUNC_DECL vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const & ColorSRGB);
/// Convert a sRGB color to linear color using a custom gamma correction. /// 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 // IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB, T Gamma); GLM_FUNC_DECL vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const & ColorSRGB, T Gamma);
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -4,55 +4,55 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_rgbToSrgb struct compute_rgbToSrgb
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const& ColorRGB, T GammaCorrection) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const& ColorRGB, T GammaCorrection)
{ {
vecType<T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1))); vecType<D, T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
return mix( return mix(
pow(ClampedColor, vecType<T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055), pow(ClampedColor, vecType<D, T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
ClampedColor * static_cast<T>(12.92), ClampedColor * static_cast<T>(12.92),
lessThan(ClampedColor, vecType<T, P>(static_cast<T>(0.0031308)))); lessThan(ClampedColor, vecType<D, T, P>(static_cast<T>(0.0031308))));
} }
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_rgbToSrgb<T, P, tvec4> struct compute_rgbToSrgb<4, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection) GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection)
{ {
return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.a); return tvec4<T, P>(compute_rgbToSrgb<3, T, P, tvec>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.a);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_srgbToRgb struct compute_srgbToRgb
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const& ColorSRGB, T Gamma) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const& ColorSRGB, T Gamma)
{ {
return mix( return mix(
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<T, P>(Gamma)), pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<D, T, P>(Gamma)),
ColorSRGB * static_cast<T>(0.07739938080495356037151702786378), ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
lessThanEqual(ColorSRGB, vecType<T, P>(static_cast<T>(0.04045)))); lessThanEqual(ColorSRGB, vecType<D, T, P>(static_cast<T>(0.04045))));
} }
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_srgbToRgb<T, P, tvec4> struct compute_srgbToRgb<4, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma) GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma)
{ {
return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.a); return tvec4<T, P>(compute_srgbToRgb<3, T, P, tvec>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.a);
} }
}; };
}//namespace detail }//namespace detail
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const& ColorLinear) GLM_FUNC_QUALIFIER vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const& ColorLinear)
{ {
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666)); return detail::compute_rgbToSrgb<D, 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 // 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; return 0.662002687f * S1 + 0.684122060f * S2 - 0.323583601f * S3 - 0.0225411470f * ColorLinear;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const& ColorLinear, T Gamma) GLM_FUNC_QUALIFIER vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const& ColorLinear, T Gamma)
{ {
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma); return detail::compute_rgbToSrgb<D, T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(vecType<T, P> const& ColorSRGB) GLM_FUNC_QUALIFIER vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const& ColorSRGB)
{ {
return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4)); return detail::compute_srgbToRgb<D, T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(vecType<T, P> const& ColorSRGB, T Gamma) GLM_FUNC_QUALIFIER vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const& ColorSRGB, T Gamma)
{ {
return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, Gamma); return detail::compute_srgbToRgb<D, T, P, vecType>::call(ColorSRGB, Gamma);
} }
}//namespace glm }//namespace glm

View File

@ -30,10 +30,10 @@ namespace glm
/// True if this expression is satisfied. /// True if this expression is satisfied.
/// ///
/// @see gtc_epsilon /// @see gtc_epsilon
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> epsilonEqual( GLM_FUNC_DECL vecType<D, bool, P> epsilonEqual(
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & y, vecType<D, T, P> const & y,
T const & epsilon); T const & epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon. /// Returns the component-wise comparison of |x - y| < epsilon.

View File

@ -55,48 +55,48 @@ namespace glm
return abs(x - y) >= epsilon; return abs(x - y) >= epsilon;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonEqual GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonEqual
( (
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & y, vecType<D, T, P> const & y,
T const & epsilon T const & epsilon
) )
{ {
return lessThan(abs(x - y), vecType<T, P>(epsilon)); return lessThan(abs(x - y), vecType<D, T, P>(epsilon));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonEqual GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonEqual
( (
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & y, vecType<D, T, P> const & y,
vecType<T, P> const & epsilon vecType<D, T, P> const & epsilon
) )
{ {
return lessThan(abs(x - y), vecType<T, P>(epsilon)); return lessThan(abs(x - y), vecType<D, T, P>(epsilon));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonNotEqual GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonNotEqual
( (
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & y, vecType<D, T, P> const & y,
T const & epsilon T const & epsilon
) )
{ {
return greaterThanEqual(abs(x - y), vecType<T, P>(epsilon)); return greaterThanEqual(abs(x - y), vecType<D, T, P>(epsilon));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonNotEqual GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonNotEqual
( (
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & y, vecType<D, T, P> const & y,
vecType<T, P> const & epsilon vecType<D, T, P> const & epsilon
) )
{ {
return greaterThanEqual(abs(x - y), vecType<T, P>(epsilon)); return greaterThanEqual(abs(x - y), vecType<D, T, P>(epsilon));
} }
template <typename T, precision P> template <typename T, precision P>

View File

@ -55,8 +55,8 @@ namespace glm
/// @see gtc_integer /// @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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, T y); GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, T y);
/// Modulus. Returns x % y /// Modulus. Returns x % y
/// for each component in x using the floating point value y. /// for each component in x using the floating point value y.
@ -67,8 +67,8 @@ namespace glm
/// @see gtc_integer /// @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/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> /// @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 <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Returns a value equal to the nearest integer to x. /// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the /// 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see gtc_integer /// @see gtc_integer
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<int, P> iround(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, int, P> iround(vecType<D, T, P> const & x);
/// Returns a value equal to the nearest integer to x. /// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the /// 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see gtc_integer /// @see gtc_integer
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<uint, P> uround(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, uint, P> uround(vecType<D, T, P> const & x);
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -4,14 +4,14 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
struct compute_log2<T, P, vecType, false, Aligned> struct compute_log2<D, T, P, vecType, false, Aligned>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & vec)
{ {
//Equivalent to return findMSB(vec); but save one function call in ASM with VC //Equivalent to return findMSB(vec); but save one function call in ASM with VC
//return findMSB(vec); //return findMSB(vec);
return vecType<T, P>(detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(vec)); return vecType<D, T, P>(detail::compute_findMSB_vec<D, T, P, vecType, sizeof(T) * 8>::call(vec));
} }
}; };
@ -42,13 +42,13 @@ namespace detail
return static_cast<int>(x + static_cast<genType>(0.5)); return static_cast<int>(x + static_cast<genType>(0.5));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> iround(vecType<T, P> const& x) GLM_FUNC_QUALIFIER vecType<D, int, P> iround(vecType<D, T, P> const& x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs");
assert(all(lessThanEqual(vecType<T, P>(0), x))); assert(all(lessThanEqual(vecType<D, T, P>(0), x)));
return vecType<int, P>(x + static_cast<T>(0.5)); return vecType<D, int, P>(x + static_cast<T>(0.5));
} }
template <typename genType> template <typename genType>
@ -60,12 +60,12 @@ namespace detail
return static_cast<uint>(x + static_cast<genType>(0.5)); return static_cast<uint>(x + static_cast<genType>(0.5));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint, P> uround(vecType<T, P> const& x) GLM_FUNC_QUALIFIER vecType<D, uint, P> uround(vecType<D, T, P> const& x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs");
assert(all(lessThanEqual(vecType<T, P>(0), x))); assert(all(lessThanEqual(vecType<D, T, P>(0), x)));
return vecType<uint, P>(x + static_cast<T>(0.5)); return vecType<D, uint, P>(x + static_cast<T>(0.5));
} }
}//namespace glm }//namespace glm

View File

@ -37,22 +37,22 @@ namespace glm
/// Classic perlin noise. /// Classic perlin noise.
/// @see gtc_noise /// @see gtc_noise
template <typename T, precision P, template<typename, precision> class vecType> template <int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_DECL T perlin( GLM_FUNC_DECL T perlin(
vecType<T, P> const & p); vecType<D, T, P> const & p);
/// Periodic perlin noise. /// Periodic perlin noise.
/// @see gtc_noise /// @see gtc_noise
template <typename T, precision P, template<typename, precision> class vecType> template <int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_DECL T perlin( GLM_FUNC_DECL T perlin(
vecType<T, P> const & p, vecType<D, T, P> const & p,
vecType<T, P> const & rep); vecType<D, T, P> const & rep);
/// Simplex noise. /// Simplex noise.
/// @see gtc_noise /// @see gtc_noise
template <typename T, precision P, template<typename, precision> class vecType> template <int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_DECL T simplex( GLM_FUNC_DECL T simplex(
vecType<T, P> const & p); vecType<D, T, P> const & p);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -477,7 +477,7 @@ namespace glm
/// @see gtc_packing /// @see gtc_packing
/// @see tvec3<T, P> unpackRGBM(tvec4<T, P> const & p) /// @see tvec3<T, P> unpackRGBM(tvec4<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> /// @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 <typename T, precision P> template <int D, typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> packRGBM(tvec3<T, P> const & rgb); GLM_FUNC_DECL tvec4<T, P> packRGBM(tvec3<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. /// 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 gtc_packing
/// @see tvec4<T, P> packRGBM(tvec3<float, P> const & v) /// @see tvec4<T, P> packRGBM(tvec3<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> /// @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 <typename T, precision P> template <int D, typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> unpackRGBM(tvec4<T, P> const & rgbm); GLM_FUNC_DECL tvec3<T, P> unpackRGBM(tvec4<T, P> const & rgbm);
/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector /// 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. /// the forth component specifies the 16 most-significant bits.
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see vecType<float, P> unpackHalf(vecType<uint16, P> const & p) /// @see vecType<D, float, P> unpackHalf(vecType<D, 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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<uint16, P> packHalf(vecType<float, P> const & v); GLM_FUNC_DECL vecType<D, uint16, P> packHalf(vecType<D, 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. /// 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 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. /// the forth component is obtained from the 16 most-significant bits of v.
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see vecType<uint16, P> packHalf(vecType<float, P> const & v) /// @see vecType<D, uint16, P> packHalf(vecType<D, 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> /// @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 <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<float, P> unpackHalf(vecType<uint16, P> const & p); GLM_FUNC_DECL vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & p);
/// Convert each component of the normalized floating-point vector into unsigned integer values. /// Convert each component of the normalized floating-point vector into unsigned integer values.
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see vecType<floatType, P> unpackUnorm(vecType<intType, P> const & p); /// @see vecType<D, floatType, P> unpackUnorm(vecType<D, intType, P> const & p);
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<uintType, P> packUnorm(vecType<floatType, P> const & v); GLM_FUNC_DECL vecType<D, uintType, P> packUnorm(vecType<D, floatType, P> const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values. /// Convert each unsigned integer components of a vector to normalized floating-point values.
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see vecType<intType, P> packUnorm(vecType<floatType, P> const & v) /// @see vecType<D, intType, P> packUnorm(vecType<D, floatType, P> const & v)
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v); GLM_FUNC_DECL vecType<D, floatType, P> unpackUnorm(vecType<D, uintType, P> const & v);
/// Convert each component of the normalized floating-point vector into signed integer values. /// Convert each component of the normalized floating-point vector into signed integer values.
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see vecType<floatType, P> unpackSnorm(vecType<intType, P> const & p); /// @see vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & p);
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<intType, P> packSnorm(vecType<floatType, P> const & v); GLM_FUNC_DECL vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v);
/// Convert each signed integer components of a vector to normalized floating-point values. /// Convert each signed integer components of a vector to normalized floating-point values.
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see vecType<intType, P> packSnorm(vecType<floatType, P> const & v) /// @see vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v)
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v); GLM_FUNC_DECL vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & v);
/// Convert each component of the normalized floating-point vector into unsigned integer values. /// Convert each component of the normalized floating-point vector into unsigned integer values.
/// ///

View File

@ -270,14 +270,14 @@ namespace detail
uint32 pack; uint32 pack;
}; };
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_half struct compute_half
{}; {};
template <precision P> template <precision P>
struct compute_half<P, tvec1> struct compute_half<1, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec1<uint16, P> pack(tvec1<float, P> const & v) GLM_FUNC_QUALIFIER static tvec<1, uint16, P> pack(tvec<1, float, P> const & v)
{ {
int16 const Unpack(detail::toFloat16(v.x)); int16 const Unpack(detail::toFloat16(v.x));
u16vec1 Packed(uninitialize); u16vec1 Packed(uninitialize);
@ -285,68 +285,68 @@ namespace detail
return Packed; return Packed;
} }
GLM_FUNC_QUALIFIER static tvec1<float, P> unpack(tvec1<uint16, P> const & v) GLM_FUNC_QUALIFIER static tvec<1, float, P> unpack(tvec<1, uint16, P> const & v)
{ {
i16vec1 Unpack(uninitialize); i16vec1 Unpack(uninitialize);
memcpy(&Unpack, &v, sizeof(Unpack)); memcpy(&Unpack, &v, sizeof(Unpack));
return tvec1<float, P>(detail::toFloat32(v.x)); return tvec<1, float, P>(detail::toFloat32(v.x));
} }
}; };
template <precision P> template <precision P>
struct compute_half<P, tvec2> struct compute_half<2, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec2<uint16, P> pack(tvec2<float, P> const & v) GLM_FUNC_QUALIFIER static tvec<2, uint16, P> pack(tvec<2, float, P> const & v)
{ {
tvec2<int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y)); tvec<2, int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y));
u16vec2 Packed(uninitialize); u16vec2 Packed(uninitialize);
memcpy(&Packed, &Unpack, sizeof(Packed)); memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed; return Packed;
} }
GLM_FUNC_QUALIFIER static tvec2<float, P> unpack(tvec2<uint16, P> const & v) GLM_FUNC_QUALIFIER static tvec<2, float, P> unpack(tvec<2, uint16, P> const & v)
{ {
i16vec2 Unpack(uninitialize); i16vec2 Unpack(uninitialize);
memcpy(&Unpack, &v, sizeof(Unpack)); memcpy(&Unpack, &v, sizeof(Unpack));
return tvec2<float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y)); return tvec<2, float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y));
} }
}; };
template <precision P> template <precision P>
struct compute_half<P, tvec3> struct compute_half<3, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec3<uint16, P> pack(tvec3<float, P> const & v) GLM_FUNC_QUALIFIER static tvec<3, uint16, P> pack(tvec<3, float, P> const & v)
{ {
tvec3<int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z)); tvec<3, int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
u16vec3 Packed(uninitialize); u16vec3 Packed(uninitialize);
memcpy(&Packed, &Unpack, sizeof(Packed)); memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed; return Packed;
} }
GLM_FUNC_QUALIFIER static tvec3<float, P> unpack(tvec3<uint16, P> const & v) GLM_FUNC_QUALIFIER static tvec<3, float, P> unpack(tvec<3, uint16, P> const & v)
{ {
i16vec3 Unpack(uninitialize); i16vec3 Unpack(uninitialize);
memcpy(&Unpack, &v, sizeof(Unpack)); memcpy(&Unpack, &v, sizeof(Unpack));
return tvec3<float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z)); return tvec<3, float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z));
} }
}; };
template <precision P> template <precision P>
struct compute_half<P, tvec4> struct compute_half<4, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec4<uint16, P> pack(tvec4<float, P> const & v) GLM_FUNC_QUALIFIER static tvec<4, uint16, P> pack(tvec<4, float, P> const & v)
{ {
tvec4<int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w)); tvec<4, int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
u16vec4 Packed(uninitialize); u16vec4 Packed(uninitialize);
memcpy(&Packed, &Unpack, sizeof(Packed)); memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed; return Packed;
} }
GLM_FUNC_QUALIFIER static tvec4<float, P> unpack(tvec4<uint16, P> const & v) GLM_FUNC_QUALIFIER static tvec<4, float, P> unpack(tvec<4, uint16, P> const & v)
{ {
i16vec4 Unpack(uninitialize); i16vec4 Unpack(uninitialize);
memcpy(&Unpack, &v, sizeof(Unpack)); memcpy(&Unpack, &v, sizeof(Unpack));
return tvec4<float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w)); return tvec<4, float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w));
} }
}; };
}//namespace detail }//namespace detail
@ -641,66 +641,66 @@ namespace detail
// Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html // Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> packRGBM(tvec3<T, P> const & rgb) GLM_FUNC_QUALIFIER tvec<4, T, P> packRGBM(tvec<3, T, P> const & rgb)
{ {
tvec3<T, P> const Color(rgb * static_cast<T>(1.0 / 6.0)); tvec<3, T, P> const Color(rgb * static_cast<T>(1.0 / 6.0));
T Alpha = clamp(max(max(Color.x, Color.y), max(Color.z, static_cast<T>(1e-6))), static_cast<T>(0), static_cast<T>(1)); T Alpha = clamp(max(max(Color.x, Color.y), max(Color.z, static_cast<T>(1e-6))), static_cast<T>(0), static_cast<T>(1));
Alpha = ceil(Alpha * static_cast<T>(255.0)) / static_cast<T>(255.0); Alpha = ceil(Alpha * static_cast<T>(255.0)) / static_cast<T>(255.0);
return tvec4<T, P>(Color / Alpha, Alpha); return tvec<4, T, P>(Color / Alpha, Alpha);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> unpackRGBM(tvec4<T, P> const & rgbm) GLM_FUNC_QUALIFIER tvec<3, T, P> unpackRGBM(tvec<4, T, P> const & rgbm)
{ {
return tvec3<T, P>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6); return tvec<3, T, P>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint16, P> packHalf(vecType<float, P> const & v) GLM_FUNC_QUALIFIER vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v)
{ {
return detail::compute_half<P, vecType>::pack(v); return detail::compute_half<D, P, vecType>::pack(v);
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<float, P> unpackHalf(vecType<uint16, P> const & v) GLM_FUNC_QUALIFIER vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & v)
{ {
return detail::compute_half<P, vecType>::unpack(v); return detail::compute_half<D, P, vecType>::unpack(v);
} }
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uintType, P> packUnorm(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, uintType, P> packUnorm(vecType<D, 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<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"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max()))); return vecType<D, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
} }
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, floatType, P> unpackUnorm(vecType<D, 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<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"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max())); return vecType<D, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
} }
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<intType, P> packSnorm(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, intType, P> packSnorm(vecType<D, 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<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"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max()))); return vecType<D, intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
} }
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, floatType, P> unpackSnorm(vecType<D, 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<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"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return clamp(vecType<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<D, 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) GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const & v)

View File

@ -190,8 +190,8 @@ namespace glm
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ... /// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
/// ///
/// @see gtc_quaternion /// @see gtc_quaternion
template <typename T, precision P, template <typename, precision> class quatType> template <typename T, precision P>
GLM_FUNC_DECL T dot(quatType<T, P> const & x, quatType<T, P> const & y); GLM_FUNC_DECL T dot(tquat<T, P> const & x, tquat<T, P> const & y);
/// Spherical linear interpolation of two quaternions. /// Spherical linear interpolation of two quaternions.
/// The interpolation is oriented and the rotation is performed at constant speed. /// The interpolation is oriented and the rotation is performed at constant speed.

View File

@ -10,11 +10,11 @@ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, bool Aligned> template <typename T, precision P, bool Aligned>
struct compute_dot<tquat, T, P, Aligned> struct compute_dot<tquat<T, P>, T, Aligned>
{ {
static GLM_FUNC_QUALIFIER T call(tquat<T, P> const& x, tquat<T, P> const& y) static GLM_FUNC_QUALIFIER T call(tquat<T, P> const& a, tquat<T, P> const& b)
{ {
tvec4<T, P> tmp(x.x * y.x, x.y * y.y, x.z * y.z, x.w * y.w); tvec4<T, P> tmp(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
return (tmp.x + tmp.y) + (tmp.z + tmp.w); return (tmp.x + tmp.y) + (tmp.z + tmp.w);
} }
}; };
@ -154,7 +154,7 @@ namespace detail
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tvec3<T, P> const & u, tvec3<T, P> const & v) GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tvec3<T, P> const & u, tvec3<T, P> const & v)
{ {
tvec3<T, P> const LocalW(cross(u, v)); tvec3<T, P> const LocalW(cross(u, v));
T Dot = detail::compute_dot<tvec3, T, P, detail::is_aligned<P>::value>::call(u, v); T Dot = detail::compute_dot<tvec<3, T, P>, T, detail::is_aligned<P>::value>::call(u, v);
tquat<T, P> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z); tquat<T, P> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z);
*this = normalize(q); *this = normalize(q);

View File

@ -62,7 +62,7 @@ namespace detail
*/ */
template <precision P> template <precision P>
struct compute_dot<tquat, float, P, true> struct compute_dot<tquat<float, P>, float, true>
{ {
static GLM_FUNC_QUALIFIER float call(tquat<float, P> const& x, tquat<float, P> const& y) static GLM_FUNC_QUALIFIER float call(tquat<float, P> const& x, tquat<float, P> const& y)
{ {

View File

@ -44,10 +44,10 @@ namespace glm
/// @tparam T Value type. Currently supported: float or double. /// @tparam T Value type. Currently supported: float or double.
/// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible /// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible
/// @see gtc_random /// @see gtc_random
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> linearRand( GLM_FUNC_DECL vecType<D, T, P> linearRand(
vecType<T, P> const & Min, vecType<D, T, P> const & Min,
vecType<T, P> const & Max); vecType<D, T, P> const & Max);
/// Generate random numbers in the interval [Min, Max], according a gaussian distribution /// Generate random numbers in the interval [Min, Max], according a gaussian distribution
/// ///

View File

@ -10,14 +10,14 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <class, precision> class vecType> template <int D, typename T, precision P, template <int, class, precision> class vecType>
struct compute_rand struct compute_rand
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(); GLM_FUNC_QUALIFIER static vecType<D, T, P> call();
}; };
template <precision P> template <precision P>
struct compute_rand<uint8, P, tvec1> struct compute_rand<1, uint8, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec1<uint8, P> call() GLM_FUNC_QUALIFIER static tvec1<uint8, P> call()
{ {
@ -27,7 +27,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_rand<uint8, P, tvec2> struct compute_rand<2, uint8, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec2<uint8, P> call() GLM_FUNC_QUALIFIER static tvec2<uint8, P> call()
{ {
@ -38,7 +38,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_rand<uint8, P, tvec3> struct compute_rand<3, uint8, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec3<uint8, P> call() GLM_FUNC_QUALIFIER static tvec3<uint8, P> call()
{ {
@ -50,7 +50,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_rand<uint8, P, tvec4> struct compute_rand<4, uint8, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec4<uint8, P> call() GLM_FUNC_QUALIFIER static tvec4<uint8, P> call()
{ {
@ -62,195 +62,195 @@ namespace detail
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_rand<uint16, P, vecType> struct compute_rand<D, uint16, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint16, P> call() GLM_FUNC_QUALIFIER static vecType<D, uint16, P> call()
{ {
return return
(vecType<uint16, P>(compute_rand<uint8, P, vecType>::call()) << static_cast<uint16>(8)) | (vecType<D, uint16, P>(compute_rand<D, uint8, P, vecType>::call()) << static_cast<uint16>(8)) |
(vecType<uint16, P>(compute_rand<uint8, P, vecType>::call()) << static_cast<uint16>(0)); (vecType<D, uint16, P>(compute_rand<D, uint8, P, vecType>::call()) << static_cast<uint16>(0));
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_rand<uint32, P, vecType> struct compute_rand<D, uint32, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint32, P> call() GLM_FUNC_QUALIFIER static vecType<D, uint32, P> call()
{ {
return return
(vecType<uint32, P>(compute_rand<uint16, P, vecType>::call()) << static_cast<uint32>(16)) | (vecType<D, uint32, P>(compute_rand<D, uint16, P, vecType>::call()) << static_cast<uint32>(16)) |
(vecType<uint32, P>(compute_rand<uint16, P, vecType>::call()) << static_cast<uint32>(0)); (vecType<D, uint32, P>(compute_rand<D, uint16, P, vecType>::call()) << static_cast<uint32>(0));
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_rand<uint64, P, vecType> struct compute_rand<D, uint64, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint64, P> call() GLM_FUNC_QUALIFIER static vecType<D, uint64, P> call()
{ {
return return
(vecType<uint64, P>(compute_rand<uint32, P, vecType>::call()) << static_cast<uint64>(32)) | (vecType<D, uint64, P>(compute_rand<D, uint32, P, vecType>::call()) << static_cast<uint64>(32)) |
(vecType<uint64, P>(compute_rand<uint32, P, vecType>::call()) << static_cast<uint64>(0)); (vecType<D, uint64, P>(compute_rand<D, uint32, P, vecType>::call()) << static_cast<uint64>(0));
} }
}; };
template <typename T, precision P, template <class, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand struct compute_linearRand
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & Min, vecType<T, P> const & Max); GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & Min, vecType<D, T, P> const & Max);
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<int8, P, vecType> struct compute_linearRand<D, int8, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<int8, P> call(vecType<int8, P> const & Min, vecType<int8, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, int8, P> call(vecType<D, int8, P> const & Min, vecType<D, int8, P> const & Max)
{ {
return (vecType<int8, P>(compute_rand<uint8, P, vecType>::call() % vecType<uint8, P>(Max + static_cast<int8>(1) - Min))) + Min; return (vecType<D, int8, P>(compute_rand<D, uint8, P, vecType>::call() % vecType<D, uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<uint8, P, vecType> struct compute_linearRand<D, uint8, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint8, P> call(vecType<uint8, P> const & Min, vecType<uint8, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, uint8, P> call(vecType<D, uint8, P> const & Min, vecType<D, uint8, P> const & Max)
{ {
return (compute_rand<uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min; return (compute_rand<D, uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<int16, P, vecType> struct compute_linearRand<D, int16, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<int16, P> call(vecType<int16, P> const & Min, vecType<int16, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, int16, P> call(vecType<D, int16, P> const & Min, vecType<D, int16, P> const & Max)
{ {
return (vecType<int16, P>(compute_rand<uint16, P, vecType>::call() % vecType<uint16, P>(Max + static_cast<int16>(1) - Min))) + Min; return (vecType<D, int16, P>(compute_rand<D, uint16, P, vecType>::call() % vecType<D, uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<uint16, P, vecType> struct compute_linearRand<D, uint16, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint16, P> call(vecType<uint16, P> const & Min, vecType<uint16, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, uint16, P> call(vecType<D, uint16, P> const & Min, vecType<D, uint16, P> const & Max)
{ {
return (compute_rand<uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min; return (compute_rand<D, uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<int32, P, vecType> struct compute_linearRand<D, int32, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<int32, P> call(vecType<int32, P> const & Min, vecType<int32, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, int32, P> call(vecType<D, int32, P> const & Min, vecType<D, int32, P> const & Max)
{ {
return (vecType<int32, P>(compute_rand<uint32, P, vecType>::call() % vecType<uint32, P>(Max + static_cast<int32>(1) - Min))) + Min; return (vecType<D, int32, P>(compute_rand<D, uint32, P, vecType>::call() % vecType<D, uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<uint32, P, vecType> struct compute_linearRand<D, uint32, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint32, P> call(vecType<uint32, P> const & Min, vecType<uint32, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, uint32, P> call(vecType<D, uint32, P> const & Min, vecType<D, uint32, P> const & Max)
{ {
return (compute_rand<uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min; return (compute_rand<D, uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<int64, P, vecType> struct compute_linearRand<D, int64, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<int64, P> call(vecType<int64, P> const & Min, vecType<int64, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, int64, P> call(vecType<D, int64, P> const & Min, vecType<D, int64, P> const & Max)
{ {
return (vecType<int64, P>(compute_rand<uint64, P, vecType>::call() % vecType<uint64, P>(Max + static_cast<int64>(1) - Min))) + Min; return (vecType<D, int64, P>(compute_rand<D, uint64, P, vecType>::call() % vecType<D, uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
} }
}; };
template <precision P, template <class, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_linearRand<uint64, P, vecType> struct compute_linearRand<D, uint64, P, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<uint64, P> call(vecType<uint64, P> const & Min, vecType<uint64, P> const & Max) GLM_FUNC_QUALIFIER static vecType<D, uint64, P> call(vecType<D, uint64, P> const & Min, vecType<D, uint64, P> const & Max)
{ {
return (compute_rand<uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min; return (compute_rand<D, uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<float, lowp, vecType> struct compute_linearRand<D, float, lowp, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & Min, vecType<float, lowp> const & Max) GLM_FUNC_QUALIFIER static vecType<D, float, lowp> call(vecType<D, float, lowp> const & Min, vecType<D, float, lowp> const & Max)
{ {
return vecType<float, lowp>(compute_rand<uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min; return vecType<D, float, lowp>(compute_rand<D, uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<float, mediump, vecType> struct compute_linearRand<D, float, mediump, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<float, mediump> call(vecType<float, mediump> const & Min, vecType<float, mediump> const & Max) GLM_FUNC_QUALIFIER static vecType<D, float, mediump> call(vecType<D, float, mediump> const & Min, vecType<D, float, mediump> const & Max)
{ {
return vecType<float, mediump>(compute_rand<uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min; return vecType<D, float, mediump>(compute_rand<D, uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<float, highp, vecType> struct compute_linearRand<D, float, highp, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<float, highp> call(vecType<float, highp> const & Min, vecType<float, highp> const & Max) GLM_FUNC_QUALIFIER static vecType<D, float, highp> call(vecType<D, float, highp> const & Min, vecType<D, float, highp> const & Max)
{ {
return vecType<float, highp>(compute_rand<uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min; return vecType<D, float, highp>(compute_rand<D, uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<double, lowp, vecType> struct compute_linearRand<D, double, lowp, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<double, lowp> call(vecType<double, lowp> const & Min, vecType<double, lowp> const & Max) GLM_FUNC_QUALIFIER static vecType<D, double, lowp> call(vecType<D, double, lowp> const & Min, vecType<D, double, lowp> const & Max)
{ {
return vecType<double, lowp>(compute_rand<uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min; return vecType<D, double, lowp>(compute_rand<D, uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<double, mediump, vecType> struct compute_linearRand<D, double, mediump, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<double, mediump> call(vecType<double, mediump> const & Min, vecType<double, mediump> const & Max) GLM_FUNC_QUALIFIER static vecType<D, double, mediump> call(vecType<D, double, mediump> const & Min, vecType<D, double, mediump> const & Max)
{ {
return vecType<double, mediump>(compute_rand<uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min; return vecType<D, double, mediump>(compute_rand<D, uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<double, highp, vecType> struct compute_linearRand<D, double, highp, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<double, highp> call(vecType<double, highp> const & Min, vecType<double, highp> const & Max) GLM_FUNC_QUALIFIER static vecType<D, double, highp> call(vecType<D, double, highp> const & Min, vecType<D, double, highp> const & Max)
{ {
return vecType<double, highp>(compute_rand<uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min; return vecType<D, double, highp>(compute_rand<D, uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<long double, lowp, vecType> struct compute_linearRand<D, long double, lowp, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<long double, lowp> call(vecType<long double, lowp> const & Min, vecType<long double, lowp> const & Max) GLM_FUNC_QUALIFIER static vecType<D, long double, lowp> call(vecType<D, long double, lowp> const & Min, vecType<D, long double, lowp> const & Max)
{ {
return vecType<long double, lowp>(compute_rand<uint32, lowp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min; 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;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<long double, mediump, vecType> struct compute_linearRand<D, long double, mediump, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<long double, mediump> call(vecType<long double, mediump> const & Min, vecType<long double, mediump> const & Max) GLM_FUNC_QUALIFIER static vecType<D, long double, mediump> call(vecType<D, long double, mediump> const & Min, vecType<D, long double, mediump> const & Max)
{ {
return vecType<long double, mediump>(compute_rand<uint64, mediump, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min; 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;
} }
}; };
template <template <class, precision> class vecType> template <int D, template <int, typename, precision> class vecType>
struct compute_linearRand<long double, highp, vecType> struct compute_linearRand<D, long double, highp, vecType>
{ {
GLM_FUNC_QUALIFIER static vecType<long double, highp> call(vecType<long double, highp> const & Min, vecType<long double, highp> const & Max) GLM_FUNC_QUALIFIER static vecType<D, long double, highp> call(vecType<D, long double, highp> const & Min, vecType<D, long double, highp> const & Max)
{ {
return vecType<long double, highp>(compute_rand<uint64, highp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min; 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;
} }
}; };
}//namespace detail }//namespace detail
@ -258,15 +258,15 @@ namespace detail
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType linearRand(genType Min, genType Max) GLM_FUNC_QUALIFIER genType linearRand(genType Min, genType Max)
{ {
return detail::compute_linearRand<genType, highp, tvec1>::call( return detail::compute_linearRand<1, genType, highp, tvec>::call(
tvec1<genType, highp>(Min), tvec1<genType, highp>(Min),
tvec1<genType, highp>(Max)).x; tvec1<genType, highp>(Max)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> linearRand(vecType<T, P> const & Min, vecType<T, P> const & Max) GLM_FUNC_QUALIFIER vecType<D, T, P> linearRand(vecType<D, T, P> const & Min, vecType<D, T, P> const & Max)
{ {
return detail::compute_linearRand<T, P, vecType>::call(Min, Max); return detail::compute_linearRand<D, T, P, vecType>::call(Min, Max);
} }
template <typename genType> template <typename genType>
@ -285,10 +285,10 @@ namespace detail
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean; return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> gaussRand(vecType<T, P> const & Mean, vecType<T, P> const & Deviation) GLM_FUNC_QUALIFIER vecType<D, T, P> gaussRand(vecType<D, T, P> const & Mean, vecType<D, T, P> const & Deviation)
{ {
return detail::functor2<T, P, vecType>::call(gaussRand, Mean, Deviation); return detail::functor2<D, T, P>::call(gaussRand, Mean, Deviation);
} }
template <typename T> template <typename T>

View File

@ -14,11 +14,11 @@ namespace glm
return genType(1) / glm::cos(angle); return genType(1) / glm::cos(angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sec(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> sec(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(sec, x); return detail::functor1<D, T, T, P>::call(sec, x);
} }
// csc // csc
@ -29,11 +29,11 @@ namespace glm
return genType(1) / glm::sin(angle); return genType(1) / glm::sin(angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> csc(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> csc(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(csc, x); return detail::functor1<D, T, T, P>::call(csc, x);
} }
// cot // cot
@ -46,11 +46,11 @@ namespace glm
return glm::tan(pi_over_2 - angle); return glm::tan(pi_over_2 - angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> cot(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> cot(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(cot, x); return detail::functor1<D, T, T, P>::call(cot, x);
} }
// asec // asec
@ -61,11 +61,11 @@ namespace glm
return acos(genType(1) / x); return acos(genType(1) / x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> asec(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> asec(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(asec, x); return detail::functor1<D, T, T, P>::call(asec, x);
} }
// acsc // acsc
@ -76,11 +76,11 @@ namespace glm
return asin(genType(1) / x); return asin(genType(1) / x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> acsc(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> acsc(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(acsc, x); return detail::functor1<D, T, T, P>::call(acsc, x);
} }
// acot // acot
@ -93,11 +93,11 @@ namespace glm
return pi_over_2 - atan(x); return pi_over_2 - atan(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> acot(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> acot(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(acot, x); return detail::functor1<D, T, T, P>::call(acot, x);
} }
// sech // sech
@ -108,11 +108,11 @@ namespace glm
return genType(1) / glm::cosh(angle); return genType(1) / glm::cosh(angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sech(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> sech(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(sech, x); return detail::functor1<D, T, T, P>::call(sech, x);
} }
// csch // csch
@ -123,11 +123,11 @@ namespace glm
return genType(1) / glm::sinh(angle); return genType(1) / glm::sinh(angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> csch(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> csch(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(csch, x); return detail::functor1<D, T, T, P>::call(csch, x);
} }
// coth // coth
@ -138,11 +138,11 @@ namespace glm
return glm::cosh(angle) / glm::sinh(angle); return glm::cosh(angle) / glm::sinh(angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> coth(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> coth(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(coth, x); return detail::functor1<D, T, T, P>::call(coth, x);
} }
// asech // asech
@ -153,11 +153,11 @@ namespace glm
return acosh(genType(1) / x); return acosh(genType(1) / x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> asech(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> asech(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(asech, x); return detail::functor1<D, T, T, P>::call(asech, x);
} }
// acsch // acsch
@ -168,11 +168,11 @@ namespace glm
return acsch(genType(1) / x); return acsch(genType(1) / x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> acsch(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> acsch(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(acsch, x); return detail::functor1<D, T, T, P>::call(acsch, x);
} }
// acoth // acoth
@ -183,10 +183,10 @@ namespace glm
return atanh(genType(1) / x); return atanh(genType(1) / x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> acoth(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> acoth(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
return detail::functor1<T, T, P, vecType>::call(acoth, x); return detail::functor1<D, T, T, P>::call(acoth, x);
} }
}//namespace glm }//namespace glm

View File

@ -39,8 +39,8 @@ namespace glm
/// Return true if the value is a power of two number. /// Return true if the value is a power of two number.
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> isPowerOfTwo(vecType<T, P> const & value); GLM_FUNC_DECL vecType<D, bool, P> isPowerOfTwo(vecType<D, T, P> const & value);
/// Return the power of two number which value is just higher the input value, /// Return the power of two number which value is just higher the input value,
/// round up to a power of two. /// round up to a power of two.
@ -53,8 +53,8 @@ namespace glm
/// round up to a power of two. /// round up to a power of two.
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> ceilPowerOfTwo(vecType<T, P> const & value); GLM_FUNC_DECL vecType<D, T, P> ceilPowerOfTwo(vecType<D, T, P> const & value);
/// Return the power of two number which value is just lower the input value, /// Return the power of two number which value is just lower the input value,
/// round down to a power of two. /// round down to a power of two.
@ -67,8 +67,8 @@ namespace glm
/// round down to a power of two. /// round down to a power of two.
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> floorPowerOfTwo(vecType<T, P> const & value); GLM_FUNC_DECL vecType<D, T, P> floorPowerOfTwo(vecType<D, T, P> const & value);
/// Return the power of two number which value is the closet to the input 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. /// Return the power of two number which value is the closet to the input value.
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> roundPowerOfTwo(vecType<T, P> const & value); GLM_FUNC_DECL vecType<D, T, P> roundPowerOfTwo(vecType<D, T, P> const & value);
/// Return true if the 'Value' is a multiple of 'Multiple'. /// 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'. /// Return true if the 'Value' is a multiple of 'Multiple'.
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> isMultiple(vecType<T, P> const & Value, T Multiple); GLM_FUNC_DECL vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, T Multiple);
/// Return true if the 'Value' is a multiple of 'Multiple'. /// Return true if the 'Value' is a multiple of 'Multiple'.
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> isMultiple(vecType<T, P> const & Value, vecType<T, P> const & Multiple); GLM_FUNC_DECL vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, vecType<D, T, P> const & Multiple);
/// Higher multiple number of Source. /// Higher multiple number of Source.
/// ///
@ -117,8 +117,8 @@ namespace glm
/// @param Multiple Must be a null or positive value /// @param Multiple Must be a null or positive value
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> ceilMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple); GLM_FUNC_DECL vecType<D, T, P> ceilMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple);
/// Lower multiple number of Source. /// Lower multiple number of Source.
/// ///
@ -139,10 +139,10 @@ namespace glm
/// @param Multiple Must be a null or positive value /// @param Multiple Must be a null or positive value
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> floorMultiple( GLM_FUNC_DECL vecType<D, T, P> floorMultiple(
vecType<T, P> const & Source, vecType<D, T, P> const & Source,
vecType<T, P> const & Multiple); vecType<D, T, P> const & Multiple);
/// Lower multiple number of Source. /// Lower multiple number of Source.
/// ///
@ -163,10 +163,10 @@ namespace glm
/// @param Multiple Must be a null or positive value /// @param Multiple Must be a null or positive value
/// ///
/// @see gtc_round /// @see gtc_round
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> roundMultiple( GLM_FUNC_DECL vecType<D, T, P> roundMultiple(
vecType<T, P> const & Source, vecType<D, T, P> const & Source,
vecType<T, P> const & Multiple); vecType<D, T, P> const & Multiple);
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -6,62 +6,62 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <typename, precision> class vecType, bool compute = false> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool compute = false>
struct compute_ceilShift struct compute_ceilShift
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T)
{ {
return v; return v;
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_ceilShift<T, P, vecType, true> struct compute_ceilShift<D, T, P, vecType, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Shift) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Shift)
{ {
return v | (v >> Shift); return v | (v >> Shift);
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType, bool isSigned = true> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isSigned = true>
struct compute_ceilPowerOfTwo struct compute_ceilPowerOfTwo
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs"); GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
vecType<T, P> const Sign(sign(x)); vecType<D, T, P> const Sign(sign(x));
vecType<T, P> v(abs(x)); vecType<D, T, P> v(abs(x));
v = v - static_cast<T>(1); v = v - static_cast<T>(1);
v = 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>(2));
v = v | (v >> static_cast<T>(4)); v = v | (v >> static_cast<T>(4));
v = compute_ceilShift<T, P, vecType, sizeof(T) >= 2>::call(v, 8); v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
v = compute_ceilShift<T, P, vecType, sizeof(T) >= 4>::call(v, 16); v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
v = compute_ceilShift<T, P, vecType, sizeof(T) >= 8>::call(v, 32); v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
return (v + static_cast<T>(1)) * Sign; return (v + static_cast<T>(1)) * Sign;
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_ceilPowerOfTwo<T, P, vecType, false> struct compute_ceilPowerOfTwo<D, T, P, vecType, false>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs"); GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
vecType<T, P> v(x); vecType<D, T, P> v(x);
v = v - static_cast<T>(1); v = v - static_cast<T>(1);
v = 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>(2));
v = v | (v >> static_cast<T>(4)); v = v | (v >> static_cast<T>(4));
v = compute_ceilShift<T, P, vecType, sizeof(T) >= 2>::call(v, 8); v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
v = compute_ceilShift<T, P, vecType, sizeof(T) >= 4>::call(v, 16); v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
v = compute_ceilShift<T, P, vecType, sizeof(T) >= 8>::call(v, 32); v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
return v + static_cast<T>(1); return v + static_cast<T>(1);
} }
}; };
@ -219,11 +219,11 @@ namespace detail
return !(Result & (Result - 1)); return !(Result & (Result - 1));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> isPowerOfTwo(vecType<T, P> const & Value) GLM_FUNC_QUALIFIER vecType<D, bool, P> isPowerOfTwo(vecType<D, T, P> const & Value)
{ {
vecType<T, P> const Result(abs(Value)); vecType<D, T, P> const Result(abs(Value));
return equal(Result & (Result - 1), vecType<T, P>(0)); return equal(Result & (Result - 1), vecType<D, T, P>(0));
} }
////////////////// //////////////////
@ -232,13 +232,13 @@ namespace detail
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType ceilPowerOfTwo(genType value) GLM_FUNC_QUALIFIER genType ceilPowerOfTwo(genType value)
{ {
return detail::compute_ceilPowerOfTwo<genType, defaultp, tvec1, std::numeric_limits<genType>::is_signed>::call(tvec1<genType, defaultp>(value)).x; return detail::compute_ceilPowerOfTwo<1, genType, defaultp, tvec, std::numeric_limits<genType>::is_signed>::call(tvec1<genType, defaultp>(value)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> ceilPowerOfTwo(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> ceilPowerOfTwo(vecType<D, T, P> const & v)
{ {
return detail::compute_ceilPowerOfTwo<T, P, vecType, std::numeric_limits<T>::is_signed>::call(v); return detail::compute_ceilPowerOfTwo<D, 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); return isPowerOfTwo(value) ? value : static_cast<genType>(1) << findMSB(value);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> floorPowerOfTwo(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> floorPowerOfTwo(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(floorPowerOfTwo, v); return detail::functor1<D, T, T, P>::call(floorPowerOfTwo, v);
} }
/////////////////// ///////////////////
@ -270,10 +270,10 @@ namespace detail
return (next - value) < (value - prev) ? next : prev; return (next - value) < (value - prev) ? next : prev;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> roundPowerOfTwo(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> roundPowerOfTwo(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(roundPowerOfTwo, v); return detail::functor1<D, T, T, P>::call(roundPowerOfTwo, v);
} }
//////////////// ////////////////
@ -285,16 +285,16 @@ namespace detail
return isMultiple(tvec1<genType>(Value), tvec1<genType>(Multiple)).x; return isMultiple(tvec1<genType>(Value), tvec1<genType>(Multiple)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> isMultiple(vecType<T, P> const & Value, T Multiple) GLM_FUNC_QUALIFIER vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, T Multiple)
{ {
return (Value % Multiple) == vecType<T, P>(0); return (Value % Multiple) == vecType<D, T, P>(0);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> isMultiple(vecType<T, P> const & Value, vecType<T, P> const & Multiple) GLM_FUNC_QUALIFIER vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, vecType<D, T, P> const & Multiple)
{ {
return (Value % Multiple) == vecType<T, P>(0); return (Value % Multiple) == vecType<D, 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); return detail::compute_ceilMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> ceilMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple) GLM_FUNC_QUALIFIER vecType<D, T, P> ceilMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
{ {
return detail::functor2<T, P, vecType>::call(ceilMultiple, Source, Multiple); return detail::functor2<D, 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); return detail::compute_floorMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> floorMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple) GLM_FUNC_QUALIFIER vecType<D, T, P> floorMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
{ {
return detail::functor2<T, P, vecType>::call(floorMultiple, Source, Multiple); return detail::functor2<D, 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); return detail::compute_roundMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> roundMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple) GLM_FUNC_QUALIFIER vecType<D, T, P> roundMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
{ {
return detail::functor2<T, P, vecType>::call(roundMultiple, Source, Multiple); return detail::functor2<D, T, P>::call(roundMultiple, Source, Multiple);
} }
}//namespace glm }//namespace glm

View File

@ -25,10 +25,6 @@
namespace glm namespace glm
{ {
template <typename T, precision P> struct tvec1;
template <typename T, precision P> struct tvec2;
template <typename T, precision P> struct tvec3;
template <typename T, precision P> struct tvec4;
/// @addtogroup gtc_type_aligned /// @addtogroup gtc_type_aligned
/// @{ /// @{

View File

@ -54,8 +54,8 @@ namespace glm
/// Return the distance in the number of ULP between 2 vectors. /// Return the distance in the number of ULP between 2 vectors.
/// @see gtc_ulp /// @see gtc_ulp
template<typename T, template<typename> class vecType> template<typename T, template<int, typename> class vecType>
GLM_FUNC_DECL vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y); GLM_FUNC_DECL vecType<2, uint> float_distance(vecType<2, T> const & x, vecType<2, T> const & y);
/// @} /// @}
}// namespace glm }// namespace glm

View File

@ -199,10 +199,10 @@ namespace glm
# endif # endif
} }
template<typename T, precision P, template<typename, precision> class vecType> template<int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> next_float(vecType<D, T, P> const & x)
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = next_float(x[i]); Result[i] = next_float(x[i]);
return Result; return Result;
@ -234,10 +234,10 @@ namespace glm
# endif # endif
} }
template<typename T, precision P, template<typename, precision> class vecType> template<int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> prev_float(vecType<D, T, P> const & x)
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = prev_float(x[i]); Result[i] = prev_float(x[i]);
return Result; return Result;
@ -252,10 +252,10 @@ namespace glm
return temp; return temp;
} }
template<typename T, precision P, template<typename, precision> class vecType> template<int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x, vecType<uint, P> const & ulps) GLM_FUNC_QUALIFIER vecType<D, T, P> next_float(vecType<D, T, P> const & x, vecType<D, uint, P> const & ulps)
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = next_float(x[i], ulps[i]); Result[i] = next_float(x[i], ulps[i]);
return Result; return Result;
@ -270,10 +270,10 @@ namespace glm
return temp; return temp;
} }
template<typename T, precision P, template<typename, precision> class vecType> template<int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x, vecType<uint, P> const & ulps) GLM_FUNC_QUALIFIER vecType<D, T, P> prev_float(vecType<D, T, P> const & x, vecType<D, uint, P> const & ulps)
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = prev_float(x[i], ulps[i]); Result[i] = prev_float(x[i], ulps[i]);
return Result; return Result;
@ -310,10 +310,10 @@ namespace glm
return ulp; return ulp;
} }
template<typename T, precision P, template<typename, precision> class vecType> template<int D, typename T, precision P, template<int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint, P> float_distance(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, uint, P> float_distance(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
vecType<uint, P> Result(uninitialize); vecType<D, uint, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = float_distance(x[i], y[i]); Result[i] = float_distance(x[i], y[i]);
return Result; return Result;

View File

@ -35,24 +35,24 @@ namespace glm
/// Minimum comparison between 2 variables and returns 2 associated variable values /// Minimum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL tvec2<U, P> associatedMin( GLM_FUNC_DECL tvec2<U, P> associatedMin(
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b); vecType<D, T, P> const & y, vecType<D, U, P> const & b);
/// Minimum comparison between 2 variables and returns 2 associated variable values /// Minimum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMin( GLM_FUNC_DECL vecType<D, U, P> associatedMin(
T x, const vecType<U, P>& a, T x, const vecType<D, U, P>& a,
T y, const vecType<U, P>& b); T y, const vecType<D, U, P>& b);
/// Minimum comparison between 2 variables and returns 2 associated variable values /// Minimum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMin( GLM_FUNC_DECL vecType<D, U, P> associatedMin(
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b); vecType<D, T, P> const & y, U b);
/// Minimum comparison between 3 variables and returns 3 associated variable values /// Minimum comparison between 3 variables and returns 3 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
@ -64,11 +64,11 @@ namespace glm
/// Minimum comparison between 3 variables and returns 3 associated variable values /// Minimum comparison between 3 variables and returns 3 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMin( GLM_FUNC_DECL vecType<D, U, P> associatedMin(
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c); vecType<D, T, P> const & z, vecType<D, U, P> const & c);
/// Minimum comparison between 4 variables and returns 4 associated variable values /// Minimum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
@ -81,30 +81,30 @@ namespace glm
/// Minimum comparison between 4 variables and returns 4 associated variable values /// Minimum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMin( GLM_FUNC_DECL vecType<D, U, P> associatedMin(
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c, vecType<D, T, P> const & z, vecType<D, U, P> const & c,
vecType<T, P> const & w, vecType<U, P> const & d); vecType<D, T, P> const & w, vecType<D, U, P> const & d);
/// Minimum comparison between 4 variables and returns 4 associated variable values /// Minimum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMin( GLM_FUNC_DECL vecType<D, U, P> associatedMin(
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b, T y, vecType<D, U, P> const & b,
T z, vecType<U, P> const & c, T z, vecType<D, U, P> const & c,
T w, vecType<U, P> const & d); T w, vecType<D, U, P> const & d);
/// Minimum comparison between 4 variables and returns 4 associated variable values /// Minimum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMin( GLM_FUNC_DECL vecType<D, U, P> associatedMin(
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b, vecType<D, T, P> const & y, U b,
vecType<T, P> const & z, U c, vecType<D, T, P> const & z, U c,
vecType<T, P> const & w, U d); vecType<D, T, P> const & w, U d);
/// Maximum comparison between 2 variables and returns 2 associated variable values /// Maximum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
@ -113,24 +113,24 @@ namespace glm
/// Maximum comparison between 2 variables and returns 2 associated variable values /// Maximum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL tvec2<U, P> associatedMax( GLM_FUNC_DECL tvec2<U, P> associatedMax(
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b); vecType<D, T, P> const & y, vecType<D, U, P> const & b);
/// Maximum comparison between 2 variables and returns 2 associated variable values /// Maximum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> associatedMax( GLM_FUNC_DECL vecType<D, T, P> associatedMax(
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b); T y, vecType<D, U, P> const & b);
/// Maximum comparison between 2 variables and returns 2 associated variable values /// Maximum comparison between 2 variables and returns 2 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMax( GLM_FUNC_DECL vecType<D, U, P> associatedMax(
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b); vecType<D, T, P> const & y, U b);
/// Maximum comparison between 3 variables and returns 3 associated variable values /// Maximum comparison between 3 variables and returns 3 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
@ -142,27 +142,27 @@ namespace glm
/// Maximum comparison between 3 variables and returns 3 associated variable values /// Maximum comparison between 3 variables and returns 3 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMax( GLM_FUNC_DECL vecType<D, U, P> associatedMax(
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c); vecType<D, T, P> const & z, vecType<D, U, P> const & c);
/// Maximum comparison between 3 variables and returns 3 associated variable values /// Maximum comparison between 3 variables and returns 3 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> associatedMax( GLM_FUNC_DECL vecType<D, T, P> associatedMax(
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b, T y, vecType<D, U, P> const & b,
T z, vecType<U, P> const & c); T z, vecType<D, U, P> const & c);
/// Maximum comparison between 3 variables and returns 3 associated variable values /// Maximum comparison between 3 variables and returns 3 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMax( GLM_FUNC_DECL vecType<D, U, P> associatedMax(
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b, vecType<D, T, P> const & y, U b,
vecType<T, P> const & z, U c); vecType<D, T, P> const & z, U c);
/// Maximum comparison between 4 variables and returns 4 associated variable values /// Maximum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
@ -175,30 +175,30 @@ namespace glm
/// Maximum comparison between 4 variables and returns 4 associated variable values /// Maximum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMax( GLM_FUNC_DECL vecType<D, U, P> associatedMax(
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c, vecType<D, T, P> const & z, vecType<D, U, P> const & c,
vecType<T, P> const & w, vecType<U, P> const & d); vecType<D, T, P> const & w, vecType<D, U, P> const & d);
/// Maximum comparison between 4 variables and returns 4 associated variable values /// Maximum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMax( GLM_FUNC_DECL vecType<D, U, P> associatedMax(
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b, T y, vecType<D, U, P> const & b,
T z, vecType<U, P> const & c, T z, vecType<D, U, P> const & c,
T w, vecType<U, P> const & d); T w, vecType<D, U, P> const & d);
/// Maximum comparison between 4 variables and returns 4 associated variable values /// Maximum comparison between 4 variables and returns 4 associated variable values
/// @see gtx_associated_min_max /// @see gtx_associated_min_max
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<U, P> associatedMax( GLM_FUNC_DECL vecType<D, U, P> associatedMax(
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b, vecType<D, T, P> const & y, U b,
vecType<T, P> const & z, U c, vecType<D, T, P> const & z, U c,
vecType<T, P> const & w, U d); vecType<D, T, P> const & w, U d);
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -10,40 +10,40 @@ GLM_FUNC_QUALIFIER U associatedMin(T x, U a, T y, U b)
return x < y ? a : b; return x < y ? a : b;
} }
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
( (
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b vecType<D, T, P> const & y, vecType<D, U, P> const & b
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] < y[i] ? a[i] : b[i]; Result[i] = x[i] < y[i] ? a[i] : b[i];
return Result; return Result;
} }
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
( (
T x, const vecType<U, P>& a, T x, const vecType<D, U, P>& a,
T y, const vecType<U, P>& b T y, const vecType<D, U, P>& b
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x < y ? a[i] : b[i]; Result[i] = x < y ? a[i] : b[i];
return Result; return Result;
} }
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
( (
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b vecType<D, T, P> const & y, U b
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] < y[i] ? a : b; Result[i] = x[i] < y[i] ? a : b;
return Result; return Result;
@ -62,15 +62,15 @@ GLM_FUNC_QUALIFIER U associatedMin
return Result; return Result;
} }
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
( (
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c vecType<D, T, P> const & z, vecType<D, U, P> const & c
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) 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]); Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
return Result; return Result;
@ -95,16 +95,16 @@ GLM_FUNC_QUALIFIER U associatedMin
} }
// Min comparison between 4 variables // Min comparison between 4 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
( (
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c, vecType<D, T, P> const & z, vecType<D, U, P> const & c,
vecType<T, P> const & w, vecType<U, P> const & d vecType<D, T, P> const & w, vecType<D, U, P> const & d
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
{ {
T Test1 = min(x[i], y[i]); T Test1 = min(x[i], y[i]);
@ -117,19 +117,19 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
} }
// Min comparison between 4 variables // Min comparison between 4 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
( (
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b, T y, vecType<D, U, P> const & b,
T z, vecType<U, P> const & c, T z, vecType<D, U, P> const & c,
T w, vecType<U, P> const & d T w, vecType<D, U, P> const & d
) )
{ {
T Test1 = min(x, y); T Test1 = min(x, y);
T Test2 = min(z, w); T Test2 = min(z, w);
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
{ {
U Result1 = x < y ? a[i] : b[i]; U Result1 = x < y ? a[i] : b[i];
@ -140,16 +140,16 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
} }
// Min comparison between 4 variables // Min comparison between 4 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMin
( (
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b, vecType<D, T, P> const & y, U b,
vecType<T, P> const & z, U c, vecType<D, T, P> const & z, U c,
vecType<T, P> const & w, U d vecType<D, T, P> const & w, U d
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
{ {
T Test1 = min(x[i], y[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 // Max comparison between 2 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
( (
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b vecType<D, T, P> const & y, vecType<D, U, P> const & b
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] > y[i] ? a[i] : b[i]; Result[i] = x[i] > y[i] ? a[i] : b[i];
return Result; return Result;
} }
// Max comparison between 2 variables // Max comparison between 2 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, T, P> associatedMax
( (
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b T y, vecType<D, U, P> const & b
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x > y ? a[i] : b[i]; Result[i] = x > y ? a[i] : b[i];
return Result; return Result;
} }
// Max comparison between 2 variables // Max comparison between 2 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
( (
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b vecType<D, T, P> const & y, U b
) )
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] > y[i] ? a : b; Result[i] = x[i] > y[i] ? a : b;
return Result; return Result;
@ -224,45 +224,45 @@ GLM_FUNC_QUALIFIER U associatedMax
} }
// Max comparison between 3 variables // Max comparison between 3 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
( (
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c vecType<D, T, P> const & z, vecType<D, U, P> const & c
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) 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]); Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
return Result; return Result;
} }
// Max comparison between 3 variables // Max comparison between 3 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, T, P> associatedMax
( (
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b, T y, vecType<D, U, P> const & b,
T z, vecType<U, P> const & c T z, vecType<D, U, P> const & c
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) 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]); Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
return Result; return Result;
} }
// Max comparison between 3 variables // Max comparison between 3 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
( (
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b, vecType<D, T, P> const & y, U b,
vecType<T, P> const & z, U c vecType<D, T, P> const & z, U c
) )
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) 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); Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
return Result; return Result;
@ -287,16 +287,16 @@ GLM_FUNC_QUALIFIER U associatedMax
} }
// Max comparison between 4 variables // Max comparison between 4 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
( (
vecType<T, P> const & x, vecType<U, P> const & a, vecType<D, T, P> const & x, vecType<D, U, P> const & a,
vecType<T, P> const & y, vecType<U, P> const & b, vecType<D, T, P> const & y, vecType<D, U, P> const & b,
vecType<T, P> const & z, vecType<U, P> const & c, vecType<D, T, P> const & z, vecType<D, U, P> const & c,
vecType<T, P> const & w, vecType<U, P> const & d vecType<D, T, P> const & w, vecType<D, U, P> const & d
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
{ {
T Test1 = max(x[i], y[i]); T Test1 = max(x[i], y[i]);
@ -309,19 +309,19 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
} }
// Max comparison between 4 variables // Max comparison between 4 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
( (
T x, vecType<U, P> const & a, T x, vecType<D, U, P> const & a,
T y, vecType<U, P> const & b, T y, vecType<D, U, P> const & b,
T z, vecType<U, P> const & c, T z, vecType<D, U, P> const & c,
T w, vecType<U, P> const & d T w, vecType<D, U, P> const & d
) )
{ {
T Test1 = max(x, y); T Test1 = max(x, y);
T Test2 = max(z, w); T Test2 = max(z, w);
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
{ {
U Result1 = x > y ? a[i] : b[i]; U Result1 = x > y ? a[i] : b[i];
@ -332,16 +332,16 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
} }
// Max comparison between 4 variables // Max comparison between 4 variables
template<typename T, typename U, precision P, template <typename, precision> class vecType> template<int D, typename T, typename U, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax GLM_FUNC_QUALIFIER vecType<D, U, P> associatedMax
( (
vecType<T, P> const & x, U a, vecType<D, T, P> const & x, U a,
vecType<T, P> const & y, U b, vecType<D, T, P> const & y, U b,
vecType<T, P> const & z, U c, vecType<D, T, P> const & z, U c,
vecType<T, P> const & w, U d vecType<D, T, P> const & w, U d
) )
{ {
vecType<U, P> Result(uninitialize); vecType<D, U, P> Result(uninitialize);
for(length_t i = 0, n = Result.length(); i < n; ++i) for(length_t i = 0, n = Result.length(); i < n; ++i)
{ {
T Test1 = max(x[i], y[i]); T Test1 = max(x[i], y[i]);

View File

@ -39,8 +39,8 @@ namespace glm
/// Find the highest bit set to 1 in a integer variable and return its value. /// Find the highest bit set to 1 in a integer variable and return its value.
/// ///
/// @see gtx_bit /// @see gtx_bit
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> highestBitValue(vecType<T, P> const & value); GLM_FUNC_DECL vecType<D, T, P> highestBitValue(vecType<D, T, P> const & value);
/// Return the power of two number which value is just higher the input value. /// Return the power of two number which value is just higher the input value.
/// Deprecated, use ceilPowerOfTwo from GTC_round instead /// Deprecated, use ceilPowerOfTwo from GTC_round instead
@ -55,8 +55,8 @@ namespace glm
/// ///
/// @see gtc_round /// @see gtc_round
/// @see gtx_bit /// @see gtx_bit
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_DEPRECATED GLM_FUNC_DECL vecType<T, P> powerOfTwoAbove(vecType<T, P> const & value); GLM_DEPRECATED GLM_FUNC_DECL vecType<D, T, P> powerOfTwoAbove(vecType<D, T, P> const & value);
/// Return the power of two number which value is just lower the input value. /// Return the power of two number which value is just lower the input value.
/// Deprecated, use floorPowerOfTwo from GTC_round instead /// Deprecated, use floorPowerOfTwo from GTC_round instead
@ -71,8 +71,8 @@ namespace glm
/// ///
/// @see gtc_round /// @see gtc_round
/// @see gtx_bit /// @see gtx_bit
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_DEPRECATED GLM_FUNC_DECL vecType<T, P> powerOfTwoBelow(vecType<T, P> const & value); GLM_DEPRECATED GLM_FUNC_DECL vecType<D, T, P> powerOfTwoBelow(vecType<D, T, P> const & value);
/// Return the power of two number which value is the closet to the input value. /// Return the power of two number which value is the closet to the input value.
/// Deprecated, use roundPowerOfTwo from GTC_round instead /// Deprecated, use roundPowerOfTwo from GTC_round instead
@ -87,8 +87,8 @@ namespace glm
/// ///
/// @see gtc_round /// @see gtc_round
/// @see gtx_bit /// @see gtx_bit
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_DEPRECATED GLM_FUNC_DECL vecType<T, P> powerOfTwoNearest(vecType<T, P> const & value); GLM_DEPRECATED GLM_FUNC_DECL vecType<D, T, P> powerOfTwoNearest(vecType<D, T, P> const & value);
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -19,10 +19,10 @@ namespace glm
return result; return result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> highestBitValue(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> highestBitValue(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(highestBitValue, v); return detail::functor1<D, T, T, P>::call(highestBitValue, v);
} }
/////////////////// ///////////////////
@ -34,10 +34,10 @@ namespace glm
return (Value & (~Value + 1)); return (Value & (~Value + 1));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> lowestBitValue(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> lowestBitValue(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(lowestBitValue, v); return detail::functor1<D, T, T, P>::call(lowestBitValue, v);
} }
/////////////////// ///////////////////
@ -49,10 +49,10 @@ namespace glm
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1; return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> powerOfTwoAbove(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> powerOfTwoAbove(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(powerOfTwoAbove, v); return detail::functor1<D, T, T, P>::call(powerOfTwoAbove, v);
} }
/////////////////// ///////////////////
@ -64,10 +64,10 @@ namespace glm
return isPowerOfTwo(value) ? value : highestBitValue(value); return isPowerOfTwo(value) ? value : highestBitValue(value);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> powerOfTwoBelow(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> powerOfTwoBelow(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(powerOfTwoBelow, v); return detail::functor1<D, T, T, P>::call(powerOfTwoBelow, v);
} }
///////////////////// /////////////////////
@ -84,10 +84,10 @@ namespace glm
return (next - value) < (value - prev) ? next : prev; return (next - value) < (value - prev) ? next : prev;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> powerOfTwoNearest(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> powerOfTwoNearest(vecType<D, T, P> const & v)
{ {
return detail::functor1<T, T, P, vecType>::call(powerOfTwoNearest, v); return detail::functor1<D, T, T, P>::call(powerOfTwoNearest, v);
} }
}//namespace glm }//namespace glm

View File

@ -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://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> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fmod(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, T, P> fmod(vecType<D, T, P> const & v);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -6,19 +6,19 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true> template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isFloat = true>
struct compute_fmod struct compute_fmod
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, vecType<T, P> const & b) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
{ {
return detail::functor2<T, P, vecType>::call(std::fmod, a, b); return detail::functor2<D, T, P>::call(std::fmod, a, b);
} }
}; };
template <typename T, precision P, template <class, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_fmod<T, P, vecType, false> struct compute_fmod<D, T, P, vecType, false>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, vecType<T, P> const & b) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & a, vecType<D, T, P> const & b)
{ {
return a % b; return a % b;
} }
@ -98,15 +98,15 @@ namespace detail
return fmod(tvec1<genType>(x), y).x; return fmod(tvec1<genType>(x), y).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fmod(vecType<T, P> const & x, T y) GLM_FUNC_QUALIFIER vecType<D, T, P> fmod(vecType<D, T, P> const & x, T y)
{ {
return detail::compute_fmod<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, vecType<T, P>(y)); return detail::compute_fmod<D, T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, vecType<D, T, P>(y));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fmod(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, T, P> fmod(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return detail::compute_fmod<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, y); return detail::compute_fmod<D, T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x, y);
} }
}//namespace glm }//namespace glm

View File

@ -34,14 +34,14 @@ namespace glm
/// Convert an integer vector to a normalized float vector. /// 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. /// If the parameter value type is already a floating precision type, the value is passed through.
/// @see gtx_component_wise /// @see gtx_component_wise
template <typename floatType, typename T, precision P, template <typename, precision> class vecType> template <typename floatType, int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<floatType, P> compNormalize(vecType<T, P> const & v); GLM_FUNC_DECL vecType<D, floatType, P> compNormalize(vecType<D, T, P> const & v);
/// Convert a normalized float vector to an integer vector. /// 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. /// If the parameter value type is already a floating precision type, the value is passed through.
/// @see gtx_component_wise /// @see gtx_component_wise
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> compScale(vecType<floatType, P> const & v); GLM_FUNC_DECL vecType<D, T, P> compScale(vecType<D, floatType, P> const & v);
/// Add all vector components together. /// Add all vector components together.
/// @see gtx_component_wise /// @see gtx_component_wise

View File

@ -6,92 +6,92 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, typename floatType, precision P, template <typename, precision> class vecType, bool isInteger, bool signedType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType, bool isInteger, bool signedType>
struct compute_compNormalize struct compute_compNormalize
{}; {};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, true, true> struct compute_compNormalize<D, T, floatType, P, vecType, true, true>
{ {
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, floatType, P> call(vecType<D, T, P> const & v)
{ {
floatType const Min = static_cast<floatType>(std::numeric_limits<T>::min()); floatType const Min = static_cast<floatType>(std::numeric_limits<T>::min());
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()); floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max());
return (vecType<floatType, P>(v) - Min) / (Max - Min) * static_cast<floatType>(2) - static_cast<floatType>(1); return (vecType<D, floatType, P>(v) - Min) / (Max - Min) * static_cast<floatType>(2) - static_cast<floatType>(1);
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, true, false> struct compute_compNormalize<D, T, floatType, P, vecType, true, false>
{ {
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, floatType, P> call(vecType<D, T, P> const & v)
{ {
return vecType<floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max()); return vecType<D, floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max());
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, false, true> struct compute_compNormalize<D, T, floatType, P, vecType, false, true>
{ {
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, floatType, P> call(vecType<D, T, P> const & v)
{ {
return v; return v;
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType, bool isInteger, bool signedType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType, bool isInteger, bool signedType>
struct compute_compScale struct compute_compScale
{}; {};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, true, true> struct compute_compScale<D, T, floatType, P, vecType, true, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, floatType, P> const & v)
{ {
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()) + static_cast<floatType>(0.5); floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()) + static_cast<floatType>(0.5);
vecType<floatType, P> const Scaled(v * Max); vecType<D, floatType, P> const Scaled(v * Max);
vecType<T, P> const Result(Scaled - static_cast<floatType>(0.5)); vecType<D, T, P> const Result(Scaled - static_cast<floatType>(0.5));
return Result; return Result;
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, true, false> struct compute_compScale<D, T, floatType, P, vecType, true, false>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, floatType, P> const & v)
{ {
return vecType<T, P>(vecType<floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max())); return vecType<D, T, P>(vecType<D, floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max()));
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <int D, typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, false, true> struct compute_compScale<D, T, floatType, P, vecType, false, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, floatType, P> const & v)
{ {
return v; return v;
} }
}; };
}//namespace detail }//namespace detail
template <typename floatType, typename T, precision P, template <typename, precision> class vecType> template <typename floatType, int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> compNormalize(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, floatType, P> compNormalize(vecType<D, T, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter");
return detail::compute_compNormalize<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v); return detail::compute_compNormalize<D, T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
} }
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, int D, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> compScale(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> compScale(vecType<D, floatType, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter");
return detail::compute_compScale<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v); return detail::compute_compScale<D, T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compAdd(vecType<T, P> const & v) GLM_FUNC_QUALIFIER T compAdd(vecType<D, T, P> const & v)
{ {
T Result(0); T Result(0);
for(length_t i = 0, n = v.length(); i < n; ++i) for(length_t i = 0, n = v.length(); i < n; ++i)
@ -99,8 +99,8 @@ namespace detail
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMul(vecType<T, P> const & v) GLM_FUNC_QUALIFIER T compMul(vecType<D, T, P> const & v)
{ {
T Result(1); T Result(1);
for(length_t i = 0, n = v.length(); i < n; ++i) for(length_t i = 0, n = v.length(); i < n; ++i)
@ -108,8 +108,8 @@ namespace detail
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMin(vecType<T, P> const & v) GLM_FUNC_QUALIFIER T compMin(vecType<D, T, P> const & v)
{ {
T Result(v[0]); T Result(v[0]);
for(length_t i = 1, n = v.length(); i < n; ++i) for(length_t i = 1, n = v.length(); i < n; ++i)
@ -117,8 +117,8 @@ namespace detail
return Result; return Result;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMax(vecType<T, P> const & v) GLM_FUNC_QUALIFIER T compMax(vecType<D, T, P> const & v)
{ {
T Result(v[0]); T Result(v[0]);
for(length_t i = 1, n = v.length(); i < n; ++i) for(length_t i = 1, n = v.length(); i < n; ++i)

View File

@ -36,8 +36,8 @@ namespace glm
/// Faster than the common pow function but less accurate. /// Faster than the common pow function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastPow(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL vecType<D, T, P> fastPow(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Faster than the common pow function but less accurate. /// Faster than the common pow function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
@ -46,8 +46,8 @@ namespace glm
/// Faster than the common pow function but less accurate. /// Faster than the common pow function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastPow(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastPow(vecType<D, T, P> const & x);
/// Faster than the common exp function but less accurate. /// Faster than the common exp function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
@ -56,8 +56,8 @@ namespace glm
/// Faster than the common exp function but less accurate. /// Faster than the common exp function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastExp(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastExp(vecType<D, T, P> const & x);
/// Faster than the common log function but less accurate. /// Faster than the common log function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
@ -66,8 +66,8 @@ namespace glm
/// Faster than the common exp2 function but less accurate. /// Faster than the common exp2 function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastLog(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastLog(vecType<D, T, P> const & x);
/// Faster than the common exp2 function but less accurate. /// Faster than the common exp2 function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
@ -76,8 +76,8 @@ namespace glm
/// Faster than the common exp2 function but less accurate. /// Faster than the common exp2 function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastExp2(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastExp2(vecType<D, T, P> const & x);
/// Faster than the common log2 function but less accurate. /// Faster than the common log2 function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
@ -86,8 +86,8 @@ namespace glm
/// Faster than the common log2 function but less accurate. /// Faster than the common log2 function but less accurate.
/// @see gtx_fast_exponential /// @see gtx_fast_exponential
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastLog2(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastLog2(vecType<D, T, P> const & x);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -10,8 +10,8 @@ namespace glm
return exp(y * log(x)); return exp(y * log(x));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastPow(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<D, T, P> fastPow(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return exp(y * log(x)); return exp(y * log(x));
} }
@ -25,10 +25,10 @@ namespace glm
return f; return f;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastPow(vecType<T, P> const & x, vecType<int, P> const & y) GLM_FUNC_QUALIFIER vecType<D, T, P> fastPow(vecType<D, T, P> const & x, vecType<D, int, P> const & y)
{ {
vecType<T, P> Result(uninitialize); vecType<D, T, P> Result(uninitialize);
for(length_t i = 0, n = x.length(); i < n; ++i) for(length_t i = 0, n = x.length(); i < n; ++i)
Result[i] = fastPow(x[i], y[i]); Result[i] = fastPow(x[i], y[i]);
return Result; return Result;
@ -81,10 +81,10 @@ namespace glm
} }
*/ */
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastExp(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastExp(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastExp, x); return detail::functor1<D, T, T, P>::call(fastExp, x);
} }
// fastLog // fastLog
@ -103,10 +103,10 @@ namespace glm
} }
*/ */
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastLog(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastLog(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastLog, x); return detail::functor1<D, T, T, P>::call(fastLog, x);
} }
//fastExp2, ln2 = 0.69314718055994530941723212145818f //fastExp2, ln2 = 0.69314718055994530941723212145818f
@ -116,10 +116,10 @@ namespace glm
return fastExp(0.69314718055994530941723212145818f * x); return fastExp(0.69314718055994530941723212145818f * x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastExp2(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastExp2(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastExp2, x); return detail::functor1<D, T, T, P>::call(fastExp2, x);
} }
// fastLog2, ln2 = 0.69314718055994530941723212145818f // fastLog2, ln2 = 0.69314718055994530941723212145818f
@ -129,9 +129,9 @@ namespace glm
return fastLog(x) / 0.69314718055994530941723212145818f; return fastLog(x) / 0.69314718055994530941723212145818f;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastLog2(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastLog2(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastLog2, x); return detail::functor1<D, T, T, P>::call(fastLog2, x);
} }
}//namespace glm }//namespace glm

View File

@ -41,8 +41,8 @@ namespace glm
/// Faster than the common sqrt function but less accurate. /// Faster than the common sqrt function but less accurate.
/// ///
/// @see gtx_fast_square_root extension. /// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastSqrt(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastSqrt(vecType<D, T, P> const & x);
/// Faster than the common inversesqrt function but less accurate. /// Faster than the common inversesqrt function but less accurate.
/// ///
@ -53,8 +53,8 @@ namespace glm
/// Faster than the common inversesqrt function but less accurate. /// Faster than the common inversesqrt function but less accurate.
/// ///
/// @see gtx_fast_square_root extension. /// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastInverseSqrt(vecType<T, P> const & x); GLM_FUNC_DECL vecType<D, T, P> fastInverseSqrt(vecType<D, T, P> const & x);
/// Faster than the common length function but less accurate. /// Faster than the common length function but less accurate.
/// ///
@ -65,8 +65,8 @@ namespace glm
/// Faster than the common length function but less accurate. /// Faster than the common length function but less accurate.
/// ///
/// @see gtx_fast_square_root extension. /// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T fastLength(vecType<T, P> const & x); GLM_FUNC_DECL T fastLength(vecType<D, T, P> const & x);
/// Faster than the common distance function but less accurate. /// Faster than the common distance function but less accurate.
/// ///
@ -77,8 +77,8 @@ namespace glm
/// Faster than the common distance function but less accurate. /// Faster than the common distance function but less accurate.
/// ///
/// @see gtx_fast_square_root extension. /// @see gtx_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T fastDistance(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL T fastDistance(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Faster than the common normalize function but less accurate. /// Faster than the common normalize function but less accurate.
/// ///

View File

@ -12,10 +12,10 @@ namespace glm
return genType(1) / fastInverseSqrt(x); return genType(1) / fastInverseSqrt(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastSqrt(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastSqrt(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastSqrt, x); return detail::functor1<D, T, T, P>::call(fastSqrt, x);
} }
// fastInversesqrt // fastInversesqrt
@ -26,14 +26,14 @@ namespace glm
tvec1<T, P> tmp(detail::compute_inversesqrt<tvec1, genType, lowp, detail::is_aligned<lowp>::value>::call(tvec1<genType, lowp>(x))); tvec1<T, P> tmp(detail::compute_inversesqrt<tvec1, genType, lowp, detail::is_aligned<lowp>::value>::call(tvec1<genType, lowp>(x)));
return tmp.x; return tmp.x;
# else # else
return detail::compute_inversesqrt<tvec1, genType, highp, detail::is_aligned<highp>::value>::call(tvec1<genType, lowp>(x)).x; return detail::compute_inversesqrt<1, genType, highp, detail::is_aligned<highp>::value>::call(tvec1<genType, lowp>(x)).x;
# endif # endif
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastInverseSqrt(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastInverseSqrt(vecType<D, T, P> const & x)
{ {
return detail::compute_inversesqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x); return detail::compute_inversesqrt<D, T, P, detail::is_aligned<P>::value>::call(x);
} }
// fastLength // fastLength
@ -45,8 +45,8 @@ namespace glm
return abs(x); return abs(x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T fastLength(vecType<T, P> const & x) GLM_FUNC_QUALIFIER T fastLength(vecType<D, T, P> const & x)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fastLength' only accept floating-point inputs"); 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); return fastLength(y - x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T fastDistance(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER T fastDistance(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return fastLength(y - x); return fastLength(y - x);
} }
@ -73,8 +73,8 @@ namespace glm
return x > genType(0) ? genType(1) : -genType(1); return x > genType(0) ? genType(1) : -genType(1);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastNormalize(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastNormalize(vecType<D, T, P> const & x)
{ {
return x * fastInverseSqrt(dot(x, x)); return x * fastInverseSqrt(dot(x, x));
} }

View File

@ -4,8 +4,8 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorCos(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> taylorCos(vecType<D, T, P> const & x)
{ {
return static_cast<T>(1) return static_cast<T>(1)
- (x * x) * (1.f / 2.f) - (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)))); return (T(0.9999932946) + xx * (T(-0.4999124376) + xx * (T(0.0414877472) + xx * T(-0.0012712095))));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> cos_52s(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> cos_52s(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(cos_52s, x); return detail::functor1<D, T, T, P>::call(cos_52s, x);
} }
}//namespace detail }//namespace detail
@ -35,10 +35,10 @@ namespace detail
return abs<T>(mod<T>(angle, two_pi<T>())); return abs<T>(mod<T>(angle, two_pi<T>()));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> wrapAngle(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> wrapAngle(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(wrapAngle, x); return detail::functor1<D, T, T, P>::call(wrapAngle, x);
} }
// cos // cos
@ -57,10 +57,10 @@ namespace detail
return detail::cos_52s(two_pi<T>() - angle); return detail::cos_52s(two_pi<T>() - angle);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastCos(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastCos(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastCos, x); return detail::functor1<D, T, T, P>::call(fastCos, x);
} }
// sin // sin
@ -70,10 +70,10 @@ namespace detail
return fastCos<T>(half_pi<T>() - x); return fastCos<T>(half_pi<T>() - x);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastSin(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastSin(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastSin, x); return detail::functor1<D, T, T, P>::call(fastSin, x);
} }
// tan // 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)); return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastTan(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastTan(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastTan, x); return detail::functor1<D, T, T, P>::call(fastTan, x);
} }
// asin // 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)); return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastAsin(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastAsin(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastAsin, x); return detail::functor1<D, T, T, P>::call(fastAsin, x);
} }
// acos // acos
@ -109,10 +109,10 @@ namespace detail
return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastAcos(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastAcos(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastAcos, x); return detail::functor1<D, T, T, P>::call(fastAcos, x);
} }
// atan // atan
@ -123,10 +123,10 @@ namespace detail
return abs(fastAtan(y / x)) * sgn; return abs(fastAtan(y / x)) * sgn;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastAtan(vecType<T, P> const & y, vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastAtan(vecType<D, T, P> const & y, vecType<D, T, P> const & x)
{ {
return detail::functor2<T, P, vecType>::call(fastAtan, y, x); return detail::functor2<D, T, P>::call(fastAtan, y, x);
} }
template <typename T> 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)); return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastAtan(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastAtan(vecType<D, T, P> const & x)
{ {
return detail::functor1<T, T, P, vecType>::call(fastAtan, x); return detail::functor1<D, T, T, P>::call(fastAtan, x);
} }
}//namespace glm }//namespace glm

View File

@ -5,10 +5,10 @@
namespace glm namespace glm
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<float, P> floatNormalize(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, float, P> floatNormalize(vecType<D, T, P> const & v)
{ {
return vecType<float, P>(v) / static_cast<float>(std::numeric_limits<T>::max()); return vecType<D, float, P>(v) / static_cast<float>(std::numeric_limits<T>::max());
} }
}//namespace glm }//namespace glm

View File

@ -152,9 +152,9 @@ namespace io
namespace detail namespace detail
{ {
template <typename CTy, typename CTr, template <typename, precision> class V, typename T, precision P> template <typename CTy, typename CTr, typename V>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>&
print_vector_on(std::basic_ostream<CTy, CTr>& os, V<T,P> const& a) print_vector_on(std::basic_ostream<CTy, CTr>& os, V const& a)
{ {
typename std::basic_ostream<CTy, CTr>::sentry const cerberus(os); typename std::basic_ostream<CTy, CTr>::sentry const cerberus(os);
@ -162,7 +162,7 @@ namespace detail
{ {
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
length_t const& components(type<V, T, P>::components); length_t const& components(type<V>::components);
if(fmt.formatted) if(fmt.formatted)
{ {
@ -236,8 +236,8 @@ namespace detail
{ {
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os)); io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
length_t const& cols(type<M, T, P>::cols); length_t const& cols(type<M<T, P>>::cols);
length_t const& rows(type<M, T, P>::rows); length_t const& rows(type<M<T, P>>::rows);
if(fmt.formatted) if(fmt.formatted)
{ {
@ -379,8 +379,8 @@ namespace detail
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os)); io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy> >(os));
M<T,P> const& ml(a.first); M<T,P> const& ml(a.first);
M<T,P> const& mr(a.second); M<T,P> const& mr(a.second);
length_t const& cols(type<M, T, P>::cols); length_t const& cols(type<M<T, P>>::cols);
length_t const& rows(type<M, T, P>::rows); length_t const& rows(type<M<T, P>>::rows);
if(fmt.formatted) if(fmt.formatted)
{ {

View File

@ -37,10 +37,10 @@ namespace glm
/// Logarithm for any base. /// Logarithm for any base.
/// From GLM_GTX_log_base. /// From GLM_GTX_log_base.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sign( GLM_FUNC_DECL vecType<D, T, P> sign(
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & base); vecType<D, T, P> const & base);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -10,8 +10,8 @@ namespace glm
return glm::log(x) / glm::log(base); return glm::log(x) / glm::log(base);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> log(vecType<T, P> const & x, vecType<T, P> const & base) GLM_FUNC_QUALIFIER vecType<D, T, P> log(vecType<D, T, P> const & x, vecType<D, T, P> const & base)
{ {
return glm::log(x) / glm::log(base); return glm::log(x) / glm::log(base);
} }

View File

@ -32,16 +32,16 @@ namespace glm
/// Returns the squared length of x. /// Returns the squared length of x.
/// From GLM_GTX_norm extension. /// From GLM_GTX_norm extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T length2( GLM_FUNC_DECL T length2(
vecType<T, P> const & x); vecType<D, T, P> const & x);
/// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1). /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
/// From GLM_GTX_norm extension. /// From GLM_GTX_norm extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T distance2( GLM_FUNC_DECL T distance2(
vecType<T, P> const & p0, vecType<D, T, P> const & p0,
vecType<T, P> const & p1); vecType<D, T, P> const & p1);
//! Returns the L1 norm between x and y. //! Returns the L1 norm between x and y.
//! From GLM_GTX_norm extension. //! From GLM_GTX_norm extension.

View File

@ -6,10 +6,10 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned> template <template <int, typename, precision> class vecType, int D, typename T, precision P, bool Aligned>
struct compute_length2 struct compute_length2
{ {
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static T call(vecType<D, T, P> const & v)
{ {
return dot(v, v); return dot(v, v);
} }
@ -23,11 +23,11 @@ namespace detail
return x * x; return x * x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T length2(vecType<T, P> const & v) GLM_FUNC_QUALIFIER T length2(vecType<D, T, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length2' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length2' accepts only floating-point inputs");
return detail::compute_length2<vecType, T, P, detail::is_aligned<P>::value>::call(v); return detail::compute_length2<vecType, D, T, P, detail::is_aligned<P>::value>::call(v);
} }
template <typename T> template <typename T>
@ -37,8 +37,8 @@ namespace detail
return length2(p1 - p0); return length2(p1 - p0);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T distance2(vecType<T, P> const & p0, vecType<T, P> const & p1) GLM_FUNC_QUALIFIER T distance2(vecType<D, T, P> const & p0, vecType<D, T, P> const & p1)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs");
return length2(p1 - p0); return length2(p1 - p0);

View File

@ -33,15 +33,15 @@ namespace glm
/// It's faster that dot(normalize(x), normalize(y)). /// It's faster that dot(normalize(x), normalize(y)).
/// ///
/// @see gtx_normalize_dot extension. /// @see gtx_normalize_dot extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T normalizeDot(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL T normalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// Normalize parameters and returns the dot product of x and y. /// Normalize parameters and returns the dot product of x and y.
/// Faster that dot(fastNormalize(x), fastNormalize(y)). /// Faster that dot(fastNormalize(x), fastNormalize(y)).
/// ///
/// @see gtx_normalize_dot extension. /// @see gtx_normalize_dot extension.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL T fastNormalizeDot(vecType<T, P> const & x, vecType<T, P> const & y); GLM_FUNC_DECL T fastNormalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -3,14 +3,14 @@
namespace glm namespace glm
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T normalizeDot(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER T normalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
{ {
return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y));
} }

View File

@ -41,8 +41,8 @@ namespace glm
/// Create a string from a GLM vector or matrix typed variable. /// Create a string from a GLM vector or matrix typed variable.
/// @see gtx_string_cast extension. /// @see gtx_string_cast extension.
template <template <typename, precision> class matType, typename T, precision P> template <typename matType>
GLM_FUNC_DECL std::string to_string(matType<T, P> const & x); GLM_FUNC_DECL std::string to_string(matType const & x);
/// @} /// @}
}//namespace glm }//namespace glm

View File

@ -125,12 +125,12 @@ namespace detail
GLM_FUNC_QUALIFIER static char const * value() {return "i64";}; GLM_FUNC_QUALIFIER static char const * value() {return "i64";};
}; };
template <template <typename, precision> class matType, typename T, precision P> template <typename matType>
struct compute_to_string struct compute_to_string
{}; {};
template <precision P> template <precision P>
struct compute_to_string<tvec1, bool, P> struct compute_to_string<tvec1<bool, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec1<bool, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec1<bool, P> const & x)
{ {
@ -140,7 +140,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_to_string<tvec2, bool, P> struct compute_to_string<tvec2<bool, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec2<bool, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec2<bool, P> const & x)
{ {
@ -151,7 +151,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_to_string<tvec3, bool, P> struct compute_to_string<tvec3<bool, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec3<bool, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec3<bool, P> const & x)
{ {
@ -163,7 +163,7 @@ namespace detail
}; };
template <precision P> template <precision P>
struct compute_to_string<tvec4, bool, P> struct compute_to_string<tvec4<bool, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec4<bool, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec4<bool, P> const & x)
{ {
@ -176,7 +176,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tvec1, T, P> struct compute_to_string<tvec1<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec1<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec1<T, P> const & x)
{ {
@ -191,7 +191,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tvec2, T, P> struct compute_to_string<tvec2<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec2<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec2<T, P> const & x)
{ {
@ -206,7 +206,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tvec3, T, P> struct compute_to_string<tvec3<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec3<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec3<T, P> const & x)
{ {
@ -221,7 +221,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tvec4, T, P> struct compute_to_string<tvec4<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tvec4<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tvec4<T, P> const & x)
{ {
@ -237,7 +237,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat2x2, T, P> struct compute_to_string<tmat2x2<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat2x2<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat2x2<T, P> const & x)
{ {
@ -255,7 +255,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat2x3, T, P> struct compute_to_string<tmat2x3<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat2x3<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat2x3<T, P> const & x)
{ {
@ -273,7 +273,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat2x4, T, P> struct compute_to_string<tmat2x4<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat2x4<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat2x4<T, P> const & x)
{ {
@ -291,7 +291,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat3x2, T, P> struct compute_to_string<tmat3x2<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat3x2<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat3x2<T, P> const & x)
{ {
@ -311,7 +311,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat3x3, T, P> struct compute_to_string<tmat3x3<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat3x3<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat3x3<T, P> const & x)
{ {
@ -331,7 +331,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat3x4, T, P> struct compute_to_string<tmat3x4<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat3x4<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat3x4<T, P> const & x)
{ {
@ -351,7 +351,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat4x2, T, P> struct compute_to_string<tmat4x2<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat4x2<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat4x2<T, P> const & x)
{ {
@ -373,7 +373,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat4x3, T, P> struct compute_to_string<tmat4x3<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat4x3<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat4x3<T, P> const & x)
{ {
@ -395,7 +395,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tmat4x4, T, P> struct compute_to_string<tmat4x4<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tmat4x4<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tmat4x4<T, P> const & x)
{ {
@ -418,7 +418,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tquat, T, P> struct compute_to_string<tquat<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tquat<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tquat<T, P> const & x)
{ {
@ -433,7 +433,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_to_string<tdualquat, T, P> struct compute_to_string<tdualquat<T, P>>
{ {
GLM_FUNC_QUALIFIER static std::string call(tdualquat<T, P> const & x) GLM_FUNC_QUALIFIER static std::string call(tdualquat<T, P> const & x)
{ {
@ -449,10 +449,10 @@ namespace detail
}//namespace detail }//namespace detail
template <template <typename, precision> class matType, typename T, precision P> template <class matType>
GLM_FUNC_QUALIFIER std::string to_string(matType<T, P> const & x) GLM_FUNC_QUALIFIER std::string to_string(matType const & x)
{ {
return detail::compute_to_string<matType, T, P>::call(x); return detail::compute_to_string<matType>::call(x);
} }
}//namespace glm }//namespace glm

View File

@ -41,7 +41,7 @@ namespace glm
/// @addtogroup gtx_type_trait /// @addtogroup gtx_type_trait
/// @{ /// @{
template <template <typename, precision> class genType, typename T, precision P> template <typename T>
struct type struct type
{ {
static bool const is_vec = false; static bool const is_vec = false;
@ -52,56 +52,20 @@ namespace glm
static length_t const rows = 0; static length_t const rows = 0;
}; };
template <typename T, precision P> template <int D, typename T, precision P>
struct type<tvec1, T, P> struct type<tvec<D, T, P>>
{ {
static bool const is_vec = true; static bool const is_vec = true;
static bool const is_mat = false; static bool const is_mat = false;
static bool const is_quat = false; static bool const is_quat = false;
enum enum
{ {
components = 1 components = D
}; };
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tvec2, T, P> struct type<tmat2x2<T, P>>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
enum
{
components = 2
};
};
template <typename T, precision P>
struct type<tvec3, T, P>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
enum
{
components = 3
};
};
template <typename T, precision P>
struct type<tvec4, T, P>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
enum
{
components = 4
};
};
template <typename T, precision P>
struct type<tmat2x2, T, P>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -115,7 +79,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat2x3, T, P> struct type<tmat2x3<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -129,7 +93,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat2x4, T, P> struct type<tmat2x4<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -143,7 +107,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat3x2, T, P> struct type<tmat3x2<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -157,7 +121,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat3x3, T, P> struct type<tmat3x3<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -171,7 +135,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat3x4, T, P> struct type<tmat3x4<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -185,7 +149,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat4x2, T, P> struct type<tmat4x2<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -199,7 +163,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat4x3, T, P> struct type<tmat4x3<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -213,7 +177,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tmat4x4, T, P> struct type<tmat4x4<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = true; static bool const is_mat = true;
@ -227,7 +191,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tquat, T, P> struct type<tquat<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = false; static bool const is_mat = false;
@ -239,7 +203,7 @@ namespace glm
}; };
template <typename T, precision P> template <typename T, precision P>
struct type<tdualquat, T, P> struct type<tdualquat<T, P>>
{ {
static bool const is_vec = false; static bool const is_vec = false;
static bool const is_mat = false; static bool const is_mat = false;

View File

@ -14,11 +14,11 @@ namespace glm
return acos(clamp(dot(x, y), genType(-1), genType(1))); return acos(clamp(dot(x, y), genType(-1), genType(1)));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER T angle GLM_FUNC_QUALIFIER T angle
( (
vecType<T, P> const & x, vecType<D, T, P> const & x,
vecType<T, P> const & y vecType<D, T, P> const & y
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");

View File

@ -32,33 +32,33 @@ namespace glm
//! Check whether two vectors are collinears. //! Check whether two vectors are collinears.
/// @see gtx_vector_query extensions. /// @see gtx_vector_query extensions.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool areCollinear(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); GLM_FUNC_DECL bool areCollinear(vecType<D, T, P> const & v0, vecType<D, T, P> const & v1, T const & epsilon);
//! Check whether two vectors are orthogonals. //! Check whether two vectors are orthogonals.
/// @see gtx_vector_query extensions. /// @see gtx_vector_query extensions.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool areOrthogonal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); GLM_FUNC_DECL bool areOrthogonal(vecType<D, T, P> const & v0, vecType<D, T, P> const & v1, T const & epsilon);
//! Check whether a vector is normalized. //! Check whether a vector is normalized.
/// @see gtx_vector_query extensions. /// @see gtx_vector_query extensions.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool isNormalized(vecType<T, P> const & v, T const & epsilon); GLM_FUNC_DECL bool isNormalized(vecType<D, T, P> const & v, T const & epsilon);
//! Check whether a vector is null. //! Check whether a vector is null.
/// @see gtx_vector_query extensions. /// @see gtx_vector_query extensions.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool isNull(vecType<T, P> const & v, T const & epsilon); GLM_FUNC_DECL bool isNull(vecType<D, T, P> const & v, T const & epsilon);
//! Check whether a each component of a vector is null. //! Check whether a each component of a vector is null.
/// @see gtx_vector_query extensions. /// @see gtx_vector_query extensions.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> isCompNull(vecType<T, P> const & v, T const & epsilon); GLM_FUNC_DECL vecType<D, bool, P> isCompNull(vecType<D, T, P> const & v, T const & epsilon);
//! Check whether two vectors are orthonormal. //! Check whether two vectors are orthonormal.
/// @see gtx_vector_query extensions. /// @see gtx_vector_query extensions.
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_DECL bool areOrthonormal(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon); GLM_FUNC_DECL bool areOrthonormal(vecType<D, T, P> const & v0, vecType<D, T, P> const & v1, T const & epsilon);
/// @} /// @}
}// namespace glm }// namespace glm

View File

@ -6,11 +6,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_areCollinear{}; struct compute_areCollinear{};
template <typename T, precision P> template <typename T, precision P>
struct compute_areCollinear<T, P, tvec2> struct compute_areCollinear<2, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static bool call(tvec2<T, P> const & v0, tvec2<T, P> const & v1, T const & epsilon) GLM_FUNC_QUALIFIER static bool call(tvec2<T, P> const & v0, tvec2<T, P> const & v1, T const & epsilon)
{ {
@ -19,7 +19,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_areCollinear<T, P, tvec3> struct compute_areCollinear<3, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static bool call(tvec3<T, P> const & v0, tvec3<T, P> const & v1, T const & epsilon) GLM_FUNC_QUALIFIER static bool call(tvec3<T, P> const & v0, tvec3<T, P> const & v1, T const & epsilon)
{ {
@ -28,7 +28,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_areCollinear<T, P, tvec4> struct compute_areCollinear<4, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static bool call(tvec4<T, P> const & v0, tvec4<T, P> const & v1, T const & epsilon) GLM_FUNC_QUALIFIER static bool call(tvec4<T, P> const & v0, tvec4<T, P> const & v1, T const & epsilon)
{ {
@ -36,11 +36,11 @@ namespace detail
} }
}; };
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
struct compute_isCompNull{}; struct compute_isCompNull{};
template <typename T, precision P> template <typename T, precision P>
struct compute_isCompNull<T, P, tvec2> struct compute_isCompNull<2, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec2<bool, P> call(tvec2<T, P> const & v, T const & epsilon) GLM_FUNC_QUALIFIER static tvec2<bool, P> call(tvec2<T, P> const & v, T const & epsilon)
{ {
@ -51,7 +51,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_isCompNull<T, P, tvec3> struct compute_isCompNull<3, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec3<bool, P> call(tvec3<T, P> const & v, T const & epsilon) GLM_FUNC_QUALIFIER static tvec3<bool, P> call(tvec3<T, P> const & v, T const & epsilon)
{ {
@ -63,7 +63,7 @@ namespace detail
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_isCompNull<T, P, tvec4> struct compute_isCompNull<4, T, P, tvec>
{ {
GLM_FUNC_QUALIFIER static tvec4<bool, P> call(tvec4<T, P> const & v, T const & epsilon) GLM_FUNC_QUALIFIER static tvec4<bool, P> call(tvec4<T, P> const & v, T const & epsilon)
{ {
@ -77,24 +77,24 @@ namespace detail
}//namespace detail }//namespace detail
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool areCollinear GLM_FUNC_QUALIFIER bool areCollinear
( (
vecType<T, P> const & v0, vecType<D, T, P> const & v0,
vecType<T, P> const & v1, vecType<D, T, P> const & v1,
T const & epsilon T const & epsilon
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'areCollinear' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'areCollinear' only accept floating-point inputs");
return detail::compute_areCollinear<T, P, vecType>::call(v0, v1, epsilon); return detail::compute_areCollinear<D, T, P, vecType>::call(v0, v1, epsilon);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool areOrthogonal GLM_FUNC_QUALIFIER bool areOrthogonal
( (
vecType<T, P> const & v0, vecType<D, T, P> const & v0,
vecType<T, P> const & v1, vecType<D, T, P> const & v1,
T const & epsilon T const & epsilon
) )
{ {
@ -105,10 +105,10 @@ namespace detail
length(v0)) * max(static_cast<T>(1), length(v1)) * epsilon; length(v0)) * max(static_cast<T>(1), length(v1)) * epsilon;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool isNormalized GLM_FUNC_QUALIFIER bool isNormalized
( (
vecType<T, P> const & v, vecType<D, T, P> const & v,
T const & epsilon T const & epsilon
) )
{ {
@ -117,10 +117,10 @@ namespace detail
return abs(length(v) - static_cast<T>(1)) <= static_cast<T>(2) * epsilon; return abs(length(v) - static_cast<T>(1)) <= static_cast<T>(2) * epsilon;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool isNull GLM_FUNC_QUALIFIER bool isNull
( (
vecType<T, P> const & v, vecType<D, T, P> const & v,
T const & epsilon T const & epsilon
) )
{ {
@ -129,16 +129,16 @@ namespace detail
return length(v) <= epsilon; return length(v) <= epsilon;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> isCompNull GLM_FUNC_QUALIFIER vecType<D, bool, P> isCompNull
( (
vecType<T, P> const & v, vecType<D, T, P> const & v,
T const & epsilon T const & epsilon
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isCompNull' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isCompNull' only accept floating-point inputs");
return detail::compute_isCompNull<T, P, vecType>::call(v, epsilon); return detail::compute_isCompNull<D, T, P, vecType>::call(v, epsilon);
} }
template <typename T, precision P> template <typename T, precision P>
@ -179,11 +179,11 @@ namespace detail
abs(v.w) < epsilon); abs(v.w) < epsilon);
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool areOrthonormal GLM_FUNC_QUALIFIER bool areOrthonormal
( (
vecType<T, P> const & v0, vecType<D, T, P> const & v0,
vecType<T, P> const & v1, vecType<D, T, P> const & v1,
T const & epsilon T const & epsilon
) )
{ {

View File

@ -3,10 +3,10 @@
namespace glm namespace glm
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const& Texcoord) GLM_FUNC_QUALIFIER vecType<D, T, P> clamp(vecType<D, T, P> const& Texcoord)
{ {
return glm::clamp(Texcoord, vecType<T, P>(0), vecType<T, P>(1)); return glm::clamp(Texcoord, vecType<D, T, P>(0), vecType<D, T, P>(1));
} }
template <typename genType> template <typename genType>
@ -15,8 +15,8 @@ namespace glm
return clamp(tvec1<genType, defaultp>(Texcoord)).x; return clamp(tvec1<genType, defaultp>(Texcoord)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> repeat(vecType<T, P> const& Texcoord) GLM_FUNC_QUALIFIER vecType<D, T, P> repeat(vecType<D, T, P> const& Texcoord)
{ {
return glm::fract(Texcoord); return glm::fract(Texcoord);
} }
@ -27,8 +27,8 @@ namespace glm
return repeat(tvec1<genType, defaultp>(Texcoord)).x; return repeat(tvec1<genType, defaultp>(Texcoord)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> mirrorClamp(vecType<T, P> const& Texcoord) GLM_FUNC_QUALIFIER vecType<D, T, P> mirrorClamp(vecType<D, T, P> const& Texcoord)
{ {
return glm::fract(glm::abs(Texcoord)); return glm::fract(glm::abs(Texcoord));
} }
@ -39,15 +39,15 @@ namespace glm
return mirrorClamp(tvec1<genType, defaultp>(Texcoord)).x; return mirrorClamp(tvec1<genType, defaultp>(Texcoord)).x;
} }
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> mirrorRepeat(vecType<T, P> const& Texcoord) GLM_FUNC_QUALIFIER vecType<D, T, P> mirrorRepeat(vecType<D, T, P> const& Texcoord)
{ {
vecType<T, P> const Abs = glm::abs(Texcoord); vecType<D, T, P> const Abs = glm::abs(Texcoord);
vecType<T, P> const Clamp = glm::mod(glm::floor(Abs), vecType<T, P>(2)); vecType<D, T, P> const Clamp = glm::mod(glm::floor(Abs), vecType<D, T, P>(2));
vecType<T, P> const Floor = glm::floor(Abs); vecType<D, T, P> const Floor = glm::floor(Abs);
vecType<T, P> const Rest = Abs - Floor; vecType<D, T, P> const Rest = Abs - Floor;
vecType<T, P> const Mirror = Clamp + Rest; vecType<D, T, P> const Mirror = Clamp + Rest;
return mix(Rest, vecType<T, P>(1) - Rest, glm::greaterThanEqual(Mirror, vecType<T, P>(1))); return mix(Rest, vecType<D, T, P>(1) - Rest, glm::greaterThanEqual(Mirror, vecType<D, T, P>(1)));
} }
template <typename genType> template <typename genType>

View File

@ -151,17 +151,17 @@ namespace bitfieldReverse
return Result; return Result;
} }
*/ */
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverseLoop(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverseLoop(vecType<D, T, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldReverse' only accept integer values"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldReverse' only accept integer values");
vecType<T, P> Result(0); vecType<D, T, P> Result(0);
T const BitSize = static_cast<T>(sizeof(T) * 8); T const BitSize = static_cast<T>(sizeof(T) * 8);
for(T i = 0; i < BitSize; ++i) for(T i = 0; i < BitSize; ++i)
{ {
vecType<T, P> const BitSet(v & (static_cast<T>(1) << i)); vecType<D, T, P> const BitSet(v & (static_cast<T>(1) << i));
vecType<T, P> const BitFirst(BitSet >> i); vecType<D, T, P> const BitFirst(BitSet >> i);
Result |= BitFirst << (BitSize - 1 - i); Result |= BitFirst << (BitSize - 1 - i);
} }
return Result; return Result;
@ -170,7 +170,7 @@ namespace bitfieldReverse
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T bitfieldReverseLoop(T v) GLM_FUNC_QUALIFIER T bitfieldReverseLoop(T v)
{ {
return bitfieldReverseLoop(glm::tvec1<T>(v)).x; return bitfieldReverseLoop(glm::tvec<1, T>(v)).x;
} }
GLM_FUNC_QUALIFIER glm::uint32_t bitfieldReverseUint32(glm::uint32_t x) GLM_FUNC_QUALIFIER glm::uint32_t bitfieldReverseUint32(glm::uint32_t x)
@ -197,8 +197,8 @@ namespace bitfieldReverse
template <bool EXEC = false> template <bool EXEC = false>
struct compute_bitfieldReverseStep struct compute_bitfieldReverseStep
{ {
template <typename T, glm::precision P, template <class, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
{ {
return v; return v;
} }
@ -207,17 +207,17 @@ namespace bitfieldReverse
template <> template <>
struct compute_bitfieldReverseStep<true> struct compute_bitfieldReverseStep<true>
{ {
template <typename T, glm::precision P, template <class, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
{ {
return (v & Mask) << Shift | (v & (~Mask)) >> Shift; return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverseOps(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldReverseOps(vecType<D, T, P> const & v)
{ {
vecType<T, P> x(v); vecType<D, 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 >= 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 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
@ -230,7 +230,7 @@ namespace bitfieldReverse
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType bitfieldReverseOps(genType x) GLM_FUNC_QUALIFIER genType bitfieldReverseOps(genType x)
{ {
return bitfieldReverseOps(glm::tvec1<genType, glm::defaultp>(x)).x; return bitfieldReverseOps(glm::tvec<1, genType, glm::defaultp>(x)).x;
} }
template <typename genType> template <typename genType>
@ -1407,8 +1407,8 @@ namespace bitCount
template <bool EXEC = false> template <bool EXEC = false>
struct compute_bitfieldBitCountStep struct compute_bitfieldBitCountStep
{ {
template <typename T, glm::precision P, template <class, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T, T)
{ {
return v; return v;
} }
@ -1417,30 +1417,30 @@ namespace bitCount
template <> template <>
struct compute_bitfieldBitCountStep<true> struct compute_bitfieldBitCountStep<true>
{ {
template <typename T, glm::precision P, template <class, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Mask, T Shift)
{ {
return (v & Mask) + ((v >> Shift) & Mask); return (v & Mask) + ((v >> Shift) & Mask);
} }
}; };
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> bitCount_bitfield(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<D, int, P> bitCount_bitfield(vecType<D, T, P> const & v)
{ {
vecType<typename glm::detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename glm::detail::make_unsigned<T>::type, 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));
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 >= 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 >= 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 >= 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 >= 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 >= 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)); 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<int, P>(x); return vecType<D, int, P>(x);
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER int bitCount_bitfield(genType x) GLM_FUNC_QUALIFIER int bitCount_bitfield(genType x)
{ {
return bitCount_bitfield(glm::tvec1<genType, glm::defaultp>(x)).x; return bitCount_bitfield(glm::tvec<1, genType, glm::defaultp>(x)).x;
} }
int perf(std::size_t Size) int perf(std::size_t Size)

View File

@ -157,24 +157,24 @@ namespace detail
// convertFunc class // convertFunc class
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType, convertMode mode = CONVERT_MODE_CAST, bool isSamplerFloat = false> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType, convertMode mode = CONVERT_MODE_CAST, bool isSamplerFloat = false>
struct convertFunc struct convertFunc
{ {
typedef accessFunc<textureType, vecType<T, P> > access; typedef accessFunc<textureType, vecType<D, T, P> > access;
static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level) static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
{ {
return make_vec4<retType, P>(vecType<retType, P>(access::load(Texture, TexelCoord, Layer, Face, Level))); return make_vec4<retType, P>(vecType<D, retType, P>(access::load(Texture, TexelCoord, Layer, Face, Level)));
} }
static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel) static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
{ {
access::store(Texture, TexelCoord, Layer, Face, Level, vecType<T, P>(Texel)); access::store(Texture, TexelCoord, Layer, Face, Level, vecType<D, T, P>(Texel));
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType, bool isSamplerFloat> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType, bool isSamplerFloat>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_DEFAULT, isSamplerFloat> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_DEFAULT, isSamplerFloat>
{ {
static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level) static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
{ {
@ -185,10 +185,10 @@ namespace detail
{} {}
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_NORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_NORM, true>
{ {
typedef accessFunc<textureType, vecType<T, P> > access; typedef accessFunc<textureType, vecType<D, T, P> > access;
static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level) static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
{ {
@ -199,14 +199,14 @@ namespace detail
static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel) static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
{ {
static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_NORM requires a float sampler"); static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_NORM requires a float sampler");
access::store(Texture, TexelCoord, Layer, Face, Level, compScale<T>(vecType<retType, P>(Texel))); access::store(Texture, TexelCoord, Layer, Face, Level, compScale<T>(vecType<D, retType, P>(Texel)));
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_SRGB, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_SRGB, true>
{ {
typedef accessFunc<textureType, vecType<T, P> > access; typedef accessFunc<textureType, vecType<D, T, P> > access;
static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level) static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
{ {
@ -217,12 +217,12 @@ namespace detail
static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel) static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
{ {
static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_SRGB requires a float sampler"); static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_SRGB requires a float sampler");
access::store(Texture, TexelCoord, Layer, Face, Level, gli::compScale<T>(convertLinearToSRGB(vecType<retType, P>(Texel)))); access::store(Texture, TexelCoord, Layer, Face, Level, gli::compScale<T>(convertLinearToSRGB(vecType<D, retType, P>(Texel))));
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB9E5, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB9E5, true>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -239,8 +239,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RG11B10F, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RG11B10F, true>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -257,26 +257,26 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_HALF, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_HALF, true>
{ {
typedef accessFunc<textureType, vecType<uint16, P> > access; typedef accessFunc<textureType, vecType<D, uint16, P> > access;
static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level) static tvec4<retType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
{ {
static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_HALF requires a float sampler"); static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_HALF requires a float sampler");
return make_vec4<retType, P>(vecType<retType, P>(unpackHalf(access::load(Texture, TexelCoord, Layer, Face, Level)))); return make_vec4<retType, P>(vecType<D, retType, P>(unpackHalf(access::load(Texture, TexelCoord, Layer, Face, Level))));
} }
static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel) static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<retType, P> const & Texel)
{ {
static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_HALF requires a float sampler"); static_assert(std::numeric_limits<retType>::is_iec559, "CONVERT_MODE_HALF requires a float sampler");
access::store(Texture, TexelCoord, Layer, Face, Level, packHalf(vecType<float, P>(Texel))); access::store(Texture, TexelCoord, Layer, Face, Level, packHalf(vecType<D, float, P>(Texel)));
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_44UNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_44UNORM, true>
{ {
typedef accessFunc<textureType, uint8> access; typedef accessFunc<textureType, uint8> access;
@ -293,8 +293,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_4444UNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_4444UNORM, true>
{ {
typedef accessFunc<textureType, uint16> access; typedef accessFunc<textureType, uint16> access;
@ -311,8 +311,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_565UNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_565UNORM, true>
{ {
typedef accessFunc<textureType, uint16> access; typedef accessFunc<textureType, uint16> access;
@ -329,8 +329,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_5551UNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_5551UNORM, true>
{ {
typedef accessFunc<textureType, uint16> access; typedef accessFunc<textureType, uint16> access;
@ -347,8 +347,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_332UNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_332UNORM, true>
{ {
typedef accessFunc<textureType, uint8> access; typedef accessFunc<textureType, uint8> access;
@ -365,8 +365,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2UNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB10A2UNORM, true>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -383,8 +383,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2SNORM, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB10A2SNORM, true>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -401,8 +401,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2USCALE, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB10A2USCALE, true>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -426,8 +426,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2SSCALE, true> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB10A2SSCALE, true>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -451,8 +451,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2UINT, false> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB10A2UINT, false>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -469,8 +469,8 @@ namespace detail
} }
}; };
template <typename textureType, typename retType, typename T, precision P, template <typename, precision> class vecType> template <typename textureType, typename retType, int D, typename T, precision P, template <int, typename, precision> class vecType>
struct convertFunc<textureType, retType, T, P, vecType, CONVERT_MODE_RGB10A2SINT, false> struct convertFunc<textureType, retType, D, T, P, vecType, CONVERT_MODE_RGB10A2SINT, false>
{ {
typedef accessFunc<textureType, uint32> access; typedef accessFunc<textureType, uint32> access;
@ -493,17 +493,17 @@ namespace detail
typedef glm::tvec4<samplerValType, P>(*fetchFunc)(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level); typedef glm::tvec4<samplerValType, P>(*fetchFunc)(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level);
typedef void(*writeFunc)(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, glm::tvec4<samplerValType, P> const & Texel); typedef void(*writeFunc)(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, glm::tvec4<samplerValType, P> const & Texel);
template <typename T, template <typename, precision> class vecType, convertMode mode> template <int D, typename T, template <int, typename, precision> class vecType, convertMode mode>
struct conv struct conv
{ {
static tvec4<samplerValType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level) static tvec4<samplerValType, P> fetch(textureType const & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level)
{ {
return convertFunc<textureType, samplerValType, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::fetch(Texture, TexelCoord, Layer, Face, Level); return convertFunc<textureType, samplerValType, D, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::fetch(Texture, TexelCoord, Layer, Face, Level);
} }
static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<samplerValType, P> const & Texel) static void write(textureType & Texture, typename textureType::extent_type const & TexelCoord, typename textureType::size_type Layer, typename textureType::size_type Face, typename textureType::size_type Level, tvec4<samplerValType, P> const & Texel)
{ {
convertFunc<textureType, samplerValType, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::write(Texture, TexelCoord, Layer, Face, Level, Texel); convertFunc<textureType, samplerValType, D, T, P, vecType, mode, std::numeric_limits<samplerValType>::is_iec559>::write(Texture, TexelCoord, Layer, Face, Level, Texel);
} }
}; };
@ -517,246 +517,246 @@ namespace detail
{ {
static func Table[] = static func Table[] =
{ {
{conv<u8, tvec2, CONVERT_MODE_44UNORM>::fetch, conv<u8, tvec2, CONVERT_MODE_44UNORM>::write}, // FORMAT_RG4_UNORM {conv<2, u8, tvec, CONVERT_MODE_44UNORM>::fetch, conv<2, u8, tvec, CONVERT_MODE_44UNORM>::write}, // FORMAT_RG4_UNORM
{conv<u8, tvec4, CONVERT_MODE_4444UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_4444UNORM>::write}, // FORMAT_RGBA4_UNORM {conv<4, u8, tvec, CONVERT_MODE_4444UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_4444UNORM>::write}, // FORMAT_RGBA4_UNORM
{conv<u8, tvec4, CONVERT_MODE_4444UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_4444UNORM>::write}, // FORMAT_BGRA4_UNORM {conv<4, u8, tvec, CONVERT_MODE_4444UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_4444UNORM>::write}, // FORMAT_BGRA4_UNORM
{conv<u8, tvec3, CONVERT_MODE_565UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_565UNORM>::write}, // FORMAT_R5G6B5_UNORM {conv<3, u8, tvec, CONVERT_MODE_565UNORM>::fetch, conv<3, u8, tvec, CONVERT_MODE_565UNORM>::write}, // FORMAT_R5G6B5_UNORM
{conv<u8, tvec3, CONVERT_MODE_565UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_565UNORM>::write}, // FORMAT_B5G6R5_UNORM {conv<3, u8, tvec, CONVERT_MODE_565UNORM>::fetch, conv<3, u8, tvec, CONVERT_MODE_565UNORM>::write}, // FORMAT_B5G6R5_UNORM
{conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write}, // FORMAT_RGB5A1_UNORM {conv<4, u8, tvec, CONVERT_MODE_5551UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_5551UNORM>::write}, // FORMAT_RGB5A1_UNORM
{conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write}, // FORMAT_BGR5A1_UNORM {conv<4, u8, tvec, CONVERT_MODE_5551UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_5551UNORM>::write}, // FORMAT_BGR5A1_UNORM
{conv<u8, tvec4, CONVERT_MODE_5551UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_5551UNORM>::write}, // FORMAT_A1RGB5_UNORM {conv<4, u8, tvec, CONVERT_MODE_5551UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_5551UNORM>::write}, // FORMAT_A1RGB5_UNORM
{conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R8_UNORM {conv<1, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<1, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_R8_UNORM
{conv<i8, tvec1, CONVERT_MODE_NORM>::fetch, conv<i8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R8_SNORM {conv<1, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<1, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_R8_SNORM
{conv<u8, tvec1, CONVERT_MODE_CAST>::fetch, conv<u8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_USCALED {conv<1, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<1, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R8_USCALED
{conv<i8, tvec1, CONVERT_MODE_CAST>::fetch, conv<i8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_SSCALED {conv<1, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<1, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R8_SSCALED
{conv<u8, tvec1, CONVERT_MODE_CAST>::fetch, conv<u8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_UINT {conv<1, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<1, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R8_UINT
{conv<i8, tvec1, CONVERT_MODE_CAST>::fetch, conv<i8, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R8_SINT {conv<1, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<1, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R8_SINT
{conv<u8, tvec1, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec1, CONVERT_MODE_SRGB>::write}, // FORMAT_R8_SRGB {conv<1, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<1, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_R8_SRGB
{conv<u8, tvec2, CONVERT_MODE_NORM>::fetch, conv<u8, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG8_UNORM {conv<2, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<2, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RG8_UNORM
{conv<i8, tvec2, CONVERT_MODE_NORM>::fetch, conv<i8, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG8_SNORM {conv<2, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<2, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RG8_SNORM
{conv<u8, tvec2, CONVERT_MODE_CAST>::fetch, conv<u8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_USCALED {conv<2, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<2, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_USCALED
{conv<i8, tvec2, CONVERT_MODE_CAST>::fetch, conv<i8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_SSCALED {conv<2, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<2, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_SSCALED
{conv<u8, tvec2, CONVERT_MODE_CAST>::fetch, conv<u8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_UINT {conv<2, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<2, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_UINT
{conv<i8, tvec2, CONVERT_MODE_CAST>::fetch, conv<i8, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_SINT {conv<2, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<2, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG8_SINT
{conv<u8, tvec2, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec2, CONVERT_MODE_SRGB>::write}, // FORMAT_RG8_SRGB {conv<2, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<2, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_RG8_SRGB
{conv<u8, tvec3, CONVERT_MODE_NORM>::fetch, conv<u8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB8_UNORM {conv<3, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<3, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGB8_UNORM
{conv<i8, tvec3, CONVERT_MODE_NORM>::fetch, conv<i8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB8_SNORM {conv<3, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<3, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGB8_SNORM
{conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_USCALED {conv<3, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_USCALED
{conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_SSCALED {conv<3, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_SSCALED
{conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_UINT {conv<3, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_UINT
{conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_SINT {conv<3, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB8_SINT
{conv<u8, tvec3, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec3, CONVERT_MODE_SRGB>::write}, // FORMAT_RGB8_SRGB {conv<3, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<3, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_RGB8_SRGB
{conv<u8, tvec3, CONVERT_MODE_NORM>::fetch, conv<u8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_BGR8_UNORM {conv<3, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<3, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_BGR8_UNORM
{conv<i8, tvec3, CONVERT_MODE_NORM>::fetch, conv<i8, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_BGR8_SNORM {conv<3, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<3, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_BGR8_SNORM
{conv<u8, tvec3, CONVERT_MODE_CAST>::fetch, conv<u8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_USCALED {conv<3, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_USCALED
{conv<i8, tvec3, CONVERT_MODE_CAST>::fetch, conv<i8, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_SSCALED {conv<3, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_SSCALED
{conv<u32, tvec3, CONVERT_MODE_CAST>::fetch, conv<u32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_UINT {conv<3, u32, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_UINT
{conv<i32, tvec3, CONVERT_MODE_CAST>::fetch, conv<i32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_SINT {conv<3, i32, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGR8_SINT
{conv<u8, tvec3, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec3, CONVERT_MODE_SRGB>::write}, // FORMAT_BGR8_SRGB {conv<3, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<3, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_BGR8_SRGB
{conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA8_UNORM {conv<4, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA8_UNORM
{conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA8_SNORM {conv<4, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA8_SNORM
{conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_USCALED {conv<4, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_USCALED
{conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_SSCALED {conv<4, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_SSCALED
{conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_UINT {conv<4, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_UINT
{conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_SINT {conv<4, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA8_SINT
{conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_RGBA8_SRGB {conv<4, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<4, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_RGBA8_SRGB
{conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_BGRA8_UNORM {conv<4, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_BGRA8_UNORM
{conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_BGRA8_SNORM {conv<4, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_BGRA8_SNORM
{conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_USCALED {conv<4, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_USCALED
{conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_SSCALED {conv<4, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_SSCALED
{conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_UINT {conv<4, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_UINT
{conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_SINT {conv<4, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_BGRA8_SINT
{conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_BGRA8_SRGB {conv<4, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<4, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_BGRA8_SRGB
{conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_ABGR8_UNORM {conv<4, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_ABGR8_UNORM
{conv<i8, tvec4, CONVERT_MODE_NORM>::fetch, conv<i8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_ABGR8_SNORM {conv<4, i8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, i8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_ABGR8_SNORM
{conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_USCALED {conv<4, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_USCALED
{conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_SSCALED {conv<4, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_SSCALED
{conv<u8, tvec4, CONVERT_MODE_CAST>::fetch, conv<u8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_UINT {conv<4, u8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_UINT
{conv<i8, tvec4, CONVERT_MODE_CAST>::fetch, conv<i8, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_SINT {conv<4, i8, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i8, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_ABGR8_SINT
{conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_ABGR8_SRGB {conv<4, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<4, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_ABGR8_SRGB
{conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::write}, // FORMAT_RGB10A2_UNORM {conv<4, u8, tvec, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_RGB10A2UNORM>::write}, // FORMAT_RGB10A2_UNORM
{conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::write}, // FORMAT_RGB10A2_SNORM {conv<4, i8, tvec, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<4, i8, tvec, CONVERT_MODE_RGB10A2SNORM>::write}, // FORMAT_RGB10A2_SNORM
{conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::write}, // FORMAT_RGB10A2_USCALED {conv<4, u8, tvec, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<4, u8, tvec, CONVERT_MODE_RGB10A2USCALE>::write}, // FORMAT_RGB10A2_USCALED
{conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::write}, // FORMAT_RGB10A2_SSCALED {conv<4, i8, tvec, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<4, i8, tvec, CONVERT_MODE_RGB10A2SSCALE>::write}, // FORMAT_RGB10A2_SSCALED
{conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::write}, // FORMAT_RGB10A2_UINT {conv<4, u8, tvec, CONVERT_MODE_RGB10A2UINT>::fetch, conv<4, u8, tvec, CONVERT_MODE_RGB10A2UINT>::write}, // FORMAT_RGB10A2_UINT
{conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::write}, // FORMAT_RGB10A2_SINT {conv<4, i8, tvec, CONVERT_MODE_RGB10A2SINT>::fetch, conv<4, i8, tvec, CONVERT_MODE_RGB10A2SINT>::write}, // FORMAT_RGB10A2_SINT
{conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UNORM>::write}, // FORMAT_BGR10A2_UNORM {conv<4, u8, tvec, CONVERT_MODE_RGB10A2UNORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_RGB10A2UNORM>::write}, // FORMAT_BGR10A2_UNORM
{conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SNORM>::write}, // FORMAT_BGR10A2_SNORM {conv<4, i8, tvec, CONVERT_MODE_RGB10A2SNORM>::fetch, conv<4, i8, tvec, CONVERT_MODE_RGB10A2SNORM>::write}, // FORMAT_BGR10A2_SNORM
{conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2USCALE>::write}, // FORMAT_BGR10A2_USCALED {conv<4, u8, tvec, CONVERT_MODE_RGB10A2USCALE>::fetch, conv<4, u8, tvec, CONVERT_MODE_RGB10A2USCALE>::write}, // FORMAT_BGR10A2_USCALED
{conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SSCALE>::write}, // FORMAT_BGR10A2_SSCALED {conv<4, i8, tvec, CONVERT_MODE_RGB10A2SSCALE>::fetch, conv<4, i8, tvec, CONVERT_MODE_RGB10A2SSCALE>::write}, // FORMAT_BGR10A2_SSCALED
{conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::fetch, conv<u8, tvec4, CONVERT_MODE_RGB10A2UINT>::write}, // FORMAT_BGR10A2_UINT {conv<4, u8, tvec, CONVERT_MODE_RGB10A2UINT>::fetch, conv<4, u8, tvec, CONVERT_MODE_RGB10A2UINT>::write}, // FORMAT_BGR10A2_UINT
{conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::fetch, conv<i8, tvec4, CONVERT_MODE_RGB10A2SINT>::write}, // FORMAT_BGR10A2_SINT {conv<4, i8, tvec, CONVERT_MODE_RGB10A2SINT>::fetch, conv<4, i8, tvec, CONVERT_MODE_RGB10A2SINT>::write}, // FORMAT_BGR10A2_SINT
{conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R16_UNORM_PACK16 {conv<1, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<1, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_R16_UNORM_PACK16
{conv<i16, tvec1, CONVERT_MODE_NORM>::fetch, conv<i16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_R16_SNORM_PACK16 {conv<1, i16, tvec, CONVERT_MODE_NORM>::fetch, conv<1, i16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_R16_SNORM_PACK16
{conv<u16, tvec1, CONVERT_MODE_CAST>::fetch, conv<u16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_USCALED_PACK16 {conv<1, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<1, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R16_USCALED_PACK16
{conv<i16, tvec1, CONVERT_MODE_CAST>::fetch, conv<i16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_SSCALED_PACK16 {conv<1, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<1, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R16_SSCALED_PACK16
{conv<u16, tvec1, CONVERT_MODE_CAST>::fetch, conv<u16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_UINT_PACK16 {conv<1, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<1, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R16_UINT_PACK16
{conv<i16, tvec1, CONVERT_MODE_CAST>::fetch, conv<i16, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R16_SINT_PACK16 {conv<1, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<1, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R16_SINT_PACK16
{conv<u16, tvec1, CONVERT_MODE_HALF>::fetch, conv<u16, tvec1, CONVERT_MODE_HALF>::write}, // FORMAT_R16_SFLOAT_PACK16 {conv<1, u16, tvec, CONVERT_MODE_HALF>::fetch, conv<1, u16, tvec, CONVERT_MODE_HALF>::write}, // FORMAT_R16_SFLOAT_PACK16
{conv<u16, tvec2, CONVERT_MODE_NORM>::fetch, conv<u16, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG16_UNORM_PACK16 {conv<2, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<2, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RG16_UNORM_PACK16
{conv<i16, tvec2, CONVERT_MODE_NORM>::fetch, conv<i16, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_RG16_SNORM_PACK16 {conv<2, i16, tvec, CONVERT_MODE_NORM>::fetch, conv<2, i16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RG16_SNORM_PACK16
{conv<u16, tvec2, CONVERT_MODE_CAST>::fetch, conv<u16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_USCALED_PACK16 {conv<2, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<2, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_USCALED_PACK16
{conv<i16, tvec2, CONVERT_MODE_CAST>::fetch, conv<i16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_SSCALED_PACK16 {conv<2, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<2, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_SSCALED_PACK16
{conv<u16, tvec2, CONVERT_MODE_CAST>::fetch, conv<u16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_UINT_PACK16 {conv<2, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<2, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_UINT_PACK16
{conv<i16, tvec2, CONVERT_MODE_CAST>::fetch, conv<i16, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_SINT_PACK16 {conv<2, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<2, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG16_SINT_PACK16
{conv<u16, tvec2, CONVERT_MODE_HALF>::fetch, conv<u16, tvec2, CONVERT_MODE_HALF>::write}, // FORMAT_RG16_SFLOAT_PACK16 {conv<2, u16, tvec, CONVERT_MODE_HALF>::fetch, conv<2, u16, tvec, CONVERT_MODE_HALF>::write}, // FORMAT_RG16_SFLOAT_PACK16
{conv<u16, tvec3, CONVERT_MODE_NORM>::fetch, conv<u16, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB16_UNORM_PACK16 {conv<3, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<3, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGB16_UNORM_PACK16
{conv<i16, tvec3, CONVERT_MODE_NORM>::fetch, conv<i16, tvec3, CONVERT_MODE_NORM>::write}, // FORMAT_RGB16_SNORM_PACK16 {conv<3, i16, tvec, CONVERT_MODE_NORM>::fetch, conv<3, i16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGB16_SNORM_PACK16
{conv<u16, tvec3, CONVERT_MODE_CAST>::fetch, conv<u16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_USCALED_PACK16 {conv<3, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_USCALED_PACK16
{conv<i16, tvec3, CONVERT_MODE_CAST>::fetch, conv<i16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_SSCALED_PACK16 {conv<3, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_SSCALED_PACK16
{conv<u16, tvec3, CONVERT_MODE_CAST>::fetch, conv<u16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_UINT_PACK16 {conv<3, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_UINT_PACK16
{conv<i16, tvec3, CONVERT_MODE_CAST>::fetch, conv<i16, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_SINT_PACK16 {conv<3, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB16_SINT_PACK16
{conv<u16, tvec3, CONVERT_MODE_HALF>::fetch, conv<u16, tvec3, CONVERT_MODE_HALF>::write}, // FORMAT_RGB16_SFLOAT_PACK16 {conv<3, u16, tvec, CONVERT_MODE_HALF>::fetch, conv<3, u16, tvec, CONVERT_MODE_HALF>::write}, // FORMAT_RGB16_SFLOAT_PACK16
{conv<u16, tvec4, CONVERT_MODE_NORM>::fetch, conv<u16, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA16_UNORM_PACK16 {conv<4, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<4, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA16_UNORM_PACK16
{conv<i16, tvec4, CONVERT_MODE_NORM>::fetch, conv<i16, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA16_SNORM_PACK16 {conv<4, i16, tvec, CONVERT_MODE_NORM>::fetch, conv<4, i16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_RGBA16_SNORM_PACK16
{conv<u16, tvec4, CONVERT_MODE_CAST>::fetch, conv<u16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_USCALED_PACK16 {conv<4, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_USCALED_PACK16
{conv<i16, tvec4, CONVERT_MODE_CAST>::fetch, conv<i16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_SSCALED_PACK16 {conv<4, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_SSCALED_PACK16
{conv<u16, tvec4, CONVERT_MODE_CAST>::fetch, conv<u16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_UINT_PACK16 {conv<4, u16, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_UINT_PACK16
{conv<i16, tvec4, CONVERT_MODE_CAST>::fetch, conv<i16, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_SINT_PACK16 {conv<4, i16, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i16, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA16_SINT_PACK16
{conv<u16, tvec4, CONVERT_MODE_HALF>::fetch, conv<u16, tvec4, CONVERT_MODE_HALF>::write}, // FORMAT_RGBA16_SFLOAT_PACK16 {conv<4, u16, tvec, CONVERT_MODE_HALF>::fetch, conv<4, u16, tvec, CONVERT_MODE_HALF>::write}, // FORMAT_RGBA16_SFLOAT_PACK16
{conv<u32, tvec1, CONVERT_MODE_CAST>::fetch, conv<u32, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R32_UINT_PACK32 {conv<1, u32, tvec, CONVERT_MODE_CAST>::fetch, conv<1, u32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R32_UINT_PACK32
{conv<i32, tvec1, CONVERT_MODE_CAST>::fetch, conv<i32, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R32_SINT_PACK32 {conv<1, i32, tvec, CONVERT_MODE_CAST>::fetch, conv<1, i32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R32_SINT_PACK32
{conv<f32, tvec1, CONVERT_MODE_CAST>::fetch, conv<f32, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R32_SFLOAT_PACK32 {conv<1, f32, tvec, CONVERT_MODE_CAST>::fetch, conv<1, f32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R32_SFLOAT_PACK32
{conv<u32, tvec2, CONVERT_MODE_CAST>::fetch, conv<u32, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_UINT_PACK32 {conv<2, u32, tvec, CONVERT_MODE_CAST>::fetch, conv<2, u32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_UINT_PACK32
{conv<i32, tvec2, CONVERT_MODE_CAST>::fetch, conv<i32, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_SINT_PACK32 {conv<2, i32, tvec, CONVERT_MODE_CAST>::fetch, conv<2, i32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_SINT_PACK32
{conv<f32, tvec2, CONVERT_MODE_CAST>::fetch, conv<f32, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_SFLOAT_PACK32 {conv<2, f32, tvec, CONVERT_MODE_CAST>::fetch, conv<2, f32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG32_SFLOAT_PACK32
{conv<u32, tvec3, CONVERT_MODE_CAST>::fetch, conv<u32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_UINT_PACK32 {conv<3, u32, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_UINT_PACK32
{conv<i32, tvec3, CONVERT_MODE_CAST>::fetch, conv<i32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_SINT_PACK32 {conv<3, i32, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_SINT_PACK32
{conv<f32, tvec3, CONVERT_MODE_CAST>::fetch, conv<f32, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_SFLOAT_PACK32 {conv<3, f32, tvec, CONVERT_MODE_CAST>::fetch, conv<3, f32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB32_SFLOAT_PACK32
{conv<u32, tvec4, CONVERT_MODE_CAST>::fetch, conv<u32, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_UINT_PACK32 {conv<4, u32, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_UINT_PACK32
{conv<i32, tvec4, CONVERT_MODE_CAST>::fetch, conv<i32, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_SINT_PACK32 {conv<4, i32, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_SINT_PACK32
{conv<f32, tvec4, CONVERT_MODE_CAST>::fetch, conv<f32, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_SFLOAT_PACK32 {conv<4, f32, tvec, CONVERT_MODE_CAST>::fetch, conv<4, f32, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA32_SFLOAT_PACK32
{conv<u64, tvec1, CONVERT_MODE_CAST>::fetch, conv<u64, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R64_UINT_PACK64 {conv<1, u64, tvec, CONVERT_MODE_CAST>::fetch, conv<1, u64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R64_UINT_PACK64
{conv<i64, tvec1, CONVERT_MODE_CAST>::fetch, conv<i64, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R64_SINT_PACK64 {conv<1, i64, tvec, CONVERT_MODE_CAST>::fetch, conv<1, i64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R64_SINT_PACK64
{conv<f64, tvec1, CONVERT_MODE_CAST>::fetch, conv<f64, tvec1, CONVERT_MODE_CAST>::write}, // FORMAT_R64_SFLOAT_PACK64 {conv<1, f64, tvec, CONVERT_MODE_CAST>::fetch, conv<1, f64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_R64_SFLOAT_PACK64
{conv<u64, tvec2, CONVERT_MODE_CAST>::fetch, conv<u64, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_UINT_PACK64 {conv<2, u64, tvec, CONVERT_MODE_CAST>::fetch, conv<2, u64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_UINT_PACK64
{conv<i64, tvec2, CONVERT_MODE_CAST>::fetch, conv<i64, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_SINT_PACK64 {conv<2, i64, tvec, CONVERT_MODE_CAST>::fetch, conv<2, i64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_SINT_PACK64
{conv<f64, tvec2, CONVERT_MODE_CAST>::fetch, conv<f64, tvec2, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_SFLOAT_PACK64 {conv<2, f64, tvec, CONVERT_MODE_CAST>::fetch, conv<2, f64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RG64_SFLOAT_PACK64
{conv<u64, tvec3, CONVERT_MODE_CAST>::fetch, conv<u64, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_UINT_PACK64 {conv<3, u64, tvec, CONVERT_MODE_CAST>::fetch, conv<3, u64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_UINT_PACK64
{conv<i64, tvec3, CONVERT_MODE_CAST>::fetch, conv<i64, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_SINT_PACK64 {conv<3, i64, tvec, CONVERT_MODE_CAST>::fetch, conv<3, i64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_SINT_PACK64
{conv<f64, tvec3, CONVERT_MODE_CAST>::fetch, conv<f64, tvec3, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_SFLOAT_PACK64 {conv<3, f64, tvec, CONVERT_MODE_CAST>::fetch, conv<3, f64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGB64_SFLOAT_PACK64
{conv<u64, tvec4, CONVERT_MODE_CAST>::fetch, conv<u64, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_UINT_PACK64 {conv<4, u64, tvec, CONVERT_MODE_CAST>::fetch, conv<4, u64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_UINT_PACK64
{conv<i64, tvec4, CONVERT_MODE_CAST>::fetch, conv<i64, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_SINT_PACK64 {conv<4, i64, tvec, CONVERT_MODE_CAST>::fetch, conv<4, i64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_SINT_PACK64
{conv<f64, tvec4, CONVERT_MODE_CAST>::fetch, conv<f64, tvec4, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_SFLOAT_PACK64 {conv<4, f64, tvec, CONVERT_MODE_CAST>::fetch, conv<4, f64, tvec, CONVERT_MODE_CAST>::write}, // FORMAT_RGBA64_SFLOAT_PACK64
{conv<u32, tvec1, CONVERT_MODE_RG11B10F>::fetch, conv<u32, tvec1, CONVERT_MODE_RG11B10F>::write}, // FORMAT_RG11B10_UFLOAT {conv<1, u32, tvec, CONVERT_MODE_RG11B10F>::fetch, conv<1, u32, tvec, CONVERT_MODE_RG11B10F>::write}, // FORMAT_RG11B10_UFLOAT
{conv<u32, tvec1, CONVERT_MODE_RGB9E5>::fetch, conv<u32, tvec1, CONVERT_MODE_RGB9E5>::write}, // FORMAT_RGB9E5_UFLOAT {conv<1, u32, tvec, CONVERT_MODE_RGB9E5>::fetch, conv<1, u32, tvec, CONVERT_MODE_RGB9E5>::write}, // FORMAT_RGB9E5_UFLOAT
{conv<u16, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u16, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D16_UNORM_PACK16 {conv<1, u16, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, u16, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D16_UNORM_PACK16
{conv<u32, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D24_UNORM {conv<1, u32, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, u32, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D24_UNORM
{conv<float, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D32_SFLOAT_PACK32 {conv<1, f32, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, f32, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D32_SFLOAT_PACK32
{conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_S8_UINT_PACK8 {conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_S8_UINT_PACK8
{conv<u16, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u16, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D16_UNORM_S8_UINT_PACK32 {conv<2, u16, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, u16, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D16_UNORM_S8_UINT_PACK32
{conv<u32, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D24_UNORM_S8_UINT_PACK32 {conv<2, u32, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, u32, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D24_UNORM_S8_UINT_PACK32
{conv<u32, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u32, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D32_SFLOAT_S8_UINT_PACK64 {conv<2, u32, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, u32, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_D32_SFLOAT_S8_UINT_PACK64
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_DXT1_UNORM_BLOCK8 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_DXT1_UNORM_BLOCK8
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_DXT1_SRGB_BLOCK8 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_DXT1_SRGB_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT1_UNORM_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT1_UNORM_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT1_SRGB_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT1_SRGB_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT3_UNORM_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT3_UNORM_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT3_SRGB_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT3_SRGB_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT5_UNORM_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT5_UNORM_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT5_SRGB_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_DXT5_SRGB_BLOCK16
{conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_ATI1N_UNORM_BLOCK8 {conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_ATI1N_UNORM_BLOCK8
{conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<i8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_ATI1N_SNORM_BLOCK8 {conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, i8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_ATI1N_SNORM_BLOCK8
{conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_ATI2N_UNORM_BLOCK16 {conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_ATI2N_UNORM_BLOCK16
{conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<i8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_ATI2N_SNORM_BLOCK16 {conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, i8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_ATI2N_SNORM_BLOCK16
{conv<float, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_BP_UFLOAT_BLOCK16 {conv<3, f32, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, f32, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_BP_UFLOAT_BLOCK16
{conv<float, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<float, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_BP_SFLOAT_BLOCK16 {conv<3, f32, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, f32, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_BP_SFLOAT_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_BP_UNORM_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_BP_UNORM_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_BP_SRGB_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_BP_SRGB_BLOCK16
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC2_UNORM_BLOCK8 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC2_UNORM_BLOCK8
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC2_SRGB_BLOCK8 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC2_SRGB_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_A1_UNORM_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_A1_UNORM_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_A1_SRGB_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_A1_SRGB_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_UNORM_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_UNORM_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_SRGB_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ETC2_SRGB_BLOCK16
{conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_EAC_UNORM_BLOCK8 {conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_EAC_UNORM_BLOCK8
{conv<u8, tvec1, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec1, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_EAC_SNORM_BLOCK8 {conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<1, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_R_EAC_SNORM_BLOCK8
{conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_EAC_UNORM_BLOCK16 {conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_EAC_UNORM_BLOCK16
{conv<u8, tvec2, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec2, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_EAC_SNORM_BLOCK16 {conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<2, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RG_EAC_SNORM_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_4x4_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_4x4_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_4x4_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_4x4_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x4_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x4_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x4_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x4_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x5_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x5_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x5_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_5x5_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x5_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x5_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x5_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x5_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x6_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x6_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x6_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_6x6_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x5_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x5_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x5_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x5_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x6_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x6_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x6_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x6_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x8_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x8_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x8_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_8x8_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x5_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x5_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x5_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x5_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x6_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x6_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x6_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x6_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x8_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x8_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x8_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x8_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x10_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x10_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x10_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_10x10_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x10_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x10_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x10_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x10_SRGB
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x12_UNORM {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x12_UNORM
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x12_SRGB {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_ASTC_12x12_SRGB
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_8X8_UNORM_BLOCK32 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_8X8_UNORM_BLOCK32
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_8X8_SRGB_BLOCK32 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_8X8_SRGB_BLOCK32
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_16X8_UNORM_BLOCK32 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_16X8_UNORM_BLOCK32
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_16X8_SRGB_BLOCK32 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_PVRTC1_16X8_SRGB_BLOCK32
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_8X8_UNORM_BLOCK32 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_8X8_UNORM_BLOCK32
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_8X8_SRGB_BLOCK32 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_8X8_SRGB_BLOCK32
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_16X8_UNORM_BLOCK32 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_16X8_UNORM_BLOCK32
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_16X8_SRGB_BLOCK32 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC1_16X8_SRGB_BLOCK32
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_4X4_UNORM_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_4X4_UNORM_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_4X4_SRGB_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_4X4_SRGB_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_8X4_UNORM_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_8X4_UNORM_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_8X4_SRGB_BLOCK8 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_PVRTC2_8X4_SRGB_BLOCK8
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC_UNORM_BLOCK8 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ETC_UNORM_BLOCK8
{conv<u8, tvec3, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec3, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ATC_UNORM_BLOCK8 {conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<3, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGB_ATC_UNORM_BLOCK8
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ATCA_UNORM_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ATCA_UNORM_BLOCK16
{conv<u8, tvec4, CONVERT_MODE_DEFAULT>::fetch, conv<u8, tvec4, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ATCI_UNORM_BLOCK16 {conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::fetch, conv<4, u8, tvec, CONVERT_MODE_DEFAULT>::write}, // FORMAT_RGBA_ATCI_UNORM_BLOCK16
{conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_L8_UNORM_PACK8 {conv<1, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<1, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_L8_UNORM_PACK8
{conv<u8, tvec1, CONVERT_MODE_NORM>::fetch, conv<u8, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_A8_UNORM_PACK8 {conv<1, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<1, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_A8_UNORM_PACK8
{conv<u8, tvec2, CONVERT_MODE_NORM>::fetch, conv<u8, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_LA8_UNORM_PACK8 {conv<2, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<2, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_LA8_UNORM_PACK8
{conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_L16_UNORM_PACK16 {conv<1, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<1, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_L16_UNORM_PACK16
{conv<u16, tvec1, CONVERT_MODE_NORM>::fetch, conv<u16, tvec1, CONVERT_MODE_NORM>::write}, // FORMAT_A16_UNORM_PACK16 {conv<1, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<1, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_A16_UNORM_PACK16
{conv<u16, tvec2, CONVERT_MODE_NORM>::fetch, conv<u16, tvec2, CONVERT_MODE_NORM>::write}, // FORMAT_LA16_UNORM_PACK16 {conv<2, u16, tvec, CONVERT_MODE_NORM>::fetch, conv<2, u16, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_LA16_UNORM_PACK16
{conv<u8, tvec4, CONVERT_MODE_NORM>::fetch, conv<u8, tvec4, CONVERT_MODE_NORM>::write}, // FORMAT_BGRX8_UNORM {conv<4, u8, tvec, CONVERT_MODE_NORM>::fetch, conv<4, u8, tvec, CONVERT_MODE_NORM>::write}, // FORMAT_BGRX8_UNORM
{conv<u8, tvec4, CONVERT_MODE_SRGB>::fetch, conv<u8, tvec4, CONVERT_MODE_SRGB>::write}, // FORMAT_BGRX8_SRGB {conv<4, u8, tvec, CONVERT_MODE_SRGB>::fetch, conv<4, u8, tvec, CONVERT_MODE_SRGB>::write}, // FORMAT_BGRX8_SRGB
{conv<u8, tvec3, CONVERT_MODE_332UNORM>::fetch, conv<u8, tvec3, CONVERT_MODE_332UNORM>::write} // FORMAT_RG3B2_UNORM {conv<3, u8, tvec, CONVERT_MODE_332UNORM>::fetch, conv<3, u8, tvec, CONVERT_MODE_332UNORM>::write} // FORMAT_RG3B2_UNORM
}; };
static_assert(sizeof(Table) / sizeof(Table[0]) == FORMAT_COUNT, "Texel functions need to be updated"); static_assert(sizeof(Table) / sizeof(Table[0]) == FORMAT_COUNT, "Texel functions need to be updated");

View File

@ -5,8 +5,8 @@
namespace gli{ namespace gli{
namespace detail namespace detail
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
inline vecType<bool, P> in_interval(vecType<T, P> const& Value, vecType<T, P> const& Min, vecType<T, P> const& Max) inline vecType<D, bool, P> in_interval(vecType<D, T, P> const& Value, vecType<D, T, P> const& Min, vecType<D, T, P> const& Max)
{ {
return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max); return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max);
} }

View File

@ -282,7 +282,7 @@ namespace detail
GLI_ASSERT(Format != static_cast<format>(FORMAT_INVALID)); GLI_ASSERT(Format != static_cast<format>(FORMAT_INVALID));
return Table[Format - FORMAT_FIRST]; return Table[Format - FORMAT_FIRST];
}; }
inline std::uint32_t bits_per_pixel(format Format) inline std::uint32_t bits_per_pixel(format Format)
{ {

View File

@ -3,8 +3,8 @@
namespace gli namespace gli
{ {
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
inline T levels(vecType<T, P> const& Extent) inline T levels(vecType<D, T, P> const& Extent)
{ {
return glm::log2(compMax(Extent)) + static_cast<T>(1); return glm::log2(compMax(Extent)) + static_cast<T>(1);
} }

View File

@ -73,14 +73,14 @@ namespace detail
uint32 pack; uint32 pack;
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType, bool isInteger, bool signedType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType, bool isInteger, bool signedType>
struct compute_compNormalize struct compute_compNormalize
{}; {};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, true, true> struct compute_compNormalize<T, floatType, P, vecType, true, true>
{ {
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<D, T, P> const & v)
{ {
floatType const Min = static_cast<floatType>(std::numeric_limits<T>::min()); floatType const Min = static_cast<floatType>(std::numeric_limits<T>::min());
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()); floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max());
@ -88,59 +88,59 @@ namespace detail
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, true, false> struct compute_compNormalize<T, floatType, P, vecType, true, false>
{ {
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<D, T, P> const & v)
{ {
return vecType<floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max()); return vecType<floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max());
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, false, true> struct compute_compNormalize<T, floatType, P, vecType, false, true>
{ {
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v) GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<D, T, P> const & v)
{ {
return v; return v;
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType, bool isInteger, bool signedType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType, bool isInteger, bool signedType>
struct compute_compScale struct compute_compScale
{}; {};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, true, true> struct compute_compScale<T, floatType, P, vecType, true, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<floatType, P> const & v)
{ {
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()) + static_cast<floatType>(0.5); floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()) + static_cast<floatType>(0.5);
vecType<floatType, P> const Scaled(v * Max); vecType<floatType, P> const Scaled(v * Max);
vecType<T, P> const Result(Scaled - static_cast<floatType>(0.5)); vecType<D, T, P> const Result(Scaled - static_cast<floatType>(0.5));
return Result; return Result;
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, true, false> struct compute_compScale<T, floatType, P, vecType, true, false>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<floatType, P> const & v)
{ {
return vecType<T, P>(vecType<floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max())); return vecType<D, T, P>(vecType<floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max()));
} }
}; };
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, false, true> struct compute_compScale<T, floatType, P, vecType, false, true>
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<floatType, P> const & v)
{ {
return v; return v;
} }
}; };
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
struct compute_half struct compute_half
{}; {};
@ -223,38 +223,38 @@ namespace detail
}; };
}//namespace detail }//namespace detail
template <typename floatType, typename T, precision P, template <typename, precision> class vecType> template <typename floatType, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> compNormalize(vecType<T, P> const & v) GLM_FUNC_QUALIFIER vecType<floatType, P> compNormalize(vecType<D, T, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter");
return detail::compute_compNormalize<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v); return detail::compute_compNormalize<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
} }
template <typename T, typename floatType, precision P, template <typename, precision> class vecType> template <typename T, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> compScale(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, T, P> compScale(vecType<floatType, P> const & v)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter");
return detail::compute_compScale<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v); return detail::compute_compScale<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
} }
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType> template <typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uintType, P> packUnorm(vecType<floatType, P> const & v) GLM_FUNC_QUALIFIER vecType<D, uintType, P> packUnorm(vecType<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<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"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max()))); return vecType<D, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
} }
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType> template <typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v) GLM_FUNC_QUALIFIER vecType<floatType, P> unpackUnorm(vecType<D, 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<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"); GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max())); return vecType<D, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
} }
GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const & v) GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const & v)
@ -376,14 +376,14 @@ namespace detail
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f); return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f);
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint16, P> packHalf(vecType<float, P> const & v) GLM_FUNC_QUALIFIER vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v)
{ {
return detail::compute_half<P, vecType>::pack(v); return detail::compute_half<P, vecType>::pack(v);
} }
template <precision P, template <typename, precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<float, P> unpackHalf(vecType<uint16, P> const & v) GLM_FUNC_QUALIFIER vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & v)
{ {
return detail::compute_half<P, vecType>::unpack(v); return detail::compute_half<P, vecType>::unpack(v);
} }

View File

@ -18,8 +18,8 @@ namespace gli
/// gli::texture2d::extent_type Extent(32, 10); /// gli::texture2d::extent_type Extent(32, 10);
/// gli::texture2d Texture(gli::levels(Extent)); /// gli::texture2d Texture(gli::levels(Extent));
/// @endcode /// @endcode
template <typename T, precision P, template <typename, precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
T levels(vecType<T, P> const& Extent); T levels(vecType<D, T, P> const& Extent);
/* /*
/// Compute the number of mipmaps levels necessary to create a mipmap complete texture /// Compute the number of mipmaps levels necessary to create a mipmap complete texture
/// ///

View File

@ -528,8 +528,8 @@ int test_packUnorm()
for(std::size_t i = 0; i < A.size(); ++i) for(std::size_t i = 0; i < A.size(); ++i)
{ {
glm::vec2 B(A[i]); glm::vec2 B(A[i]);
glm::u16vec2 C = glm::packUnorm<glm::uint16>(B); glm::u16vec2 C = glm::packUnorm<2, glm::uint16>(B);
glm::vec2 D = glm::unpackUnorm<glm::uint16, float>(C); glm::vec2 D = glm::unpackUnorm<2, glm::uint16, float>(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1;
assert(!Error); assert(!Error);
} }
@ -549,8 +549,8 @@ int test_packSnorm()
for(std::size_t i = 0; i < A.size(); ++i) for(std::size_t i = 0; i < A.size(); ++i)
{ {
glm::vec2 B(A[i]); glm::vec2 B(A[i]);
glm::i16vec2 C = glm::packSnorm<glm::int16>(B); glm::i16vec2 C = glm::packSnorm<2, glm::int16>(B);
glm::vec2 D = glm::unpackSnorm<glm::int16, float>(C); glm::vec2 D = glm::unpackSnorm<2, glm::int16, float>(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1; Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1;
assert(!Error); assert(!Error);
} }

View File

@ -173,15 +173,17 @@ namespace fastAtan
namespace taylorCos namespace taylorCos
{ {
using glm::precision;
glm::vec4 const AngleShift(0.0f, glm::pi<float>() * 0.5f, glm::pi<float>() * 1.0f, glm::pi<float>() * 1.5f); glm::vec4 const AngleShift(0.0f, glm::pi<float>() * 0.5f, glm::pi<float>() * 1.0f, glm::pi<float>() * 1.5f);
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorSeriesNewCos(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesNewCos(vecType<D, T, P> const & x)
{ {
vecType<T, P> const Powed2(x * x); vecType<D, T, P> const Powed2(x * x);
vecType<T, P> const Powed4(Powed2 * Powed2); vecType<D, T, P> const Powed4(Powed2 * Powed2);
vecType<T, P> const Powed6(Powed4 * Powed2); vecType<D, T, P> const Powed6(Powed4 * Powed2);
vecType<T, P> const Powed8(Powed4 * Powed4); vecType<D, T, P> const Powed8(Powed4 * Powed4);
return static_cast<T>(1) return static_cast<T>(1)
- Powed2 * static_cast<T>(0.5) - Powed2 * static_cast<T>(0.5)
@ -190,12 +192,12 @@ namespace taylorCos
+ Powed8 * static_cast<T>(2.4801587301587301587301587301587e-5); + Powed8 * static_cast<T>(2.4801587301587301587301587301587e-5);
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorSeriesNewCos6(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesNewCos6(vecType<D, T, P> const & x)
{ {
vecType<T, P> const Powed2(x * x); vecType<D, T, P> const Powed2(x * x);
vecType<T, P> const Powed4(Powed2 * Powed2); vecType<D, T, P> const Powed4(Powed2 * Powed2);
vecType<T, P> const Powed6(Powed4 * Powed2); vecType<D, T, P> const Powed6(Powed4 * Powed2);
return static_cast<T>(1) return static_cast<T>(1)
- Powed2 * static_cast<T>(0.5) - Powed2 * static_cast<T>(0.5)
@ -203,8 +205,8 @@ namespace taylorCos
- Powed6 * static_cast<T>(0.00138888888888888888888888888889); - Powed6 * static_cast<T>(0.00138888888888888888888888888889);
} }
template <glm::precision P, template <typename, glm::precision> class vecType> template <int D, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<float, P> fastAbs(vecType<float, P> x) GLM_FUNC_QUALIFIER vecType<D, float, P> fastAbs(vecType<D, float, P> x)
{ {
int* Pointer = reinterpret_cast<int*>(&x[0]); int* Pointer = reinterpret_cast<int*>(&x[0]);
Pointer[0] &= 0x7fffffff; Pointer[0] &= 0x7fffffff;
@ -214,17 +216,17 @@ namespace taylorCos
return x; return x;
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, glm::precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastCosNew(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastCosNew(vecType<D, T, P> const & x)
{ {
vecType<T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>())); vecType<D, T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
return taylorSeriesNewCos6(x); return taylorSeriesNewCos6(x);
/* /*
vecType<bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<T, P>(glm::half_pi<T>()))); vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
vecType<T, P> const RevertAngle(mix(vecType<T, P>(glm::pi<T>()), vecType<T, P>(0), FirstQuarterPi)); vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
vecType<T, P> const ReturnSign(mix(vecType<T, P>(-1), vecType<T, P>(1), FirstQuarterPi)); vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
vecType<T, P> const SectionAngle(RevertAngle - Angle0_PI); vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
return ReturnSign * taylorSeriesNewCos(SectionAngle); return ReturnSign * taylorSeriesNewCos(SectionAngle);
*/ */
@ -252,21 +254,21 @@ namespace taylorCos
return Error; return Error;
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> deterministic_fmod(vecType<T, P> const & x, T y) GLM_FUNC_QUALIFIER vecType<D, T, P> deterministic_fmod(vecType<D, T, P> const & x, T y)
{ {
return x - y * trunc(x / y); return x - y * trunc(x / y);
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastCosDeterminisctic(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastCosDeterminisctic(vecType<D, T, P> const & x)
{ {
vecType<T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>())); vecType<D, T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
vecType<bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<T, P>(glm::half_pi<T>()))); vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
vecType<T, P> const RevertAngle(mix(vecType<T, P>(glm::pi<T>()), vecType<T, P>(0), FirstQuarterPi)); vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
vecType<T, P> const ReturnSign(mix(vecType<T, P>(-1), vecType<T, P>(1), FirstQuarterPi)); vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
vecType<T, P> const SectionAngle(RevertAngle - Angle0_PI); vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
return ReturnSign * taylorSeriesNewCos(SectionAngle); return ReturnSign * taylorSeriesNewCos(SectionAngle);
} }
@ -293,8 +295,8 @@ namespace taylorCos
return Error; return Error;
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorSeriesRefCos(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> taylorSeriesRefCos(vecType<D, T, P> const & x)
{ {
return static_cast<T>(1) return static_cast<T>(1)
- (x * x) / glm::factorial(static_cast<T>(2)) - (x * x) / glm::factorial(static_cast<T>(2))
@ -303,17 +305,17 @@ namespace taylorCos
+ (x * x * x * x * x * x * x * x) / glm::factorial(static_cast<T>(8)); + (x * x * x * x * x * x * x * x) / glm::factorial(static_cast<T>(8));
} }
template <typename T, glm::precision P, template <typename, glm::precision> class vecType> template <int D, typename T, precision P, template <int, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fastRefCos(vecType<T, P> const & x) GLM_FUNC_QUALIFIER vecType<D, T, P> fastRefCos(vecType<D, T, P> const & x)
{ {
vecType<T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>())); vecType<D, T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
// return taylorSeriesRefCos(Angle0_PI); // return taylorSeriesRefCos(Angle0_PI);
vecType<bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<T, P>(glm::half_pi<T>()))); vecType<D, bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<D, T, P>(glm::half_pi<T>())));
vecType<T, P> const RevertAngle(mix(vecType<T, P>(glm::pi<T>()), vecType<T, P>(0), FirstQuarterPi)); vecType<D, T, P> const RevertAngle(mix(vecType<D, T, P>(glm::pi<T>()), vecType<D, T, P>(0), FirstQuarterPi));
vecType<T, P> const ReturnSign(mix(vecType<T, P>(-1), vecType<T, P>(1), FirstQuarterPi)); vecType<D, T, P> const ReturnSign(mix(vecType<D, T, P>(-1), vecType<D, T, P>(1), FirstQuarterPi));
vecType<T, P> const SectionAngle(RevertAngle - Angle0_PI); vecType<D, T, P> const SectionAngle(RevertAngle - Angle0_PI);
return ReturnSign * taylorSeriesRefCos(SectionAngle); return ReturnSign * taylorSeriesRefCos(SectionAngle);
} }