Fixed space characters

This commit is contained in:
Christophe Riccio 2012-11-08 15:00:50 +01:00
parent 669ace8067
commit 4d3af10700
27 changed files with 1750 additions and 1765 deletions

View File

@ -53,60 +53,60 @@ namespace glm
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
// Internal class for implementing swizzle operators // Internal class for implementing swizzle operators
template <typename T, int N> template <typename T, int N>
struct _swizzle_base0 struct _swizzle_base0
{ {
typedef T value_type; typedef T value_type;
protected: protected:
value_type& elem (size_t i) { return (reinterpret_cast<value_type*>(_buffer))[i]; } value_type& elem (size_t i) { return (reinterpret_cast<value_type*>(_buffer))[i]; }
const value_type& elem (size_t i) const { return (reinterpret_cast<const value_type*>(_buffer))[i]; } const value_type& elem (size_t i) const { return (reinterpret_cast<const value_type*>(_buffer))[i]; }
// Use an opaque buffer to *ensure* the compiler doesn't call a constructor. // Use an opaque buffer to *ensure* the compiler doesn't call a constructor.
// The size 1 buffer is assumed to aligned to the actual members so that the // The size 1 buffer is assumed to aligned to the actual members so that the
// elem() // elem()
char _buffer[1]; char _buffer[1];
}; };
template <typename T, typename V, int E0, int E1, int E2, int E3, int N> template <typename T, typename V, int E0, int E1, int E2, int E3, int N>
struct _swizzle_base1 : public _swizzle_base0<T,N> struct _swizzle_base1 : public _swizzle_base0<T,N>
{ {
}; };
template <typename T, typename V, int E0, int E1> template <typename T, typename V, int E0, int E1>
struct _swizzle_base1<T,V,E0,E1,-1,-2,2> : public _swizzle_base0<T,2> struct _swizzle_base1<T,V,E0,E1,-1,-2,2> : public _swizzle_base0<T,2>
{ {
V operator ()() const { return V(this->elem(E0), this->elem(E1)); } V operator ()() const { return V(this->elem(E0), this->elem(E1)); }
}; };
template <typename T, typename V, int E0, int E1, int E2> template <typename T, typename V, int E0, int E1, int E2>
struct _swizzle_base1<T,V,E0,E1,E2,-1,3> : public _swizzle_base0<T,3> struct _swizzle_base1<T,V,E0,E1,E2,-1,3> : public _swizzle_base0<T,3>
{ {
V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); }
}; };
template <typename T, typename V, int E0, int E1, int E2, int E3> template <typename T, typename V, int E0, int E1, int E2, int E3>
struct _swizzle_base1<T,V,E0,E1,E2,E3,4> : public _swizzle_base0<T,4> struct _swizzle_base1<T,V,E0,E1,E2,E3,4> : public _swizzle_base0<T,4>
{ {
V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }
}; };
// Internal class for implementing swizzle operators // Internal class for implementing swizzle operators
/* /*
Template parameters: Template parameters:
ValueType = type of scalar values (e.g. float, double) ValueType = type of scalar values (e.g. float, double)
VecType = class the swizzle is applies to (e.g. tvec3<float>) VecType = class the swizzle is applies to (e.g. tvec3<float>)
N = number of components in the vector (e.g. 3) N = number of components in the vector (e.g. 3)
E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec
DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles
containing duplicate elements so that they cannot be used as r-values). containing duplicate elements so that they cannot be used as r-values).
*/ */
template <typename ValueType, typename VecType, int N, int E0, int E1, int E2, int E3, int DUPLICATE_ELEMENTS> template <typename ValueType, typename VecType, int N, int E0, int E1, int E2, int E3, int DUPLICATE_ELEMENTS>
struct _swizzle_base2 : public _swizzle_base1<ValueType,VecType,E0,E1,E2,E3,N> struct _swizzle_base2 : public _swizzle_base1<ValueType,VecType,E0,E1,E2,E3,N>
{ {
typedef VecType vec_type; typedef VecType vec_type;
typedef ValueType value_type; typedef ValueType value_type;
@ -181,7 +181,7 @@ namespace detail
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
op( (*this)[i], t[i] ); op( (*this)[i], t[i] );
} }
}; };
// Specialization for swizzles containing duplicate elements. These cannot be modified. // Specialization for swizzles containing duplicate elements. These cannot be modified.
template <typename ValueType, typename VecType, int N, int E0, int E1, int E2, int E3> template <typename ValueType, typename VecType, int N, int E0, int E1, int E2, int E3>
@ -322,33 +322,32 @@ namespace glm
{ {
_GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-)
_GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*)
_GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+)
_GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-)
_GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*)
_GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/)
} }
// //
// Swizzles are distinct types from the unswizzled type. The below macros will // Swizzles are distinct types from the unswizzled type. The below macros will
// provide template specializations for the swizzle types for the given functions // provide template specializations for the swizzle types for the given functions
// so that the compiler does not have any ambiguity to choosing how to handle // so that the compiler does not have any ambiguity to choosing how to handle
// the function. // the function.
// //
// The alternative is to use the operator()() when calling the function in order // The alternative is to use the operator()() when calling the function in order
// to explicitly convert the swizzled type to the unswizzled type. // to explicitly convert the swizzled type to the unswizzled type.
// //
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step);
//_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix);
} }
#define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \ #define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \

View File

@ -27,37 +27,37 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#define VECTORIZE2_VEC(func) \ #define VECTORIZE2_VEC(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func( \ GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
detail::tvec2<T> const & v) \ detail::tvec2<T> const & v) \
{ \ { \
return detail::tvec2<T>( \ return detail::tvec2<T>( \
func(v.x), \ func(v.x), \
func(v.y)); \ func(v.y)); \
} }
#define VECTORIZE3_VEC(func) \ #define VECTORIZE3_VEC(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func( \ GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
detail::tvec3<T> const & v) \ detail::tvec3<T> const & v) \
{ \ { \
return detail::tvec3<T>( \ return detail::tvec3<T>( \
func(v.x), \ func(v.x), \
func(v.y), \ func(v.y), \
func(v.z)); \ func(v.z)); \
} }
#define VECTORIZE4_VEC(func) \ #define VECTORIZE4_VEC(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func( \ GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
detail::tvec4<T> const & v) \ detail::tvec4<T> const & v) \
{ \ { \
return detail::tvec4<T>( \ return detail::tvec4<T>( \
func(v.x), \ func(v.x), \
func(v.y), \ func(v.y), \
func(v.z), \ func(v.z), \
func(v.w)); \ func(v.w)); \
} }
#define VECTORIZE_VEC(func) \ #define VECTORIZE_VEC(func) \
VECTORIZE2_VEC(func) \ VECTORIZE2_VEC(func) \
@ -65,46 +65,46 @@
VECTORIZE4_VEC(func) VECTORIZE4_VEC(func)
#define VECTORIZE2_VEC_SCA(func) \ #define VECTORIZE2_VEC_SCA(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func \ GLM_FUNC_QUALIFIER detail::tvec2<T> func \
( \ ( \
detail::tvec2<T> const & x, \ detail::tvec2<T> const & x, \
typename detail::tvec2<T>::value_type const & y \ typename detail::tvec2<T>::value_type const & y \
) \ ) \
{ \ { \
return detail::tvec2<T>( \ return detail::tvec2<T>( \
func(x.x, y), \ func(x.x, y), \
func(x.y, y)); \ func(x.y, y)); \
} }
#define VECTORIZE3_VEC_SCA(func) \ #define VECTORIZE3_VEC_SCA(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func \ GLM_FUNC_QUALIFIER detail::tvec3<T> func \
( \ ( \
detail::tvec3<T> const & x, \ detail::tvec3<T> const & x, \
typename detail::tvec3<T>::value_type const & y \ typename detail::tvec3<T>::value_type const & y \
) \ ) \
{ \ { \
return detail::tvec3<T>( \ return detail::tvec3<T>( \
func(x.x, y), \ func(x.x, y), \
func(x.y, y), \ func(x.y, y), \
func(x.z, y)); \ func(x.z, y)); \
} }
#define VECTORIZE4_VEC_SCA(func) \ #define VECTORIZE4_VEC_SCA(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func \ GLM_FUNC_QUALIFIER detail::tvec4<T> func \
( \ ( \
detail::tvec4<T> const & x, \ detail::tvec4<T> const & x, \
typename detail::tvec4<T>::value_type const & y \ typename detail::tvec4<T>::value_type const & y \
) \ ) \
{ \ { \
return detail::tvec4<T>( \ return detail::tvec4<T>( \
func(x.x, y), \ func(x.x, y), \
func(x.y, y), \ func(x.y, y), \
func(x.z, y), \ func(x.z, y), \
func(x.w, y)); \ func(x.w, y)); \
} }
#define VECTORIZE_VEC_SCA(func) \ #define VECTORIZE_VEC_SCA(func) \
VECTORIZE2_VEC_SCA(func) \ VECTORIZE2_VEC_SCA(func) \
@ -112,46 +112,46 @@
VECTORIZE4_VEC_SCA(func) VECTORIZE4_VEC_SCA(func)
#define VECTORIZE2_VEC_VEC(func) \ #define VECTORIZE2_VEC_VEC(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func \ GLM_FUNC_QUALIFIER detail::tvec2<T> func \
( \ ( \
detail::tvec2<T> const & x, \ detail::tvec2<T> const & x, \
detail::tvec2<T> const & y \ detail::tvec2<T> const & y \
) \ ) \
{ \ { \
return detail::tvec2<T>( \ return detail::tvec2<T>( \
func(x.x, y.x), \ func(x.x, y.x), \
func(x.y, y.y)); \ func(x.y, y.y)); \
} }
#define VECTORIZE3_VEC_VEC(func) \ #define VECTORIZE3_VEC_VEC(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func \ GLM_FUNC_QUALIFIER detail::tvec3<T> func \
( \ ( \
detail::tvec3<T> const & x, \ detail::tvec3<T> const & x, \
detail::tvec3<T> const & y \ detail::tvec3<T> const & y \
) \ ) \
{ \ { \
return detail::tvec3<T>( \ return detail::tvec3<T>( \
func(x.x, y.x), \ func(x.x, y.x), \
func(x.y, y.y), \ func(x.y, y.y), \
func(x.z, y.z)); \ func(x.z, y.z)); \
} }
#define VECTORIZE4_VEC_VEC(func) \ #define VECTORIZE4_VEC_VEC(func) \
template <typename T> \ template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func \ GLM_FUNC_QUALIFIER detail::tvec4<T> func \
( \ ( \
detail::tvec4<T> const & x, \ detail::tvec4<T> const & x, \
detail::tvec4<T> const & y \ detail::tvec4<T> const & y \
) \ ) \
{ \ { \
return detail::tvec4<T>( \ return detail::tvec4<T>( \
func(x.x, y.x), \ func(x.x, y.x), \
func(x.y, y.y), \ func(x.y, y.y), \
func(x.z, y.z), \ func(x.z, y.z), \
func(x.w, y.w)); \ func(x.w, y.w)); \
} }
#define VECTORIZE_VEC_VEC(func) \ #define VECTORIZE_VEC_VEC(func) \
VECTORIZE2_VEC_VEC(func) \ VECTORIZE2_VEC_VEC(func) \

