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 detail
{
// Internal class for implementing swizzle operators
template <typename T, int N>
struct _swizzle_base0
{
typedef T value_type;
// Internal class for implementing swizzle operators
template <typename T, int N>
struct _swizzle_base0
{
typedef T value_type;
protected:
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]; }
protected:
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]; }
// 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
// elem()
char _buffer[1];
};
// 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
// elem()
char _buffer[1];
};
template <typename T, typename V, int E0, int E1, int E2, int E3, int N>
struct _swizzle_base1 : public _swizzle_base0<T,N>
{
};
template <typename T, typename V, int E0, int E1, int E2, int E3, int N>
struct _swizzle_base1 : public _swizzle_base0<T,N>
{
};
template <typename T, typename V, int E0, int E1>
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)); }
};
template <typename T, typename V, int E0, int E1>
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)); }
};
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>
{
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>
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)); }
};
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>
{
V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(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>
{
V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }
};
// Internal class for implementing swizzle operators
/*
Template parameters:
// Internal class for implementing swizzle operators
/*
Template parameters:
ValueType = type of scalar values (e.g. float, double)
VecType = class the swizzle is applies to (e.g. tvec3<float>)
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
ValueType = type of scalar values (e.g. float, double)
VecType = class the swizzle is applies to (e.g. tvec3<float>)
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
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).
*/
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>
{
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).
*/
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>
{
typedef VecType vec_type;
typedef ValueType value_type;
@ -181,7 +181,7 @@ namespace detail
for (int i = 0; i < N; ++i)
op( (*this)[i], t[i] );
}
};
};
// 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>
@ -322,33 +322,32 @@ namespace glm
{
_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(/)
}
//
// Swizzles are distinct types from the unswizzled type. The below macros will
// 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
// the function.
//
// The alternative is to use the operator()() when calling the function in order
// to explicitly convert the swizzled type to the unswizzled type.
//
//
// Swizzles are distinct types from the unswizzled type. The below macros will
// 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
// the function.
//
// The alternative is to use the operator()() when calling the function in order
// 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, acos);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step);
//_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all);
//_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross);
//_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step);
//_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix);
}
#define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \

View File

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

View File

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

View File