View File

@ -31,7 +31,6 @@
#define GLM_MESSAGES #define GLM_MESSAGES
#include "../glm.hpp" #include "../glm.hpp"
#include "../ext.hpp"
//#error "GLM is a header only library" //#error "GLM is a header only library"

View File

@ -46,27 +46,27 @@ namespace glm
/// Returns x if x >= 0; otherwise, it returns -x. /// Returns x if x >= 0; otherwise, it returns -x.
/// ///
/// @tparam genType floating-point or signed integer; scalar or vector types. /// @tparam genType floating-point or signed integer; scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs 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 genType> template <typename genType>
genType abs(genType const & x); genType abs(genType 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.
/// ///
/// @tparam genType Floating-point or signed integer; scalar or vector types. /// @tparam genType Floating-point or signed integer; scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType sign(genType const & x); genType sign(genType 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.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType floor(genType const & x); genType floor(genType const & x);
@ -74,9 +74,9 @@ namespace glm
/// whose absolute value is not larger than the absolute value of x. /// whose absolute value is not larger than the absolute value of x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType trunc(genType const & x); genType trunc(genType const & x);
@ -87,9 +87,9 @@ namespace glm
/// same value as roundEven(x) for all values of x. /// same value as roundEven(x) for all values of x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType round(genType const & x); genType round(genType const & x);
@ -98,40 +98,40 @@ namespace glm
/// integer. (Both 3.5 and 4.5 for x will return 4.0.) /// integer. (Both 3.5 and 4.5 for x will return 4.0.)
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType roundEven(genType const & x); genType roundEven(genType 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.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType ceil(genType const & x); genType ceil(genType const & x);
/// Return x - floor(x). /// Return x - floor(x).
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract 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 genType> template <typename genType>
genType fract(genType const & x); genType fract(genType 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.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType mod( genType mod(
genType const & x, genType const & x,
genType const & y); genType const & y);
@ -140,10 +140,10 @@ namespace glm
/// for each component in x using the floating point value y. /// for each component in x using the floating point value y.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType mod( genType mod(
genType const & x, genType const & x,
typename genType::value_type const & y); typename genType::value_type const & y);
@ -152,22 +152,22 @@ namespace glm
/// part (as a whole number floating point value). Both the /// part (as a whole number floating point value). Both the
/// return value and the output parameter will have the same /// return value and the output parameter will have the same
/// sign as x. /// sign as x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf 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 genType> template <typename genType>
genType modf( genType modf(
genType const & x, genType const & x,
genType & i); genType & i);
/// Returns y if y < x; otherwise, it returns x. /// Returns y if y < x; otherwise, it returns x.
/// ///
/// @tparam genType Floating-point or integer; scalar or vector types. /// @tparam genType Floating-point or integer; scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min 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 genType> template <typename genType>
genType min( genType min(
genType const & x, genType const & x,
@ -178,12 +178,12 @@ namespace glm
genType const & x, genType const & x,
typename genType::value_type const & y); typename genType::value_type const & y);
/// Returns y if x < y; otherwise, it returns x. /// Returns y if x < y; otherwise, it returns x.
/// ///
/// @tparam genType Floating-point or integer; scalar or vector types. /// @tparam genType Floating-point or integer; scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max 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 genType> template <typename genType>
genType max( genType max(
genType const & x, genType const & x,
@ -194,13 +194,13 @@ namespace glm
genType const & x, genType const & x,
typename genType::value_type const & y); typename genType::value_type 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.
/// ///
/// @tparam genType Floating-point or integer; scalar or vector types. /// @tparam genType Floating-point or integer; scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp 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 genType> template <typename genType>
genType clamp( genType clamp(
genType const & x, genType const & x,
@ -229,9 +229,9 @@ namespace glm
//! provides different functionality than //! provides different functionality than
//! genType mix(genType x, genType y, genType(a)) //! genType mix(genType x, genType y, genType(a))
//! where a is a Boolean vector. //! where a is a Boolean vector.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix 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>
/// ///
/// @param[in] x Value to interpolate. /// @param[in] x Value to interpolate.
/// @param[in] y Value to interpolate. /// @param[in] y Value to interpolate.
@ -259,9 +259,9 @@ namespace glm
genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a); genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a);
//! 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 <typename genType> template <typename genType>
genType step( genType step(
genType const & edge, genType const & edge,
@ -283,9 +283,9 @@ namespace glm
/// Results are undefined if edge0 >= edge1. /// Results are undefined if edge0 >= edge1.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep 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 genType> template <typename genType>
genType smoothstep( genType smoothstep(
genType const & edge0, genType const & edge0,
@ -305,11 +305,11 @@ namespace glm
/// representations. /// representations.
/// ///
/// /!\ When using compiler fast math, this function may fail. /// /!\ When using compiler fast math, this function may fail.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
typename genType::bool_type isnan(genType const & x); typename genType::bool_type isnan(genType const & x);
@ -318,10 +318,10 @@ namespace glm
/// set of floating point representations. Returns false /// set of floating point representations. Returns false
/// otherwise, including for implementations with no infinity /// otherwise, including for implementations with no infinity
/// representations. /// representations.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
typename genType::bool_type isinf(genType const & x); typename genType::bool_type isinf(genType const & x);
@ -332,9 +332,9 @@ namespace glm
/// ///
/// @tparam genType Single-precision floating-point scalar or vector types. /// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genIType Signed integer scalar or vector types. /// @tparam genIType Signed integer scalar or vector types.
/// ///
/// @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 <typename genType, typename genIType> template <typename genType, typename genIType>
genIType floatBitsToInt(genType const & value); genIType floatBitsToInt(genType const & value);
@ -344,9 +344,9 @@ namespace glm
/// ///
/// @tparam genType Single-precision floating-point scalar or vector types. /// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genUType Unsigned integer scalar or vector types. /// @tparam genUType Unsigned integer scalar or vector types.
/// ///
/// @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 <typename genType, typename genUType> template <typename genType, typename genUType>
genUType floatBitsToUint(genType const & value); genUType floatBitsToUint(genType const & value);
@ -355,39 +355,39 @@ namespace glm
/// If an inf or NaN is passed in, it will not signal, and the /// If an inf or NaN is passed in, it will not signal, and the
/// resulting floating point value is unspecified. Otherwise, /// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved. /// the bit-level representation is preserved.
/// ///
/// @tparam genType Single-precision floating-point scalar or vector types. /// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genIType Signed integer scalar or vector types. /// @tparam genIType Signed integer scalar or vector types.
/// ///
/// @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>
/// ///
/// @todo Clarify this declaration, we don't need to actually specify the return type /// @todo Clarify this declaration, we don't need to actually specify the return type
template <typename genType, typename genIType> template <typename genType, typename genIType>
genType intBitsToFloat(genIType const & value); genType intBitsToFloat(genIType const & value);
/// 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.
/// If an inf or NaN is passed in, it will not signal, and the /// If an inf or NaN is passed in, it will not signal, and the
/// resulting floating point value is unspecified. Otherwise, /// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved. /// the bit-level representation is preserved.
/// ///
/// @tparam genType Single-precision floating-point scalar or vector types. /// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genUType Unsigned integer scalar or vector types. /// @tparam genUType Unsigned integer scalar or vector types.
/// ///
/// @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>
/// ///
/// @todo Clarify this declaration, we don't need to actually specify the return type /// @todo Clarify this declaration, we don't need to actually specify the return type
template <typename genType, typename genUType> template <typename genType, typename genUType>
genType uintBitsToFloat(genUType const & value); genType uintBitsToFloat(genUType const & value);
/// Computes and returns a * b + c. /// Computes and returns a * b + c.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma 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 genType> template <typename genType>
genType fma(genType const & a, genType const & b, genType const & c); genType fma(genType const & a, genType const & b, genType const & c);
@ -404,7 +404,7 @@ namespace glm
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp 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 genType, typename genIType> template <typename genType, typename genIType>
genType frexp(genType const & x, genIType & exp); genType frexp(genType const & x, genIType & exp);
@ -418,7 +418,7 @@ namespace glm
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>; /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp 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 genType, typename genIType> template <typename genType, typename genIType>
genType ldexp(genType const & x, genIType const & exp); genType ldexp(genType const & x, genIType const & exp);

File diff suppressed because it is too large Load Diff

View File

@ -46,9 +46,9 @@ namespace glm
/// @param x pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. /// @param x pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
/// @param y /// @param y
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType pow(genType const & x, genType const & y); genType pow(genType const & x, genType const & y);
@ -56,9 +56,9 @@ namespace glm
/// ///
/// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. /// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType exp(genType const & x); genType exp(genType const & x);
@ -68,9 +68,9 @@ namespace glm
/// ///
/// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision. /// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType log(genType const & x); genType log(genType const & x);
@ -78,40 +78,40 @@ namespace glm
/// ///
/// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. /// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType exp2(genType const & x); genType exp2(genType const & x);
/// 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.
/// ///
/// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision. /// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType log2(genType const & x); genType log2(genType const & x);
/// Returns the positive square root of x. /// Returns the positive square root of x.
/// ///
/// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision. /// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt 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 genType> template <typename genType>
genType sqrt(genType const & x); genType sqrt(genType const & x);
/// Returns the reciprocal of the positive square root of x. /// Returns the reciprocal of the positive square root of x.
/// ///
/// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision. /// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType inversesqrt(genType const & x); genType inversesqrt(genType const & x);

View File

@ -28,60 +28,60 @@
namespace glm namespace glm
{ {
// pow // pow
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType pow GLM_FUNC_QUALIFIER genType pow
( (
genType const & x, genType const & x,
genType const & y genType const & y
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input");
return ::std::pow(x, y); return ::std::pow(x, y);
} }
VECTORIZE_VEC_VEC(pow) VECTORIZE_VEC_VEC(pow)
// exp // exp
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType exp GLM_FUNC_QUALIFIER genType exp
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input");
return ::std::exp(x); return ::std::exp(x);
} }
VECTORIZE_VEC(exp) VECTORIZE_VEC(exp)
// log // log
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType log GLM_FUNC_QUALIFIER genType log
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input");
return ::std::log(x); return ::std::log(x);
} }
VECTORIZE_VEC(log) VECTORIZE_VEC(log)
//exp2, ln2 = 0.69314718055994530941723212145818f //exp2, ln2 = 0.69314718055994530941723212145818f
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType exp2 GLM_FUNC_QUALIFIER genType exp2
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input");
return ::std::exp(genType(0.69314718055994530941723212145818) * x); return ::std::exp(genType(0.69314718055994530941723212145818) * x);
} }
VECTORIZE_VEC(exp2) VECTORIZE_VEC(exp2)
@ -112,43 +112,43 @@ namespace _detail
}//namespace _detail }//namespace _detail
// log2, ln2 = 0.69314718055994530941723212145818f // log2, ln2 = 0.69314718055994530941723212145818f
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType log2 GLM_FUNC_QUALIFIER genType log2
( (
genType const & x genType const & x
) )
{ {
assert(x > genType(0)); // log2 is only defined on the range (0, inf] assert(x > genType(0)); // log2 is only defined on the range (0, inf]
return _detail::_compute_log2<detail::float_or_int_trait<genType>::ID>()(x); return _detail::_compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
} }
VECTORIZE_VEC(log2) VECTORIZE_VEC(log2)
// sqrt // sqrt
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType sqrt GLM_FUNC_QUALIFIER genType sqrt
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input");
return genType(::std::sqrt(x)); return genType(::std::sqrt(x));
} }
VECTORIZE_VEC(sqrt) VECTORIZE_VEC(sqrt)
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType inversesqrt GLM_FUNC_QUALIFIER genType inversesqrt
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input");
return genType(1) / ::std::sqrt(x); return genType(1) / ::std::sqrt(x);
} }
VECTORIZE_VEC(inversesqrt) VECTORIZE_VEC(inversesqrt)

View File

@ -42,21 +42,21 @@ namespace glm
/// @{ /// @{
/// Returns the length of x, i.e., sqrt(x * x). /// Returns the length of x, i.e., sqrt(x * x).
/// ///
/// @tparam genType Floating-point vector types. /// @tparam genType Floating-point vector types.
/// ///
/// @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 genType> template <typename genType>
typename genType::value_type length( typename genType::value_type length(
genType const & x); genType 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).
/// ///
/// @tparam genType Floating-point vector types. /// @tparam genType Floating-point vector types.
/// ///
/// @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 genType> template <typename genType>
typename genType::value_type distance( typename genType::value_type distance(
genType const & p0, genType const & p0,
@ -65,10 +65,10 @@ namespace glm
/// 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.
/// ///
/// @tparam genType Floating-point vector types. /// @tparam genType Floating-point vector types.
/// ///
/// @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 genType> template <typename genType>
typename genType::value_type dot( typename genType::value_type dot(
genType const & x, genType const & x,
genType const & y); genType const & y);
@ -76,18 +76,18 @@ namespace glm
/// Returns the cross product of x and y. /// Returns the cross product of x and y.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross 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 valType> template <typename valType>
detail::tvec3<valType> cross( detail::tvec3<valType> cross(
detail::tvec3<valType> const & x, detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y); detail::tvec3<valType> const & y);
/// Returns a vector in the same direction as x but with length of 1. /// Returns a vector in the same direction as x but with length of 1.
/// ///
/// @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 genType> template <typename genType>
genType normalize( genType normalize(
genType const & x); genType const & x);
@ -95,10 +95,10 @@ namespace glm
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N. /// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
/// ///
/// @tparam genType Floating-point vector types. /// @tparam genType Floating-point vector types.
/// ///
/// @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 genType> template <typename genType>
genType faceforward( genType faceforward(
genType const & N, genType const & N,
genType const & I, genType const & I,
@ -108,10 +108,10 @@ namespace glm
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N. /// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
/// ///
/// @tparam genType Floating-point vector types. /// @tparam genType Floating-point vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect 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 genType> template <typename genType>
genType reflect( genType reflect(
genType const & I, genType const & I,
genType const & N); genType const & N);
@ -121,10 +121,10 @@ namespace glm
/// return the refraction vector. /// return the refraction vector.
/// ///
/// @tparam genType Floating-point vector types. /// @tparam genType Floating-point vector types.
/// ///
/// @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 genType> template <typename genType>
genType refract( genType refract(
genType const & I, genType const & I,
genType const & N, genType const & N,

View File

@ -28,67 +28,67 @@
namespace glm namespace glm
{ {
// length // length
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType length GLM_FUNC_QUALIFIER genType length
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'length' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'length' only accept floating-point inputs");
genType sqr = x * x; genType sqr = x * x;
return sqrt(sqr); return sqrt(sqr);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type length GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type length
( (
detail::tvec2<T> const & v detail::tvec2<T> const & v
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
typename detail::tvec2<T>::value_type sqr = v.x * v.x + v.y * v.y; typename detail::tvec2<T>::value_type sqr = v.x * v.x + v.y * v.y;
return sqrt(sqr); return sqrt(sqr);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec3<T>::value_type length GLM_FUNC_QUALIFIER typename detail::tvec3<T>::value_type length
( (
detail::tvec3<T> const & v detail::tvec3<T> const & v
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
typename detail::tvec3<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; typename detail::tvec3<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z;
return sqrt(sqr); return sqrt(sqr);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec4<T>::value_type length GLM_FUNC_QUALIFIER typename detail::tvec4<T>::value_type length
( (
detail::tvec4<T> const & v detail::tvec4<T> const & v
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
typename detail::tvec4<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; typename detail::tvec4<T>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
return sqrt(sqr); return sqrt(sqr);
} }
// distance // distance
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType distance GLM_FUNC_QUALIFIER genType distance
( (
genType const & p0, genType const & p0,
genType const & p1 genType const & p1
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'distance' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'distance' only accept floating-point inputs");
return length(p1 - p0); return length(p1 - p0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type distance GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type distance
@ -96,35 +96,35 @@ namespace glm
detail::tvec2<T> const & p0, detail::tvec2<T> const & p0,
detail::tvec2<T> const & p1 detail::tvec2<T> const & p1
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
return length(p1 - p0); return length(p1 - p0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec3<T>::value_type distance GLM_FUNC_QUALIFIER typename detail::tvec3<T>::value_type distance
( (
detail::tvec3<T> const & p0, detail::tvec3<T> const & p0,
detail::tvec3<T> const & p1 detail::tvec3<T> const & p1
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
return length(p1 - p0); return length(p1 - p0);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec4<T>::value_type distance GLM_FUNC_QUALIFIER typename detail::tvec4<T>::value_type distance
( (
detail::tvec4<T> const & p0, detail::tvec4<T> const & p0,
detail::tvec4<T> const & p1 detail::tvec4<T> const & p1
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
return length(p1 - p0); return length(p1 - p0);
} }
// dot // dot
template <typename genType> template <typename genType>
@ -140,124 +140,124 @@ namespace glm
return x * y; return x * y;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type dot GLM_FUNC_QUALIFIER typename detail::tvec2<T>::value_type dot
( (
detail::tvec2<T> const & x, detail::tvec2<T> const & x,
detail::tvec2<T> const & y detail::tvec2<T> const & y
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
return x.x * y.x + x.y * y.y; return x.x * y.x + x.y * y.y;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T dot GLM_FUNC_QUALIFIER T dot
( (
detail::tvec3<T> const & x, detail::tvec3<T> const & x,
detail::tvec3<T> const & y detail::tvec3<T> const & y
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
return x.x * y.x + x.y * y.y + x.z * y.z; return x.x * y.x + x.y * y.y + x.z * y.z;
} }
/* // SSE3 /* // SSE3
GLM_FUNC_QUALIFIER float dot(const tvec4<float>& x, const tvec4<float>& y) GLM_FUNC_QUALIFIER float dot(const tvec4<float>& x, const tvec4<float>& y)
{ {
float Result; float Result;
__asm __asm
{ {
mov esi, x mov esi, x
mov edi, y mov edi, y
movaps xmm0, [esi] movaps xmm0, [esi]
mulps xmm0, [edi] mulps xmm0, [edi]
haddps( _xmm0, _xmm0 ) haddps( _xmm0, _xmm0 )
haddps( _xmm0, _xmm0 ) haddps( _xmm0, _xmm0 )
movss Result, xmm0 movss Result, xmm0
} }
return Result; return Result;
} }
*/ */
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T dot GLM_FUNC_QUALIFIER T dot
( (
detail::tvec4<T> const & x, detail::tvec4<T> const & x,
detail::tvec4<T> const & y detail::tvec4<T> const & y
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w;
} }
// cross // cross
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> cross GLM_FUNC_QUALIFIER detail::tvec3<T> cross
( (
detail::tvec3<T> const & x, detail::tvec3<T> const & x,
detail::tvec3<T> const & y detail::tvec3<T> const & y
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'cross' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'cross' only accept floating-point inputs");
return detail::tvec3<T>( return detail::tvec3<T>(
x.y * y.z - y.y * x.z, x.y * y.z - y.y * x.z,
x.z * y.x - y.z * x.x, x.z * y.x - y.z * x.x,
x.x * y.y - y.x * x.y); x.x * y.y - y.x * x.y);
} }
// normalize // normalize
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType normalize GLM_FUNC_QUALIFIER genType normalize
( (
genType const & x genType const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'normalize' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'normalize' only accept floating-point inputs");
return x < genType(0) ? genType(-1) : genType(1); return x < genType(0) ? genType(-1) : genType(1);
} }
// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error // According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> normalize GLM_FUNC_QUALIFIER detail::tvec2<T> normalize
( (
detail::tvec2<T> const & x detail::tvec2<T> const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
typename detail::tvec2<T>::value_type sqr = x.x * x.x + x.y * x.y; typename detail::tvec2<T>::value_type sqr = x.x * x.x + x.y * x.y;
return x * inversesqrt(sqr); return x * inversesqrt(sqr);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> normalize GLM_FUNC_QUALIFIER detail::tvec3<T> normalize
( (
detail::tvec3<T> const & x detail::tvec3<T> const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
typename detail::tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; typename detail::tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
return x * inversesqrt(sqr); return x * inversesqrt(sqr);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> normalize GLM_FUNC_QUALIFIER detail::tvec4<T> normalize
( (
detail::tvec4<T> const & x detail::tvec4<T> const & x
) )
{ {
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs"); GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
typename detail::tvec4<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; typename detail::tvec4<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
return x * inversesqrt(sqr); return x * inversesqrt(sqr);
} }
// faceforward // faceforward
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType faceforward GLM_FUNC_QUALIFIER genType faceforward
( (
@ -280,43 +280,43 @@ namespace glm
return I - N * dot(N, I) * genType(2); return I - N * dot(N, I) * genType(2);
} }
// refract // refract
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType refract GLM_FUNC_QUALIFIER genType refract
( (
genType const & I, genType const & I,
genType const & N, genType const & N,
genType const & eta genType const & eta
) )
{ {
//It could be a vector //It could be a vector
//GLM_STATIC_ASSERT(detail::type<genType>::is_float); //GLM_STATIC_ASSERT(detail::type<genType>::is_float);
genType dotValue = dot(N, I); genType dotValue = dot(N, I);
genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue); genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue);
if(k < genType(0)) if(k < genType(0))
return genType(0); return genType(0);
else else
return eta * I - (eta * dotValue + sqrt(k)) * N; return eta * I - (eta * dotValue + sqrt(k)) * N;
} }
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType refract GLM_FUNC_QUALIFIER genType refract
( (
genType const & I, genType const & I,
genType const & N, genType const & N,
typename genType::value_type const & eta typename genType::value_type const & eta
) )
{ {
//It could be a vector //It could be a vector
//GLM_STATIC_ASSERT(detail::type<genType>::is_float); //GLM_STATIC_ASSERT(detail::type<genType>::is_float);
typename genType::value_type dotValue = dot(N, I); typename genType::value_type dotValue = dot(N, I);
typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue); typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue);
if(k < typename genType::value_type(0)) if(k < typename genType::value_type(0))
return genType(0); return genType(0);
else else
return eta * I - (eta * dotValue + sqrt(k)) * N; return eta * I - (eta * dotValue + sqrt(k)) * N;
} }
}//namespace glm }//namespace glm

View File

@ -49,8 +49,8 @@ namespace glm
/// ///
/// @tparam genUType Unsigned integer scalar or vector types. /// @tparam genUType Unsigned integer scalar or vector types.
/// ///
/// @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 <typename genUType> template <typename genUType>
genUType uaddCarry( genUType uaddCarry(
genUType const & x, genUType const & x,
@ -63,8 +63,8 @@ namespace glm
/// ///
/// @tparam genUType Unsigned integer scalar or vector types. /// @tparam genUType Unsigned integer scalar or vector types.
/// ///
/// @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 <typename genUType> template <typename genUType>
genUType usubBorrow( genUType usubBorrow(
genUType const & x, genUType const & x,
@ -77,8 +77,8 @@ namespace glm
/// ///
/// @tparam genUType Unsigned integer scalar or vector types. /// @tparam genUType Unsigned integer scalar or vector types.
/// ///
/// @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 <typename genUType> template <typename genUType>
void umulExtended( void umulExtended(
genUType const & x, genUType const & x,
@ -92,8 +92,8 @@ namespace glm
/// ///
/// @tparam genIType Signed integer scalar or vector types. /// @tparam genIType Signed integer scalar or vector types.
/// ///
/// @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 <typename genIType> template <typename genIType>
void imulExtended( void imulExtended(
genIType const & x, genIType const & x,
@ -114,8 +114,8 @@ namespace glm
/// ///
/// @tparam genIUType Signed or unsigned integer scalar or vector types. /// @tparam genIUType Signed or unsigned integer scalar or vector types.
/// ///
/// @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 genIUType> template <typename genIUType>
genIUType bitfieldExtract( genIUType bitfieldExtract(
genIUType const & Value, genIUType const & Value,
@ -134,7 +134,7 @@ namespace glm
/// ///
/// @tparam genIUType Signed or unsigned integer scalar or vector types. /// @tparam genIUType Signed or unsigned integer scalar or vector types.
/// ///
/// @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 genIUType> template <typename genIUType>
genIUType bitfieldInsert( genIUType bitfieldInsert(
@ -149,8 +149,8 @@ namespace glm
/// ///
/// @tparam genIUType Signed or unsigned integer scalar or vector types. /// @tparam genIUType Signed or unsigned integer scalar or vector types.
/// ///
/// @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 genIUType> template <typename genIUType>
genIUType bitfieldReverse(genIUType const & Value); genIUType bitfieldReverse(genIUType const & Value);
@ -158,8 +158,8 @@ namespace glm
/// ///
/// @tparam genIUType Signed or unsigned integer scalar or vector types. /// @tparam genIUType Signed or unsigned integer scalar or vector types.
/// ///
/// @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>
/// ///
/// @todo Clarify the declaration to specify that scalars are suported. /// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType> template <typename T, template <typename> class genIUType>
@ -171,8 +171,8 @@ namespace glm
/// ///
/// @tparam genIUType Signed or unsigned integer scalar or vector types. /// @tparam genIUType Signed or unsigned integer scalar or vector types.
/// ///
/// @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>
/// ///
/// @todo Clarify the declaration to specify that scalars are suported. /// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType> template <typename T, template <typename> class genIUType>
@ -185,8 +185,8 @@ namespace glm
/// ///
/// @tparam genIUType Signed or unsigned integer scalar or vector types. /// @tparam genIUType Signed or unsigned integer scalar or vector types.
/// ///
/// @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>
/// ///
/// @todo Clarify the declaration to specify that scalars are suported. /// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType> template <typename T, template <typename> class genIUType>

View File

@ -49,9 +49,9 @@ namespace glm
/// result[i][j] is the scalar product of x[i][j] and y[i][j]. /// result[i][j] is the scalar product of x[i][j] and y[i][j].
/// ///
/// @tparam matType Floating-point matrix types. /// @tparam matType Floating-point matrix types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult 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 matType> template <typename matType>
matType matrixCompMult( matType matrixCompMult(
matType const & x, matType const & x,
@ -62,12 +62,12 @@ namespace glm
/// and does a linear algebraic matrix multiply c * r. /// and does a linear algebraic matrix multiply c * r.
/// ///
/// @tparam matType Floating-point matrix types. /// @tparam matType Floating-point matrix types.
/// ///
/// @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>
/// ///
/// @todo Clarify the declaration to specify that matType doesn't have to be provided when used. /// @todo Clarify the declaration to specify that matType doesn't have to be provided when used.
template <typename vecType, typename matType> template <typename vecType, typename matType>
matType outerProduct( matType outerProduct(
vecType const & c, vecType const & c,
vecType const & r); vecType const & r);
@ -75,19 +75,19 @@ namespace glm
/// Returns the transposed matrix of x /// Returns the transposed matrix of x
/// ///
/// @tparam matType Floating-point matrix types. /// @tparam matType Floating-point matrix types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose 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 matType> template <typename matType>
typename matType::transpose_type transpose( typename matType::transpose_type transpose(
matType const & x); matType const & x);
/// Return the determinant of a mat2 matrix. /// Return the determinant of a mat2 matrix.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant 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 valType> template <typename valType>
typename detail::tmat2x2<valType>::value_type determinant( typename detail::tmat2x2<valType>::value_type determinant(
detail::tmat2x2<valType> const & m); detail::tmat2x2<valType> const & m);
@ -95,9 +95,9 @@ namespace glm
/// Return the determinant of a mat3 matrix. /// Return the determinant of a mat3 matrix.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant 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 valType> template <typename valType>
typename detail::tmat3x3<valType>::value_type determinant( typename detail::tmat3x3<valType>::value_type determinant(
detail::tmat3x3<valType> const & m); detail::tmat3x3<valType> const & m);
@ -105,19 +105,19 @@ namespace glm
/// Return the determinant of a mat4 matrix. /// Return the determinant of a mat4 matrix.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant 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 valType> template <typename valType>
typename detail::tmat4x4<valType>::value_type determinant( typename detail::tmat4x4<valType>::value_type determinant(
detail::tmat4x4<valType> const & m); detail::tmat4x4<valType> const & m);
/// Return the inverse of a mat2 matrix. /// Return the inverse of a mat2 matrix.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse 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 valType> template <typename valType>
detail::tmat2x2<valType> inverse( detail::tmat2x2<valType> inverse(
detail::tmat2x2<valType> const & m); detail::tmat2x2<valType> const & m);
@ -125,9 +125,9 @@ namespace glm
/// Return the inverse of a mat3 matrix. /// Return the inverse of a mat3 matrix.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse 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 valType> template <typename valType>
detail::tmat3x3<valType> inverse( detail::tmat3x3<valType> inverse(
detail::tmat3x3<valType> const & m); detail::tmat3x3<valType> const & m);
@ -135,9 +135,9 @@ namespace glm
/// Return the inverse of a mat4 matrix. /// Return the inverse of a mat4 matrix.
/// ///
/// @tparam valType Floating-point scalar types. /// @tparam valType Floating-point scalar types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse 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 valType> template <typename valType>
detail::tmat4x4<valType> inverse( detail::tmat4x4<valType> inverse(
detail::tmat4x4<valType> const & m); detail::tmat4x4<valType> const & m);

View File

@ -46,8 +46,8 @@ namespace glm
/// Returns a 1D noise value based on the input value x. /// Returns a 1D noise value based on the input value x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType> template <typename genType>
typename genType::value_type noise1(genType const & x); typename genType::value_type noise1(genType const & x);
@ -55,27 +55,27 @@ namespace glm
/// Returns a 2D noise value based on the input value x. /// Returns a 2D noise value based on the input value x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType> template <typename genType>
detail::tvec2<typename genType::value_type> noise2(genType const & x); detail::tvec2<typename genType::value_type> noise2(genType const & x);
/// Returns a 3D noise value based on the input value x. /// Returns a 3D noise value based on the input value x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType> template <typename genType>
detail::tvec3<typename genType::value_type> noise3(genType const & x); detail::tvec3<typename genType::value_type> noise3(genType const & x);
/// Returns a 4D noise value based on the input value x. /// Returns a 4D noise value based on the input value x.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType> template <typename genType>
detail::tvec4<typename genType::value_type> noise4(genType const & x); detail::tvec4<typename genType::value_type> noise4(genType const & x);

View File

@ -41,138 +41,137 @@ namespace glm
/// @addtogroup core_func_packing /// @addtogroup core_func_packing
/// @{ /// @{
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer. //! Then, the results are packed into the returned 32-bit unsigned integer.
//! //!
//! The conversion for component c of v to fixed point is done as follows: //! The conversion for component c of v to fixed point is done as follows:
//! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) //! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)
//! //!
//! The first component of the vector will be written to the least significant bits of the output; //! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits. //! the last component will be written to the most significant bits.
//! //!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</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> /// @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>
detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v); detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v);
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer. //! Then, the results are packed into the returned 32-bit unsigned integer.
//! //!
//! The conversion for component c of v to fixed point is done as follows: //! The conversion for component c of v to fixed point is done as follows:
//! packSnorm2x16: round(clamp(v, -1, +1) * 32767.0) //! packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)
//! //!
//! The first component of the vector will be written to the least significant bits of the output; //! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits. //! the last component will be written to the most significant bits.
//! //!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</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> /// @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>
detail::uint32 packSnorm2x16(detail::tvec2<detail::float32> const & v); detail::uint32 packSnorm2x16(detail::tvec2<detail::float32> const & v);
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer. //! Then, the results are packed into the returned 32-bit unsigned integer.
//! //!
//! The conversion for component c of v to fixed point is done as follows: //! The conversion for component c of v to fixed point is done as follows:
//! packUnorm4x8: round(clamp(c, 0, +1) * 255.0) //! packUnorm4x8: round(clamp(c, 0, +1) * 255.0)
//! //!
//! The first component of the vector will be written to the least significant bits of the output; //! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits. //! the last component will be written to the most significant bits.
//! //!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</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> /// @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>
detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v); detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v);
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer. //! Then, the results are packed into the returned 32-bit unsigned integer.
//! //!
//! The conversion for component c of v to fixed point is done as follows: //! The conversion for component c of v to fixed point is done as follows:
//! packSnorm4x8: round(clamp(c, -1, +1) * 127.0) //! packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
//! //!
//! The first component of the vector will be written to the least significant bits of the output; //! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits. //! the last component will be written to the most significant bits.
//! //!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</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> /// @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>
detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> const & v); detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> const & v);
//! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
//! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
//! //!
//! The conversion for unpacked fixed-point value f to floating point is done as follows: //! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! unpackUnorm2x16: f / 65535.0 //! unpackUnorm2x16: f / 65535.0
//! //!
//! The first component of the returned vector will be extracted from the least significant bits of the input; //! The first component of the returned vector will be extracted from the least significant bits of the input;
//! the last component will be extracted from the most significant bits. //! the last component will be extracted from the most significant bits.
//! //!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</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> /// @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>
detail::tvec2<detail::float32> unpackUnorm2x16(detail::uint32 const & p); detail::tvec2<detail::float32> unpackUnorm2x16(detail::uint32 const & p);
//! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
//! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
//! //!
//! The conversion for unpacked fixed-point value f to floating point is done as follows: //! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! unpackSnorm2x16: clamp(f / 32767.0, -1, +1) //! unpackSnorm2x16: clamp(f / 32767.0, -1, +1)
//! //!
//! The first component of the returned vector will be extracted from the least significant bits of the input; //! The first component of the returned vector will be extracted from the least significant bits of the input;
//! the last component will be extracted from the most significant bits. //! the last component will be extracted from the most significant bits.
//! //!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</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> /// @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>
detail::tvec2<detail::float32> unpackSnorm2x16(detail::uint32 const & p); detail::tvec2<detail::float32> unpackSnorm2x16(detail::uint32 const & p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
/// ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows: /// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackUnorm4x8: f / 255.0 /// unpackUnorm4x8: f / 255.0
/// ///
/// The first component of the returned vector will be extracted from the least significant bits of the input; /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits. /// the last component will be extracted from the most significant bits.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</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> /// @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>
detail::tvec4<detail::float32> unpackUnorm4x8(detail::uint32 const & p); detail::tvec4<detail::float32> unpackUnorm4x8(detail::uint32 const & p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
/// ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows: /// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm4x8: clamp(f / 127.0, -1, +1) /// unpackSnorm4x8: clamp(f / 127.0, -1, +1)
/// ///
/// The first component of the returned vector will be extracted from the least significant bits of the input; /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits. /// the last component will be extracted from the most significant bits.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</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> /// @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>
detail::tvec4<detail::float32> unpackSnorm4x8(detail::uint32 const & p); detail::tvec4<detail::float32> unpackSnorm4x8(detail::uint32 const & p);
/// Returns a double-precision value obtained by packing the components of v into a 64-bit value. /// Returns a double-precision value obtained by packing the components of v into a 64-bit value.
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. /// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
/// Otherwise, the bit- level representation of v is preserved. /// Otherwise, the bit- level representation of v is preserved.
/// The first vector component specifies the 32 least significant bits; /// The first vector component specifies the 32 least significant bits;
/// the second component specifies the 32 most significant bits. /// the second component specifies the 32 most significant bits.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</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> /// @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>
double packDouble2x32(detail::tvec2<detail::uint32> const & v); double packDouble2x32(detail::tvec2<detail::uint32> const & v);
/// Returns a two-component unsigned integer vector representation of v. /// Returns a two-component unsigned integer vector representation of v.
/// The bit-level representation of v is preserved. /// The bit-level representation of v is preserved.
/// The first component of the vector contains the 32 least significant bits of the double; /// The first component of the vector contains the 32 least significant bits of the double;
/// the second component consists the 32 most significant bits. /// the second component consists the 32 most significant bits.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</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> /// @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>
detail::tvec2<detail::uint32> unpackDouble2x32(double const & v); detail::tvec2<detail::uint32> unpackDouble2x32(double const & v);
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector /// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
/// to the 16-bit floating-point representation found in the OpenGL Specification, /// to the 16-bit floating-point representation found in the OpenGL Specification,
/// and then packing these two 16- bit integers into a 32-bit unsigned integer. /// and then packing these two 16- bit integers into a 32-bit unsigned integer.
/// The first vector component specifies the 16 least-significant bits of the result; /// The first vector component specifies the 16 least-significant bits of the result;
/// the second component specifies the 16 most-significant bits. /// the second component specifies the 16 most-significant bits.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</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> /// @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>
uint packHalf2x16(vec2 const & v); uint packHalf2x16(vec2 const & v);
/// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values, /// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values,
@ -180,9 +179,9 @@ namespace glm
/// and converting them to 32-bit floating-point values. /// 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 second component is obtained from the 16 most-significant bits of v. /// the second component is obtained from the 16 most-significant bits of v.
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</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> /// @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>
vec2 unpackHalf2x16(uint const & v); vec2 unpackHalf2x16(uint const & v);
/// @} /// @}

View File

@ -146,31 +146,31 @@ namespace glm
GLM_FUNC_QUALIFIER uint packHalf2x16(detail::tvec2<float> const & v) GLM_FUNC_QUALIFIER uint packHalf2x16(detail::tvec2<float> const & v)
{ {
union helper union helper
{ {
uint other; uint other;
struct struct
{ {
detail::hdata a, b; detail::hdata a, b;
} orig; } orig;
} Pack; } Pack;
Pack.orig.a = detail::toFloat16(v.x); Pack.orig.a = detail::toFloat16(v.x);
Pack.orig.b = detail::toFloat16(v.y); Pack.orig.b = detail::toFloat16(v.y);
return *(uint*)&Pack; return *(uint*)&Pack;
} }
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
{ {
union helper union helper
{ {
uint other; uint other;
struct struct
{ {
detail::hdata a, b; detail::hdata a, b;
} orig; } orig;
} Unpack; } Unpack;
Unpack.other = v; Unpack.other = v;
return vec2(detail::toFloat32(Unpack.orig.a), detail::toFloat32(Unpack.orig.b)); return vec2(detail::toFloat32(Unpack.orig.a), detail::toFloat32(Unpack.orig.b));
} }

View File

@ -48,18 +48,18 @@ namespace glm
/// Converts degrees to radians and returns the result. /// Converts degrees to radians and returns the result.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType radians(genType const & degrees); genType radians(genType const & degrees);
/// Converts radians to degrees and returns the result. /// Converts radians to degrees and returns the result.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType degrees(genType const & radians); genType degrees(genType const & radians);
@ -67,9 +67,9 @@ namespace glm
/// The values returned by this function will range from [-1, 1]. /// The values returned by this function will range from [-1, 1].
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType sin(genType const & angle); genType sin(genType const & angle);
@ -77,40 +77,40 @@ namespace glm
/// The values returned by this function will range from [-1, 1]. /// The values returned by this function will range from [-1, 1].
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType cos(genType const & angle); genType cos(genType const & angle);
/// The standard trigonometric tangent function. /// The standard trigonometric tangent function.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType tan(genType const & angle); genType tan(genType 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].
/// Results are undefined if |x| > 1. /// Results are undefined if |x| > 1.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType asin(genType const & x); genType asin(genType 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].
/// Results are undefined if |x| > 1. /// Results are undefined if |x| > 1.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType acos(genType const & x); genType acos(genType const & x);
@ -119,67 +119,67 @@ namespace glm
/// quadrant the angle is in. The range of values returned /// quadrant the angle is in. The range of values returned
/// by this function is [-PI, PI]. Results are undefined /// by this function is [-PI, PI]. Results are undefined
/// if x and y are both 0. /// if x and y are both 0.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType atan(genType const & y, genType const & x); genType atan(genType const & y, genType 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].
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType atan(genType const & y_over_x); genType atan(genType const & y_over_x);
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType sinh(genType const & angle); genType sinh(genType const & angle);
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType cosh(genType const & angle); genType cosh(genType const & angle);
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType tanh(genType const & angle); genType tanh(genType const & angle);
/// Arc hyperbolic sine; returns the inverse of sinh. /// Arc hyperbolic sine; returns the inverse of sinh.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType asinh(genType const & x); genType asinh(genType 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.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType acosh(genType const & x); genType acosh(genType const & x);
@ -187,9 +187,9 @@ namespace glm
/// Results are undefined if abs(x) >= 1. /// Results are undefined if abs(x) >= 1.
/// ///
/// @tparam genType Floating-point scalar or vector types. /// @tparam genType Floating-point scalar or vector types.
/// ///
/// @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 genType> template <typename genType>
genType atanh(genType const & x); genType atanh(genType const & x);

View File

@ -51,82 +51,82 @@ namespace glm
/// Returns the component-wise comparison result of x < y. /// Returns the component-wise comparison result of x < y.
/// ///
/// @tparam vecType Floating-point or integer vector types. /// @tparam vecType Floating-point or integer vector types.
/// ///
/// @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 vecType> template <typename vecType>
typename vecType::bool_type lessThan(vecType const & x, vecType const & y); typename vecType::bool_type lessThan(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x <= y. /// Returns the component-wise comparison of result x <= y.
/// ///
/// @tparam vecType Floating-point or integer vector types. /// @tparam vecType Floating-point or integer vector types.
/// ///
/// @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 vecType> template <typename vecType>
typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y); typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x > y. /// Returns the component-wise comparison of result x > y.
/// ///
/// @tparam vecType Floating-point or integer vector types. /// @tparam vecType Floating-point or integer vector types.
/// ///
/// @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 vecType> template <typename vecType>
typename vecType::bool_type greaterThan(vecType const & x, vecType const & y); typename vecType::bool_type greaterThan(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x >= y. /// Returns the component-wise comparison of result x >= y.
/// ///
/// @tparam vecType Floating-point or integer vector types. /// @tparam vecType Floating-point or integer vector types.
/// ///
/// @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 vecType> template <typename vecType>
typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y); typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x == y. /// Returns the component-wise comparison of result x == y.
/// ///
/// @tparam vecType Floating-point, integer or boolean vector types. /// @tparam vecType Floating-point, integer or boolean vector types.
/// ///
/// @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 vecType> template <typename vecType>
typename vecType::bool_type equal(vecType const & x, vecType const & y); typename vecType::bool_type equal(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x != y. /// Returns the component-wise comparison of result x != y.
/// ///
/// @tparam vecType Floating-point, integer or boolean vector types. /// @tparam vecType Floating-point, integer or boolean vector types.
/// ///
/// @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 vecType> template <typename vecType>
typename vecType::bool_type notEqual(vecType const & x, vecType const & y); typename vecType::bool_type notEqual(vecType const & x, vecType const & y);
/// Returns true if any component of x is true. /// Returns true if any component of x is true.
/// ///
/// @tparam vecType Boolean vector types. /// @tparam vecType Boolean vector types.
/// ///
/// @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 <template <typename> class vecType> template <template <typename> class vecType>
bool any(vecType<bool> const & v); bool any(vecType<bool> const & v);
/// Returns true if all components of x are true. /// Returns true if all components of x are true.
/// ///
/// @tparam vecType Boolean vector types. /// @tparam vecType Boolean vector types.
/// ///
/// @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 <template <typename> class vecType> template <template <typename> class vecType>
bool all(vecType<bool> const & v); bool all(vecType<bool> 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.
/// ///
/// @tparam vecType Boolean vector types. /// @tparam vecType Boolean vector types.
/// ///
/// @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 <template <typename> class vecType> template <template <typename> class vecType>
vecType<bool> not_(vecType<bool> const & v); vecType<bool> not_(vecType<bool> const & v);

View File

@ -28,7 +28,7 @@
namespace glm namespace glm
{ {
template <typename T, template <typename> class vecType> template <typename T, template <typename> class vecType>
GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThan GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThan
( (
vecType<T> const & x, vecType<T> const & x,

View File

@ -466,8 +466,8 @@
# pragma message("GLM: C++ with GNU language extensions") # pragma message("GLM: C++ with GNU language extensions")
# elif(GLM_LANG == GLM_LANG_CXXMS) # elif(GLM_LANG == GLM_LANG_CXXMS)
# pragma message("GLM: C++ with VC language extensions") # pragma message("GLM: C++ with VC language extensions")
# else # else
# pragma message("GLM: C++ language undetected") # pragma message("GLM: C++ language undetected")
# endif//GLM_MODEL # endif//GLM_MODEL
#endif//GLM_MESSAGE #endif//GLM_MESSAGE

View File

@ -35,36 +35,36 @@
namespace glm namespace glm
{ {
#ifdef GLM_USE_HALF_SCALAR #ifdef GLM_USE_HALF_SCALAR
typedef detail::half lowp_float_t; typedef detail::half lowp_float_t;
#else//GLM_USE_HALF_SCALAR #else//GLM_USE_HALF_SCALAR
typedef float lowp_float_t; typedef float lowp_float_t;
#endif//GLM_USE_HALF_SCALAR #endif//GLM_USE_HALF_SCALAR
typedef float mediump_float_t; typedef float mediump_float_t;
typedef double highp_float_t; typedef double highp_float_t;
/// @addtogroup core_precision /// @addtogroup core_precision
/// @{ /// @{
/// Low precision floating-point numbers. /// Low precision floating-point numbers.
/// There is no guarantee on the actual precision. /// There is no guarantee on the actual precision.
/// ///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.4 Floats</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.4 Floats</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef lowp_float_t lowp_float; typedef lowp_float_t lowp_float;
/// Medium precision floating-point numbers. /// Medium precision floating-point numbers.
/// There is no guarantee on the actual precision. /// There is no guarantee on the actual precision.
/// ///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.4 Floats</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.4 Floats</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mediump_float_t mediump_float; typedef mediump_float_t mediump_float;
/// High precision floating-point numbers. /// High precision floating-point numbers.
/// There is no guarantee on the actual precision. /// There is no guarantee on the actual precision.
/// ///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.4 Floats</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.4 Floats</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef highp_float_t highp_float; typedef highp_float_t highp_float;
#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef mediump_float float_t; typedef mediump_float float_t;

View File

@ -131,7 +131,6 @@ namespace detail
typedef uint_t uint; typedef uint_t uint;
/// @} /// @}
}//namespace glm }//namespace glm
#endif//glm_core_type_int #endif//glm_core_type_int

View File

@ -48,12 +48,12 @@ namespace detail
template <typename T> struct tmat4x3; template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4; template <typename T> struct tmat4x4;
// @brief Template for 2 * 2 matrix of floating-point numbers. /// @brief Template for 2 * 2 matrix of floating-point numbers.
// @ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tmat2x2 struct tmat2x2
{ {
// Implementation detail // Implementation detail
enum ctor{null}; enum ctor{null};
typedef T value_type; typedef T value_type;
typedef std::size_t size_type; typedef std::size_t size_type;

View File

@ -29,11 +29,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T>::size_type tmat2x2<T>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T>::size_type tmat2x2<T>::length() const
{ {
return 2; return 2;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x2<T>::size_type tmat2x2<T>::col_size() GLM_FUNC_QUALIFIER typename tmat2x2<T>::size_type tmat2x2<T>::col_size()
@ -72,65 +72,65 @@ namespace detail
return this->value[i]; return this->value[i];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructors // Constructors
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2() GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2()
{ {
this->value[0] = col_type(1, 0); this->value[0] = col_type(1, 0);
this->value[1] = col_type(0, 1); this->value[1] = col_type(0, 1);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = m.value[0]; this->value[0] = m.value[0];
this->value[1] = m.value[1]; this->value[1] = m.value[1];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
ctor ctor
) )
{} {}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
value_type const & s value_type const & s
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = col_type(s, Zero); this->value[0] = col_type(s, Zero);
this->value[1] = col_type(Zero, s); this->value[1] = col_type(Zero, s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
value_type const & x0, value_type const & y0, value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1 value_type const & x1, value_type const & y1
) )
{ {
this->value[0] = col_type(x0, y0); this->value[0] = col_type(x0, y0);
this->value[1] = col_type(x1, y1); this->value[1] = col_type(x1, y1);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
col_type const & v0, col_type const & v0,
col_type const & v1 col_type const & v1
) )
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors
@ -142,8 +142,8 @@ namespace detail
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = tvec2<T>(value_type(s), Zero); this->value[0] = tvec2<T>(value_type(s), Zero);
this->value[1] = tvec2<T>(Zero, value_type(s)); this->value[1] = tvec2<T>(Zero, value_type(s));
} }
template <typename T> template <typename T>
@ -154,8 +154,8 @@ namespace detail
X2 const & x2, Y2 const & y2 X2 const & x2, Y2 const & y2
) )
{ {
this->value[0] = col_type(value_type(x1), value_type(y1)); this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2)); this->value[1] = col_type(value_type(x2), value_type(y2));
} }
template <typename T> template <typename T>
@ -166,381 +166,381 @@ namespace detail
tvec2<V2> const & v2 tvec2<V2> const & v2
) )
{ {
this->value[0] = col_type(v1); this->value[0] = col_type(v1);
this->value[1] = col_type(v2); this->value[1] = col_type(v2);
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// mat2x2 matrix conversions // mat2x2 matrix conversions
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat2x2<U> const & m tmat2x2<U> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat3x3<T> const & m tmat3x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat4x4<T> const & m tmat4x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T>::tmat2x2
( (
tmat4x3<T> const & m tmat4x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> tmat2x2<T>::_inverse() const GLM_FUNC_QUALIFIER tmat2x2<T> tmat2x2<T>::_inverse() const
{ {
typename tmat2x2<T>::value_type Determinant = this->value[0][0] * this->value[1][1] - this->value[1][0] * this->value[0][1]; typename tmat2x2<T>::value_type Determinant = this->value[0][0] * this->value[1][1] - this->value[1][0] * this->value[0][1];
tmat2x2<T> Inverse( tmat2x2<T> Inverse(
+ this->value[1][1] / Determinant, + this->value[1][1] / Determinant,
- this->value[1][0] / Determinant, - this->value[1][0] / Determinant,
- this->value[0][1] / Determinant, - this->value[0][1] / Determinant,
+ this->value[0][0] / Determinant); + this->value[0][0] / Determinant);
return Inverse; return Inverse;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// mat2x2 operators // mat2x2 operators
// This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared // This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator=
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator=
( (
tmat2x2<U> const & m tmat2x2<U> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator+= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator+=
( (
U const & s U const & s
) )
{ {
this->value[0] += s; this->value[0] += s;
this->value[1] += s; this->value[1] += s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator+= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator+=
( (
tmat2x2<U> const & m tmat2x2<U> const & m
) )
{ {
this->value[0] += m[0]; this->value[0] += m[0];
this->value[1] += m[1]; this->value[1] += m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-=
( (
U const & s U const & s
) )
{ {
this->value[0] -= s; this->value[0] -= s;
this->value[1] -= s; this->value[1] -= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-=
( (
tmat2x2<U> const & m tmat2x2<U> const & m
) )
{ {
this->value[0] -= m[0]; this->value[0] -= m[0];
this->value[1] -= m[1]; this->value[1] -= m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator*= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator*=
( (
U const & s U const & s
) )
{ {
this->value[0] *= s; this->value[0] *= s;
this->value[1] *= s; this->value[1] *= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator*= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator*=
( (
tmat2x2<U> const & m tmat2x2<U> const & m
) )
{ {
return (*this = *this * m); return (*this = *this * m);
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator/= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator/=
( (
U const & s U const & s
) )
{ {
this->value[0] /= s; this->value[0] /= s;
this->value[1] /= s; this->value[1] /= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator/= GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator/=
( (
tmat2x2<U> const & m tmat2x2<U> const & m
) )
{ {
return (*this = *this / m); return (*this = *this / m);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator++ () GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator++ ()
{ {
++this->value[0]; ++this->value[0];
++this->value[1]; ++this->value[1];
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-- () GLM_FUNC_QUALIFIER tmat2x2<T>& tmat2x2<T>::operator-- ()
{ {
--this->value[0]; --this->value[0];
--this->value[1]; --this->value[1];
return *this; return *this;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Binary operators // Binary operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator+ GLM_FUNC_QUALIFIER tmat2x2<T> operator+
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
typename tmat2x2<T>::value_type const & s typename tmat2x2<T>::value_type const & s
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] + s, m[0] + s,
m[1] + s); m[1] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator+ GLM_FUNC_QUALIFIER tmat2x2<T> operator+
( (
typename tmat2x2<T>::value_type const & s, typename tmat2x2<T>::value_type const & s,
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] + s, m[0] + s,
m[1] + s); m[1] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator+ GLM_FUNC_QUALIFIER tmat2x2<T> operator+
( (
tmat2x2<T> const & m1, tmat2x2<T> const & m1,
tmat2x2<T> const & m2 tmat2x2<T> const & m2
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m1[0] + m2[0], m1[0] + m2[0],
m1[1] + m2[1]); m1[1] + m2[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator- GLM_FUNC_QUALIFIER tmat2x2<T> operator-
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
typename tmat2x2<T>::value_type const & s typename tmat2x2<T>::value_type const & s
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] - s, m[0] - s,
m[1] - s); m[1] - s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator- GLM_FUNC_QUALIFIER tmat2x2<T> operator-
( (
typename tmat2x2<T>::value_type const & s, typename tmat2x2<T>::value_type const & s,
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
s - m[0], s - m[0],
s - m[1]); s - m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator- GLM_FUNC_QUALIFIER tmat2x2<T> operator-
( (
tmat2x2<T> const & m1, tmat2x2<T> const & m1,
tmat2x2<T> const & m2 tmat2x2<T> const & m2
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m1[0] - m2[0], m1[0] - m2[0],
m1[1] - m2[1]); m1[1] - m2[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator* GLM_FUNC_QUALIFIER tmat2x2<T> operator*
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
typename tmat2x2<T>::value_type const & s typename tmat2x2<T>::value_type const & s
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] * s, m[0] * s,
m[1] * s); m[1] * s);
} }
// X // X
// X // X
// X X // X X
// X X // X X
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator* GLM_FUNC_QUALIFIER tmat2x2<T> operator*
( (
typename tmat2x2<T>::value_type const & s, typename tmat2x2<T>::value_type const & s,
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] * s, m[0] * s,
m[1] * s); m[1] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type operator* GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type operator*
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
typename tmat2x2<T>::row_type const & v typename tmat2x2<T>::row_type const & v
) )
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
m[0][0] * v.x + m[1][0] * v.y, m[0][0] * v.x + m[1][0] * v.y,
m[0][1] * v.x + m[1][1] * v.y); m[0][1] * v.x + m[1][1] * v.y);
} }
// X X // X X
// X X // X X
// X X // X X
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator* GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator*
( (
typename tmat2x2<T>::col_type const & v, typename tmat2x2<T>::col_type const & v,
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return detail::tvec2<T>( return detail::tvec2<T>(
v.x * m[0][0] + v.y * m[0][1], v.x * m[0][0] + v.y * m[0][1],
v.x * m[1][0] + v.y * m[1][1]); v.x * m[1][0] + v.y * m[1][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator* GLM_FUNC_QUALIFIER tmat2x2<T> operator*
@ -590,95 +590,95 @@ namespace detail
m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1]); m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator/ GLM_FUNC_QUALIFIER tmat2x2<T> operator/
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
typename tmat2x2<T>::value_type const & s typename tmat2x2<T>::value_type const & s
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] / s, m[0] / s,
m[1] / s); m[1] / s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator/ GLM_FUNC_QUALIFIER tmat2x2<T> operator/
( (
typename tmat2x2<T>::value_type const & s, typename tmat2x2<T>::value_type const & s,
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
s / m[0], s / m[0],
s / m[1]); s / m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type operator/ GLM_FUNC_QUALIFIER typename tmat2x2<T>::col_type operator/
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
typename tmat2x2<T>::row_type & v typename tmat2x2<T>::row_type & v
) )
{ {
return m._inverse() * v; return m._inverse() * v;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator/ GLM_FUNC_QUALIFIER typename tmat2x2<T>::row_type operator/
( (
typename tmat2x2<T>::col_type const & v, typename tmat2x2<T>::col_type const & v,
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return v * m._inverse(); return v * m._inverse();
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> operator/ GLM_FUNC_QUALIFIER tmat2x2<T> operator/
( (
tmat2x2<T> const & m1, tmat2x2<T> const & m1,
tmat2x2<T> const & m2 tmat2x2<T> const & m2
) )
{ {
return m1 * m2._inverse(); return m1 * m2._inverse();
} }
// Unary constant operators // Unary constant operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> const operator- GLM_FUNC_QUALIFIER tmat2x2<T> const operator-
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
-m[0], -m[0],
-m[1]); -m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> const operator++ GLM_FUNC_QUALIFIER tmat2x2<T> const operator++
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
int int
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] + T(1), m[0] + T(1),
m[1] + T(1)); m[1] + T(1));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x2<T> const operator-- GLM_FUNC_QUALIFIER tmat2x2<T> const operator--
( (
tmat2x2<T> const & m, tmat2x2<T> const & m,
int int
) )
{ {
return tmat2x2<T>( return tmat2x2<T>(
m[0] - T(1), m[0] - T(1),
m[1] - T(1)); m[1] - T(1));
} }
////////////////////////////////////// //////////////////////////////////////
// Boolean operators // Boolean operators

View File

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3; template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4; template <typename T> struct tmat4x4;
// \brief Template for 2 columns and 3 rows matrix of floating-point numbers. /// @brief Template for 2 columns and 3 rows matrix of floating-point numbers.
// \ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tmat2x3 struct tmat2x3
{ {
@ -64,7 +64,7 @@ namespace detail
static GLM_FUNC_DECL size_type col_size(); static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size(); static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const; GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
private: private:
// Data // Data
@ -90,20 +90,20 @@ namespace detail
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL explicit tmat2x3(
U const & x); U const & x);
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2> template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL explicit tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2); X2 const & x2, Y2 const & y2, Z2 const & z2);
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL explicit tmat2x3(
tvec3<U> const & v1, tvec3<U> const & v1,
tvec3<V> const & v2); tvec3<V> const & v2);
////////////////////////////////////// //////////////////////////////////////
// Matrix conversion // Matrix conversion
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U> const & m); GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U> const & m);

View File

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3; template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4; template <typename T> struct tmat4x4;
// Template for 2 columns and 4 rows matrix of floating-point numbers. /// Template for 2 columns and 4 rows matrix of floating-point numbers.
// \ingroup core_template /// @ingroup core_template
template <typename T> template <typename T>
struct tmat2x4 struct tmat2x4
{ {
@ -64,7 +64,7 @@ namespace detail
static GLM_FUNC_DECL size_type col_size(); static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size(); static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const; GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
private: private:
// Data // Data
@ -90,21 +90,21 @@ namespace detail
// Conversions // Conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL explicit tmat2x4(
U const & x); U const & x);
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2> typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL explicit tmat2x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2); X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL explicit tmat2x4(
tvec4<U> const & v1, tvec4<U> const & v1,
tvec4<V> const & v2); tvec4<V> const & v2);
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
template <typename U> template <typename U>
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U> const & m); GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U> const & m);

View File

@ -29,11 +29,11 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T>::size_type tmat2x4<T>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T>::size_type tmat2x4<T>::length() const
{ {
return 2; return 2;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x4<T>::size_type tmat2x4<T>::col_size() GLM_FUNC_QUALIFIER typename tmat2x4<T>::size_type tmat2x4<T>::col_size()
@ -72,67 +72,67 @@ namespace detail
return this->value[i]; return this->value[i];
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Constructors // Constructors
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4() GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4()
{ {
value_type const Zero(0); value_type const Zero(0);
value_type const One(1); value_type const One(1);
this->value[0] = col_type(One, Zero, Zero, Zero); this->value[0] = col_type(One, Zero, Zero, Zero);
this->value[1] = col_type(Zero, One, Zero, Zero); this->value[1] = col_type(Zero, One, Zero, Zero);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = m.value[0]; this->value[0] = m.value[0];
this->value[1] = m.value[1]; this->value[1] = m.value[1];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
ctor ctor
) )
{} {}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
value_type const & s value_type const & s
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = col_type(s, Zero, Zero, Zero); this->value[0] = col_type(s, Zero, Zero, Zero);
this->value[1] = col_type(Zero, Zero, Zero, Zero); this->value[1] = col_type(Zero, Zero, Zero, Zero);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0, value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1 value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1
) )
{ {
this->value[0] = col_type(x0, y0, z0, w0); this->value[0] = col_type(x0, y0, z0, w0);
this->value[1] = col_type(x1, y1, z1, w1); this->value[1] = col_type(x1, y1, z1, w1);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
col_type const & v0, col_type const & v0,
col_type const & v1 col_type const & v1
) )
{ {
this->value[0] = v0; this->value[0] = v0;
this->value[1] = v1; this->value[1] = v1;
} }
////////////////////////////////////// //////////////////////////////////////
// Convertion constructors // Convertion constructors
@ -144,8 +144,8 @@ namespace detail
) )
{ {
value_type const Zero(0); value_type const Zero(0);
this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero); this->value[0] = tvec4<T>(value_type(s), Zero, Zero, Zero);
this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero); this->value[1] = tvec4<T>(Zero, value_type(s), Zero, Zero);
} }
template <typename T> template <typename T>
@ -158,8 +158,8 @@ namespace detail
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2 X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2
) )
{ {
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1)); this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2)); this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
} }
template <typename T> template <typename T>
@ -170,347 +170,336 @@ namespace detail
tvec4<V2> const & v2 tvec4<V2> const & v2
) )
{ {
this->value[0] = col_type(v1); this->value[0] = col_type(v1);
this->value[1] = col_type(v2); this->value[1] = col_type(v2);
} }
////////////////////////////////////// //////////////////////////////////////
// Matrix conversions // Matrix conversions
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat2x4<U> const & m tmat2x4<U> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat2x2<T> const & m tmat2x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], detail::tvec2<T>(0)); this->value[0] = col_type(m[0], detail::tvec2<T>(0));
this->value[1] = col_type(m[1], detail::tvec2<T>(0)); this->value[1] = col_type(m[1], detail::tvec2<T>(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat3x3<T> const & m tmat3x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat4x4<T> const & m tmat4x4<T> const & m
) )
{ {
this->value[0] = col_type(m[0]); this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]); this->value[1] = col_type(m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat2x3<T> const & m tmat2x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat3x2<T> const & m tmat3x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], detail::tvec2<T>(0)); this->value[0] = col_type(m[0], detail::tvec2<T>(0));
this->value[1] = col_type(m[1], detail::tvec2<T>(0)); this->value[1] = col_type(m[1], detail::tvec2<T>(0));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat3x4<T> const & m tmat3x4<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat4x2<T> const & m tmat4x2<T> const & m
) )
{ {
this->value[0] = col_type(m[0], detail::tvec2<T>(T(0))); this->value[0] = col_type(m[0], detail::tvec2<T>(T(0)));
this->value[1] = col_type(m[1], detail::tvec2<T>(T(0))); this->value[1] = col_type(m[1], detail::tvec2<T>(T(0)));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4 GLM_FUNC_QUALIFIER tmat2x4<T>::tmat2x4
( (
tmat4x3<T> const & m tmat4x3<T> const & m
) )
{ {
this->value[0] = col_type(m[0], T(0)); this->value[0] = col_type(m[0], T(0));
this->value[1] = col_type(m[1], T(0)); this->value[1] = col_type(m[1], T(0));
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Unary updatable operators // Unary updatable operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator=
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator=
( (
tmat2x4<U> const & m tmat2x4<U> const & m
) )
{ {
this->value[0] = m[0]; this->value[0] = m[0];
this->value[1] = m[1]; this->value[1] = m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator+= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator+=
( (
U const & s U const & s
) )
{ {
this->value[0] += s; this->value[0] += s;
this->value[1] += s; this->value[1] += s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator+= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator+=
( (
tmat2x4<U> const & m tmat2x4<U> const & m
) )
{ {
this->value[0] += m[0]; this->value[0] += m[0];
this->value[1] += m[1]; this->value[1] += m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-=
( (
U const & s U const & s
) )
{ {
this->value[0] -= s; this->value[0] -= s;
this->value[1] -= s; this->value[1] -= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-=
( (
tmat2x4<U> const & m tmat2x4<U> const & m
) )
{ {
this->value[0] -= m[0]; this->value[0] -= m[0];
this->value[1] -= m[1]; this->value[1] -= m[1];
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator*= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator*=
( (
U const & s U const & s
) )
{ {
this->value[0] *= s; this->value[0] *= s;
this->value[1] *= s; this->value[1] *= s;
return *this; return *this;
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator*= GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator*=
( (
tmat2x4<U> const & m tmat2x4<U> const & m
) )
{ {
return (*this = tmat2x4<T>(*this * m)); return (*this = tmat2x4<T>(*this * m));
} }
template <typename T> template <typename T>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T> & tmat2x4<T>::operator/= GLM_FUNC_QUALIFIER tmat2x4<T> & tmat2x4<T>::operator/=
( (
U const & s U const & s
) )
{ {
this->value[0] /= s; this->value[0] /= s;
this->value[1] /= s; this->value[1] /= s;
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator++ () GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator++ ()
{ {
++this->value[0]; ++this->value[0];
++this->value[1]; ++this->value[1];
return *this; return *this;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-- () GLM_FUNC_QUALIFIER tmat2x4<T>& tmat2x4<T>::operator-- ()
{ {
--this->value[0]; --this->value[0];
--this->value[1]; --this->value[1];
return *this; return *this;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Binary operators // Binary operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator+ GLM_FUNC_QUALIFIER tmat2x4<T> operator+
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
typename tmat2x4<T>::value_type const & s typename tmat2x4<T>::value_type const & s
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] + s, m[0] + s,
m[1] + s); m[1] + s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator+ GLM_FUNC_QUALIFIER tmat2x4<T> operator+
( (
tmat2x4<T> const & m1, tmat2x4<T> const & m1,
tmat2x4<T> const & m2 tmat2x4<T> const & m2
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m1[0] + m2[0], m1[0] + m2[0],
m1[1] + m2[1]); m1[1] + m2[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator- GLM_FUNC_QUALIFIER tmat2x4<T> operator-
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
typename tmat2x4<T>::value_type const & s typename tmat2x4<T>::value_type const & s
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] - s, m[0] - s,
m[1] - s); m[1] - s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator- GLM_FUNC_QUALIFIER tmat2x4<T> operator-
( (
tmat2x4<T> const & m1, tmat2x4<T> const & m1,
tmat2x4<T> const & m2 tmat2x4<T> const & m2
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m1[0] - m2[0], m1[0] - m2[0],
m1[1] - m2[1]); m1[1] - m2[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator* GLM_FUNC_QUALIFIER tmat2x4<T> operator*
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
typename tmat2x4<T>::value_type const & s typename tmat2x4<T>::value_type const & s
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] * s, m[0] * s,
m[1] * s); m[1] * s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator* GLM_FUNC_QUALIFIER tmat2x4<T> operator*
( (
typename tmat2x4<T>::value_type const & s, typename tmat2x4<T>::value_type const & s,
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] * s, m[0] * s,
m[1] * s); m[1] * s);
} }
// X template <typename T>
// X GLM_FUNC_QUALIFIER typename tmat2x4<T>::col_type operator*
// X X
// X X
// X X
// X X
template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x4<T>::col_type operator*
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
typename tmat2x4<T>::row_type const & v typename tmat2x4<T>::row_type const & v
) )
{ {
return typename tmat2x4<T>::col_type( return typename tmat2x4<T>::col_type(
m[0][0] * v.x + m[1][0] * v.y, m[0][0] * v.x + m[1][0] * v.y,
m[0][1] * v.x + m[1][1] * v.y, m[0][1] * v.x + m[1][1] * v.y,
m[0][2] * v.x + m[1][2] * v.y, m[0][2] * v.x + m[1][2] * v.y,
m[0][3] * v.x + m[1][3] * v.y); m[0][3] * v.x + m[1][3] * v.y);
} }
// X X
// X X
// X X
// X X
// X X X X
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER typename tmat2x4<T>::row_type operator* GLM_FUNC_QUALIFIER typename tmat2x4<T>::row_type operator*
( (
typename tmat2x4<T>::col_type const & v, typename tmat2x4<T>::col_type const & v,
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
return typename tmat2x4<T>::row_type( return typename tmat2x4<T>::row_type(
v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3], v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3],
v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2] + v.w * m[1][3]); v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2] + v.w * m[1][3]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T> operator* GLM_FUNC_QUALIFIER tmat4x4<T> operator*
( (
tmat2x4<T> const & m1, tmat2x4<T> const & m1,
tmat4x2<T> const & m2 tmat4x2<T> const & m2
) )
{ {
typename tmat2x4<T>::value_type SrcA00 = m1[0][0]; typename tmat2x4<T>::value_type SrcA00 = m1[0][0];
typename tmat2x4<T>::value_type SrcA01 = m1[0][1]; typename tmat2x4<T>::value_type SrcA01 = m1[0][1];
typename tmat2x4<T>::value_type SrcA02 = m1[0][2]; typename tmat2x4<T>::value_type SrcA02 = m1[0][2];
@ -547,7 +536,7 @@ namespace detail
Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31; Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31;
Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31; Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31;
return Result; return Result;
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator* GLM_FUNC_QUALIFIER tmat2x4<T> operator*
@ -589,65 +578,65 @@ namespace detail
m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1]); m1[0][3] * m2[2][0] + m1[1][3] * m2[2][1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator/ GLM_FUNC_QUALIFIER tmat2x4<T> operator/
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
typename tmat2x4<T>::value_type const & s typename tmat2x4<T>::value_type const & s
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] / s, m[0] / s,
m[1] / s); m[1] / s);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> operator/ GLM_FUNC_QUALIFIER tmat2x4<T> operator/
( (
typename tmat2x4<T>::value_type const & s, typename tmat2x4<T>::value_type const & s,
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
s / m[0], s / m[0],
s / m[1]); s / m[1]);
} }
// Unary constant operators // Unary constant operators
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> const operator- GLM_FUNC_QUALIFIER tmat2x4<T> const operator-
( (
tmat2x4<T> const & m tmat2x4<T> const & m
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
-m[0], -m[0],
-m[1]); -m[1]);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> const operator++ GLM_FUNC_QUALIFIER tmat2x4<T> const operator++
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
int int
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] + typename tmat2x4<T>::value_type(1), m[0] + typename tmat2x4<T>::value_type(1),
m[1] + typename tmat2x4<T>::value_type(1)); m[1] + typename tmat2x4<T>::value_type(1));
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER tmat2x4<T> const operator-- GLM_FUNC_QUALIFIER tmat2x4<T> const operator--
( (
tmat2x4<T> const & m, tmat2x4<T> const & m,
int int
) )
{ {
return tmat2x4<T>( return tmat2x4<T>(
m[0] - typename tmat2x4<T>::value_type(1), m[0] - typename tmat2x4<T>::value_type(1),
m[1] - typename tmat2x4<T>::value_type(1)); m[1] - typename tmat2x4<T>::value_type(1));
} }
////////////////////////////////////// //////////////////////////////////////
// Boolean operators // Boolean operators