@ -46,27 +46,27 @@ namespace glm
/// Returns x if x >= 0; otherwise, it returns -x.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
///
/// @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>
template <typename genType>
genType abs(genType const & x);
/// 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.
///
/// @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/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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.
///
/// @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/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType floor(genType const & x);
@ -74,9 +74,9 @@ namespace glm
/// whose absolute value is not larger than the absolute value of x.
///
/// @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/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/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType trunc(genType const & x);
@ -87,9 +87,9 @@ namespace glm
/// same value as roundEven(x) for all values of x.
///
/// @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/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/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType round(genType const & x);
@ -98,40 +98,40 @@ namespace glm
/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
///
/// @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/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/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
template <typename genType>
genType roundEven(genType const & x);
/// Returns a value equal to the nearest integer
/// that is greater than or equal to x.
///
///
/// @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>
template <typename genType>
template <typename genType>
genType ceil(genType const & x);
/// Return x - floor(x).
///
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
/// @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>
template <typename genType>
genType fract(genType const & x);
/// Modulus. Returns x - y * floor(x / y)
/// for each component in x using the floating point value y.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType mod(
genType const & x,
genType const & y);
@ -140,10 +140,10 @@ namespace glm
/// for each component in x using the floating point value y.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType mod(
genType const & x,
typename genType::value_type const & y);
@ -152,22 +152,22 @@ namespace glm
/// part (as a whole number floating point value). Both the
/// return value and the output parameter will have the same
/// sign as x.
///
///
/// @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/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/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>
template <typename genType>
genType modf(
genType const & x,
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.
///
/// @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/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>
template <typename genType>
genType min(
genType const & x,
@ -178,12 +178,12 @@ namespace glm
genType const & x,
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.
///
/// @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/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>
template <typename genType>
genType max(
genType const & x,
@ -194,13 +194,13 @@ namespace glm
genType const & x,
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.
///
///
/// @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/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/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>
template <typename genType>
genType clamp(
genType const & x,
@ -229,9 +229,9 @@ namespace glm
//! provides different functionality than
//! genType mix(genType x, genType y, genType(a))
//! 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/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/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>
///
/// @param[in] x 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);
//! Returns 0.0 if x < edge, otherwise it returns 1.0.
//!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
//!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType step(
genType const & edge,
@ -283,9 +283,9 @@ namespace glm
/// Results are undefined if edge0 >= edge1.
///
/// @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/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/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>
template <typename genType>
genType smoothstep(
genType const & edge0,
@ -305,11 +305,11 @@ namespace glm
/// representations.
///
/// /!\ When using compiler fast math, this function may fail.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
typename genType::bool_type isnan(genType const & x);
@ -318,10 +318,10 @@ namespace glm
/// set of floating point representations. Returns false
/// otherwise, including for implementations with no infinity
/// representations.
///
///
/// @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>
template <typename genType>
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 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/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/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
genIType floatBitsToInt(genType const & value);
@ -344,9 +344,9 @@ namespace glm
///
/// @tparam genType Single-precision floating-point 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/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/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genUType>
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
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
///
/// @tparam genType Single-precision floating-point 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/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/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>
///
/// @todo Clarify this declaration, we don't need to actually specify the return type
template <typename genType, typename genIType>
genType intBitsToFloat(genIType const & value);
/// Returns a floating-point value corresponding to a
/// unsigned integer encoding of a floating-point value.
/// If an inf or NaN is passed in, it will not signal, and the
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// Returns a floating-point value corresponding to a
/// unsigned integer encoding of a floating-point value.
/// If an inf or NaN is passed in, it will not signal, and the
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @tparam genType Single-precision floating-point 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/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/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>
///
/// @todo Clarify this declaration, we don't need to actually specify the return type
template <typename genType, typename genUType>
genType uintBitsToFloat(genUType const & value);
template <typename genType, typename genUType>
genType uintBitsToFloat(genUType const & value);
/// Computes and returns a * b + c.
///
/// @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/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/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>
template <typename genType>
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.
///
/// @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>
genType frexp(genType const & x, genIType & exp);
@ -418,7 +418,7 @@ namespace glm
/// @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/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>
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 y
/// @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/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/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
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.
/// @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/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/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
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.
/// @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/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/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
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.
/// @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/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/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType exp2(genType const & x);
/// Returns the base 2 log of x, i.e., returns the value 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.
/// @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/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/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType log2(genType const & 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.
/// @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/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/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>
template <typename genType>
genType sqrt(genType const & 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.
/// @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/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/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType inversesqrt(genType const & x);

View File

@ -28,60 +28,60 @@
namespace glm
{
// pow
template <typename genType>
GLM_FUNC_QUALIFIER genType pow
// pow
template <typename genType>
GLM_FUNC_QUALIFIER genType pow
(
genType const & x,
genType const & y
)
{
{
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)
// exp
template <typename genType>
GLM_FUNC_QUALIFIER genType exp
// exp
template <typename genType>
GLM_FUNC_QUALIFIER genType exp
(
genType const & x
)
{
{
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)
// log
template <typename genType>
GLM_FUNC_QUALIFIER genType log
// log
template <typename genType>
GLM_FUNC_QUALIFIER genType log
(
genType const & x
)
{
{
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)
//exp2, ln2 = 0.69314718055994530941723212145818f
template <typename genType>
GLM_FUNC_QUALIFIER genType exp2
//exp2, ln2 = 0.69314718055994530941723212145818f
template <typename genType>
GLM_FUNC_QUALIFIER genType exp2
(
genType const & x
)
{
{
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)
@ -109,46 +109,46 @@ namespace _detail
return T(::std::log(Value)) / T(0.69314718055994530941723212145818);
}
};
}//namespace _detail
// log2, ln2 = 0.69314718055994530941723212145818f
template <typename genType>
GLM_FUNC_QUALIFIER genType log2
// log2, ln2 = 0.69314718055994530941723212145818f
template <typename genType>
GLM_FUNC_QUALIFIER genType log2
(
genType const & x
)
{
{
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);
}
}
VECTORIZE_VEC(log2)
// sqrt
template <typename genType>
GLM_FUNC_QUALIFIER genType sqrt
// sqrt
template <typename genType>
GLM_FUNC_QUALIFIER genType sqrt
(
genType const & x
)
{
{
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)
template <typename genType>
GLM_FUNC_QUALIFIER genType inversesqrt
template <typename genType>
GLM_FUNC_QUALIFIER genType inversesqrt
(
genType const & x
)
{
{
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)

View File

@ -42,21 +42,21 @@ namespace glm
/// @{
/// Returns the length of x, i.e., sqrt(x * x).
///
///
/// @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/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/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
typename genType::value_type length(
typename genType::value_type length(
genType const & x);
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
///
/// @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/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/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
typename genType::value_type distance(
genType const & p0,
@ -65,10 +65,10 @@ namespace glm
/// Returns the dot product of x and y, i.e., result = x * y.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
typename genType::value_type dot(
genType const & x,
genType const & y);
@ -76,18 +76,18 @@ namespace glm
/// Returns the cross product of x and y.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename valType>
///
/// @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>
template <typename valType>
detail::tvec3<valType> cross(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y);
/// 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/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/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType normalize(
genType const & x);
@ -95,36 +95,36 @@ namespace glm
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType faceforward(
genType const & N,
genType const & I,
genType const & Nref);
/// For the incident vector I and surface orientation N,
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
///
/// @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>
template <typename genType>
genType reflect(
genType const & I,
genType const & N);
/// For the incident vector I and surface normal N,
/// and the ratio of indices of refraction eta,
/// return the refraction vector.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType refract(
genType const & I,
genType const & N,

View File

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

View File

@ -49,8 +49,8 @@ namespace glm
///
/// @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/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/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genUType>
genUType uaddCarry(
genUType const & x,
@ -63,8 +63,8 @@ namespace glm
///
/// @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/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/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genUType>
genUType usubBorrow(
genUType const & x,
@ -77,8 +77,8 @@ namespace glm
///
/// @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/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/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genUType>
void umulExtended(
genUType const & x,
@ -92,8 +92,8 @@ namespace glm
///
/// @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/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/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIType>
void imulExtended(
genIType const & x,
@ -114,8 +114,8 @@ namespace glm
///
/// @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/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/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIUType>
genIUType bitfieldExtract(
genIUType const & Value,
@ -134,7 +134,7 @@ namespace glm
///
/// @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>
template <typename genIUType>
genIUType bitfieldInsert(
@ -149,8 +149,8 @@ namespace glm
///
/// @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/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/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIUType>
genIUType bitfieldReverse(genIUType const & Value);
@ -158,8 +158,8 @@ namespace glm
///
/// @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/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/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>
///
/// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType>
@ -171,8 +171,8 @@ namespace glm
///
/// @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/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/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>
///
/// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType>
@ -185,8 +185,8 @@ namespace glm
///
/// @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/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/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>
///
/// @todo Clarify the declaration to specify that scalars are suported.
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].
///
/// @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/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/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>
template <typename matType>
matType matrixCompMult(
matType const & x,
@ -62,12 +62,12 @@ namespace glm
/// and does a linear algebraic matrix multiply c * r.
///
/// @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/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/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>
///
/// @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(
vecType const & c,
vecType const & r);
@ -75,19 +75,19 @@ namespace glm
/// Returns the transposed matrix of x
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename matType>
///
/// @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>
template <typename matType>
typename matType::transpose_type transpose(
matType const & x);
/// Return the determinant of a mat2 matrix.
///
/// @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/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/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>
template <typename valType>
typename detail::tmat2x2<valType>::value_type determinant(
detail::tmat2x2<valType> const & m);
@ -95,9 +95,9 @@ namespace glm
/// Return the determinant of a mat3 matrix.
///
/// @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/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/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>
template <typename valType>
typename detail::tmat3x3<valType>::value_type determinant(
detail::tmat3x3<valType> const & m);
@ -105,19 +105,19 @@ namespace glm
/// Return the determinant of a mat4 matrix.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename valType>
///
/// @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>
template <typename valType>
typename detail::tmat4x4<valType>::value_type determinant(
detail::tmat4x4<valType> const & m);
/// Return the inverse of a mat2 matrix.
///
/// @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/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/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>
template <typename valType>
detail::tmat2x2<valType> inverse(
detail::tmat2x2<valType> const & m);
@ -125,9 +125,9 @@ namespace glm
/// Return the inverse of a mat3 matrix.
///
/// @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/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/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>
template <typename valType>
detail::tmat3x3<valType> inverse(
detail::tmat3x3<valType> const & m);
@ -135,9 +135,9 @@ namespace glm
/// Return the inverse of a mat4 matrix.
///
/// @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/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/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>
template <typename valType>
detail::tmat4x4<valType> inverse(
detail::tmat4x4<valType> const & m);

View File

@ -576,7 +576,7 @@ namespace glm
T Determinant = glm::dot(m[0], Row0);
Inverse /= Determinant;
return Inverse;
}
}//namespace glm

View File

@ -46,8 +46,8 @@ namespace glm
/// Returns a 1D noise value based on the input value x.
///
/// @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>
template <typename genType>
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.
///
/// @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/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/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>
template <typename genType>
detail::tvec2<typename genType::value_type> noise2(genType const & x);
/// Returns a 3D noise value based on the input value x.
///
/// @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/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/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>
template <typename genType>
detail::tvec3<typename genType::value_type> noise3(genType const & x);
/// Returns a 4D noise value based on the input value x.
///
/// @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/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/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>
template <typename genType>
detail::tvec4<typename genType::value_type> noise4(genType const & x);

View File

@ -27,7 +27,7 @@
///////////////////////////////////////////////////////////////////////////////////
namespace glm
{
{
template <typename T>
GLM_FUNC_QUALIFIER T noise1(T const & x)
{

View File

@ -37,142 +37,141 @@
#define GLM_CORE_func_packing GLM_VERSION
namespace glm
{
{
/// @addtogroup core_func_packing
/// @{
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/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);
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/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);
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/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);
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
//! 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.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! 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 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/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);
//! 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.
//!
//! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! unpackUnorm2x16: f / 65535.0
//!
//! 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.
//!
/// @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>
//! 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.
//!
//! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! unpackUnorm2x16: f / 65535.0
//!
//! 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.
//!
/// @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>
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.
//! 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:
//! 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 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
//! 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.
//!
//! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! 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 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/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);
/// 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.
///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackUnorm4x8: f / 255.0
///
/// 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.
///
/// @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>
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.
/// 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:
/// 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 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
/// 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.
///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackUnorm4x8: f / 255.0
///
/// 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.
///
/// @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>
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.
/// 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:
/// 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 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/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);
/// 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.
/// Otherwise, the bit- level representation of v is preserved.
/// The first vector component specifies the 32 least 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
/// 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.
/// Otherwise, the bit- level representation of v is preserved.
/// The first vector component specifies the 32 least 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/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);
/// Returns a two-component unsigned integer vector representation of v.
/// The bit-level representation of v is preserved.
/// The first component of the vector contains the 32 least significant bits of the double;
/// 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
/// Returns a two-component unsigned integer vector representation of v.
/// The bit-level representation of v is preserved.
/// The first component of the vector contains the 32 least significant bits of the double;
/// 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/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);
/// 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,
/// 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 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/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/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>
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,
@ -180,9 +179,9 @@ namespace glm
/// 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 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/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/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>
vec2 unpackHalf2x16(uint const & v);
/// @}

View File

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

View File

@ -48,18 +48,18 @@ namespace glm
/// Converts degrees to radians and returns the result.
///
/// @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/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/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType radians(genType const & degrees);
/// Converts radians to degrees and returns the result.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType degrees(genType const & radians);
@ -67,9 +67,9 @@ namespace glm
/// The values returned by this function will range from [-1, 1].
///
/// @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/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/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType sin(genType const & angle);
@ -77,40 +77,40 @@ namespace glm
/// The values returned by this function will range from [-1, 1].
///
/// @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/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/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType cos(genType const & angle);
/// The standard trigonometric tangent function.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType tan(genType const & angle);
/// Arc sine. Returns an angle whose sine is x.
/// The range of values returned by this function is [-PI/2, PI/2].
/// Results are undefined if |x| > 1.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType asin(genType const & x);
/// Arc cosine. Returns an angle whose sine is x.
/// The range of values returned by this function is [0, PI].
/// Results are undefined if |x| > 1.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType acos(genType const & x);
@ -119,67 +119,67 @@ namespace glm
/// quadrant the angle is in. The range of values returned
/// by this function is [-PI, PI]. Results are undefined
/// if x and y are both 0.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType atan(genType const & y, genType const & x);
/// Arc tangent. Returns an angle whose tangent is y_over_x.
/// The range of values returned by this function is [-PI/2, PI/2].
///
///
/// @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>
template <typename genType>
genType atan(genType const & y_over_x);
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
///
///
/// @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/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/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType sinh(genType const & angle);
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
///
///
/// @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/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/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType cosh(genType const & angle);
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
///
///
/// @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/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/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType tanh(genType const & angle);
/// Arc hyperbolic sine; returns the inverse of sinh.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType asinh(genType const & x);
/// Arc hyperbolic cosine; returns the non-negative inverse
/// of cosh. Results are undefined if x < 1.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType acosh(genType const & x);
@ -187,9 +187,9 @@ namespace glm
/// Results are undefined if abs(x) >= 1.
///
/// @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/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/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType atanh(genType const & x);

View File

@ -51,82 +51,82 @@ namespace glm
/// Returns the component-wise comparison result of x < y.
///
/// @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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
typename vecType::bool_type lessThan(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x <= y.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x > y.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
typename vecType::bool_type greaterThan(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x >= y.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x == y.
///
///
/// @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/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/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
typename vecType::bool_type equal(vecType const & x, vecType const & y);
/// Returns the component-wise comparison of result x != y.
///
/// @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/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/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename vecType>
typename vecType::bool_type notEqual(vecType const & x, vecType const & y);
/// Returns true if any component of x is true.
///
/// @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/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/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <template <typename> class vecType>
bool any(vecType<bool> const & v);
/// Returns true if all components of x are true.
///
/// @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/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/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <template <typename> class vecType>
bool all(vecType<bool> const & v);
/// Returns the component-wise logical complement of x.
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
///
/// @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/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/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <template <typename> class vecType>
vecType<bool> not_(vecType<bool> const & v);

View File

@ -28,7 +28,7 @@
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
(
vecType<T> const & x,

View File

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

View File

@ -35,36 +35,36 @@
namespace glm
{
#ifdef GLM_USE_HALF_SCALAR
typedef detail::half lowp_float_t;
typedef detail::half lowp_float_t;
#else//GLM_USE_HALF_SCALAR
typedef float lowp_float_t;
typedef float lowp_float_t;
#endif//GLM_USE_HALF_SCALAR
typedef float mediump_float_t;
typedef double highp_float_t;
typedef float mediump_float_t;
typedef double highp_float_t;
/// @addtogroup core_precision
/// @{
/// Low precision floating-point numbers.
/// There is no guarantee on the actual precision.
/// Low precision floating-point numbers.
/// 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.7.2 Precision Qualifier</a>
typedef lowp_float_t lowp_float;
/// Medium precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef lowp_float_t lowp_float;
/// Medium precision floating-point numbers.
/// 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.7.2 Precision Qualifier</a>
typedef mediump_float_t mediump_float;
/// High precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef mediump_float_t mediump_float;
/// High precision floating-point numbers.
/// 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.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))
typedef mediump_float float_t;

View File

@ -65,14 +65,14 @@ namespace detail
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</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 detail::lowp_int_t lowp_int;
/// Medium precision signed integer.
/// 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.3 Integers</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 detail::mediump_int_t mediump_int;
/// High precision signed integer.
/// There is no guarantee on the actual precision.
///
@ -86,14 +86,14 @@ namespace detail
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</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 detail::lowp_uint_t lowp_uint;
/// Medium precision unsigned integer.
/// 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.3 Integers</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 detail::mediump_uint_t mediump_uint;
/// High precision unsigned integer.
/// There is no guarantee on the actual precision.
///
@ -131,7 +131,6 @@ namespace detail
typedef uint_t uint;
/// @}
}//namespace glm
#endif//glm_core_type_int

View File

@ -48,12 +48,12 @@ namespace detail
template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4;
// @brief Template for 2 * 2 matrix of floating-point numbers.
// @ingroup core_template
/// @brief Template for 2 * 2 matrix of floating-point numbers.
/// @ingroup core_template
template <typename T>
struct tmat2x2
{
// Implementation detail
// Implementation detail
enum ctor{null};
typedef T value_type;
typedef std::size_t size_type;
@ -64,9 +64,9 @@ namespace detail
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
public:
// Implementation detail
GLM_FUNC_DECL tmat2x2<T> _inverse() const;
@ -75,7 +75,7 @@ namespace detail
//////////////////////////////////////
// Implementation detail
col_type value[2];
public:
//////////////////////////////////////
// Constructors
@ -169,7 +169,7 @@ namespace detail
tmat2x2<T> operator+ (
tmat2x2<T> const & m1,
tmat2x2<T> const & m2);
template <typename T>
tmat2x2<T> operator- (
tmat2x2<T> const & m,

View File

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

View File

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4;
// \brief Template for 2 columns and 3 rows matrix of floating-point numbers.
// \ingroup core_template
/// @brief Template for 2 columns and 3 rows matrix of floating-point numbers.
/// @ingroup core_template
template <typename T>
struct tmat2x3
{
@ -64,7 +64,7 @@ namespace detail
static GLM_FUNC_DECL size_type col_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:
// Data
@ -85,25 +85,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat2x3(
col_type const & v0,
col_type const & v1);
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x3(
U const & x);
U const & x);
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL explicit tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2);
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2);
template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x3(
tvec3<U> const & v1,
tvec3<V> const & v2);
tvec3<U> const & v1,
tvec3<V> const & v2);
//////////////////////////////////////
// Matrix conversion
// Matrix conversion
template <typename U>
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U> const & m);
@ -148,12 +148,12 @@ namespace detail
tmat2x3<T> operator+ (
tmat2x3<T> const & m,
typename tmat2x3<T>::value_type const & s);
template <typename T>
tmat2x3<T> operator+ (
tmat2x3<T> const & m1,
tmat2x3<T> const & m2);
template <typename T>
tmat2x3<T> operator- (
tmat2x3<T> const & m,

View File

@ -48,8 +48,8 @@ namespace detail
template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4;
// Template for 2 columns and 4 rows matrix of floating-point numbers.
// \ingroup core_template
/// Template for 2 columns and 4 rows matrix of floating-point numbers.
/// @ingroup core_template
template <typename T>
struct tmat2x4
{
@ -64,7 +64,7 @@ namespace detail
static GLM_FUNC_DECL size_type col_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:
// Data
@ -85,26 +85,26 @@ namespace detail
GLM_FUNC_DECL explicit tmat2x4(
col_type const & v0,
col_type const & v1);
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x4(
U const & x);
U const & x);
template <
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2>
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_DECL explicit tmat2x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x4(
tvec4<U> const & v1,
tvec4<V> const & v2);
//////////////////////////////////////
tvec4<U> const & v1,
tvec4<V> const & v2);
//////////////////////////////////////
// Matrix conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U> const & m);
@ -150,12 +150,12 @@ namespace detail
tmat2x4<T> operator+ (
tmat2x4<T> const & m,
typename tmat2x4<T>::value_type const & s);
template <typename T>
tmat2x4<T> operator+ (
tmat2x4<T> const & m1,
tmat2x4<T> const & m2);
template <typename T>
tmat2x4<T> operator- (
tmat2x4<T> const & m,

View File

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