Merge branch 'swizzle' of ssh://ogl-math.git.sourceforge.net/gitroot/ogl-math/ogl-math into swizzle
This commit is contained in:
commit
12f0a2a20b
@ -26,7 +26,7 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define VECTORIZE_1PARAM(func) \
|
#define VECTORIZE2_VEC(func) \
|
||||||
template <typename T> \
|
template <typename T> \
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
|
GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
|
||||||
detail::tvec2<T> const & v) \
|
detail::tvec2<T> const & v) \
|
||||||
@ -34,8 +34,9 @@
|
|||||||
return detail::tvec2<T>( \
|
return detail::tvec2<T>( \
|
||||||
func(v.x), \
|
func(v.x), \
|
||||||
func(v.y)); \
|
func(v.y)); \
|
||||||
} \
|
}
|
||||||
\
|
|
||||||
|
#define VECTORIZE3_VEC(func) \
|
||||||
template <typename T> \
|
template <typename T> \
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
|
GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
|
||||||
detail::tvec3<T> const & v) \
|
detail::tvec3<T> const & v) \
|
||||||
@ -44,8 +45,9 @@
|
|||||||
func(v.x), \
|
func(v.x), \
|
||||||
func(v.y), \
|
func(v.y), \
|
||||||
func(v.z)); \
|
func(v.z)); \
|
||||||
} \
|
}
|
||||||
\
|
|
||||||
|
#define VECTORIZE4_VEC(func) \
|
||||||
template <typename T> \
|
template <typename T> \
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
|
GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
|
||||||
detail::tvec4<T> const & v) \
|
detail::tvec4<T> const & v) \
|
||||||
@ -57,7 +59,59 @@
|
|||||||
func(v.w)); \
|
func(v.w)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VECTORIZE_2PARAMS(func) \
|
#define VECTORIZE_VEC(func) \
|
||||||
|
VECTORIZE2_VEC(func) \
|
||||||
|
VECTORIZE3_VEC(func) \
|
||||||
|
VECTORIZE4_VEC(func)
|
||||||
|
|
||||||
|
#define VECTORIZE2_VEC_SCA(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)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VECTORIZE3_VEC_SCA(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)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VECTORIZE4_VEC_SCA(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)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VECTORIZE_VEC_SCA(func) \
|
||||||
|
VECTORIZE2_VEC_SCA(func) \
|
||||||
|
VECTORIZE3_VEC_SCA(func) \
|
||||||
|
VECTORIZE4_VEC_SCA(func)
|
||||||
|
|
||||||
|
#define VECTORIZE2_VEC_VEC(func) \
|
||||||
template <typename T> \
|
template <typename T> \
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> func \
|
GLM_FUNC_QUALIFIER detail::tvec2<T> func \
|
||||||
( \
|
( \
|
||||||
@ -68,8 +122,9 @@
|
|||||||
return detail::tvec2<T>( \
|
return detail::tvec2<T>( \
|
||||||
func(x.x, y.x), \
|
func(x.x, y.x), \
|
||||||
func(x.y, y.y)); \
|
func(x.y, y.y)); \
|
||||||
} \
|
}
|
||||||
\
|
|
||||||
|
#define VECTORIZE3_VEC_VEC(func) \
|
||||||
template <typename T> \
|
template <typename T> \
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> func \
|
GLM_FUNC_QUALIFIER detail::tvec3<T> func \
|
||||||
( \
|
( \
|
||||||
@ -81,8 +136,9 @@
|
|||||||
func(x.x, y.x), \
|
func(x.x, y.x), \
|
||||||
func(x.y, y.y), \
|
func(x.y, y.y), \
|
||||||
func(x.z, y.z)); \
|
func(x.z, y.z)); \
|
||||||
} \
|
}
|
||||||
\
|
|
||||||
|
#define VECTORIZE4_VEC_VEC(func) \
|
||||||
template <typename T> \
|
template <typename T> \
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> func \
|
GLM_FUNC_QUALIFIER detail::tvec4<T> func \
|
||||||
( \
|
( \
|
||||||
@ -96,3 +152,8 @@
|
|||||||
func(x.z, y.z), \
|
func(x.z, y.z), \
|
||||||
func(x.w, y.w)); \
|
func(x.w, y.w)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VECTORIZE_VEC_VEC(func) \
|
||||||
|
VECTORIZE2_VEC_VEC(func) \
|
||||||
|
VECTORIZE3_VEC_VEC(func) \
|
||||||
|
VECTORIZE4_VEC_VEC(func)
|
||||||
|
@ -45,71 +45,89 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns x if x >= 0; otherwise, it returns -x.
|
/// Returns x if x >= 0; otherwise, it returns -x.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType floating-point or signed integer; scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genFIType>
|
template <typename genType>
|
||||||
genFIType abs(genFIType const & x);
|
genType abs(genType const & x);
|
||||||
|
|
||||||
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point or signed integer; scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genFIType>
|
template <typename genType>
|
||||||
genFIType sign(genFIType const & x);
|
genType sign(genType const & x);
|
||||||
|
|
||||||
//! Returns a value equal to the nearest integer that is less then or equal to x.
|
/// Returns a value equal to the nearest integer that is less then or equal to x.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType floor(genType const & x);
|
genType floor(genType const & x);
|
||||||
|
|
||||||
//! Returns a value equal to the nearest integer to x
|
/// Returns a value equal to the nearest integer to x
|
||||||
//! whose absolute value is not larger than the absolute value of x.
|
/// whose absolute value is not larger than the absolute value of x.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType trunc(genType const & x);
|
genType trunc(genType const & x);
|
||||||
|
|
||||||
//! Returns a value equal to the nearest integer to x.
|
/// Returns a value equal to the nearest integer to x.
|
||||||
//! The fraction 0.5 will round in a direction chosen by the
|
/// The fraction 0.5 will round in a direction chosen by the
|
||||||
//! implementation, presumably the direction that is fastest.
|
/// implementation, presumably the direction that is fastest.
|
||||||
//! This includes the possibility that round(x) returns the
|
/// This includes the possibility that round(x) returns the
|
||||||
//! same value as roundEven(x) for all values of x.
|
/// same value as roundEven(x) for all values of x.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType round(genType const & x);
|
genType round(genType const & x);
|
||||||
|
|
||||||
//! Returns a value equal to the nearest integer to x.
|
/// Returns a value equal to the nearest integer to x.
|
||||||
//! A fractional part of 0.5 will round toward the nearest even
|
/// A fractional part of 0.5 will round toward the nearest even
|
||||||
//! integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType roundEven(genType const & x);
|
genType roundEven(genType const & x);
|
||||||
|
|
||||||
//! Returns a value equal to the nearest integer
|
/// Returns a value equal to the nearest integer
|
||||||
//! that is greater than or equal to x.
|
/// that is greater than or equal to x.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType ceil(genType const & x);
|
genType ceil(genType const & x);
|
||||||
|
|
||||||
//! Return x - floor(x).
|
/// Return x - floor(x).
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType fract(genType const & x);
|
genType fract(genType const & x);
|
||||||
|
|
||||||
//! Modulus. Returns x - y * floor(x / y)
|
/// Modulus. Returns x - y * floor(x / y)
|
||||||
//! for each component in x using the floating point value y.
|
/// for each component in x using the floating point value y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -117,9 +135,11 @@ namespace glm
|
|||||||
genType const & x,
|
genType const & x,
|
||||||
genType const & y);
|
genType const & y);
|
||||||
|
|
||||||
//! Modulus. Returns x - y * floor(x / y)
|
/// Modulus. Returns x - y * floor(x / y)
|
||||||
//! for each component in x using the floating point value y.
|
/// for each component in x using the floating point value y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -127,11 +147,13 @@ namespace glm
|
|||||||
genType const & x,
|
genType const & x,
|
||||||
typename genType::value_type const & y);
|
typename genType::value_type const & y);
|
||||||
|
|
||||||
//! Returns the fractional part of x and sets i to the integer
|
/// Returns the fractional part of x and sets i to the integer
|
||||||
//! part (as a whole number floating point value). Both the
|
/// part (as a whole number floating point value). Both the
|
||||||
//! return value and the output parameter will have the same
|
/// return value and the output parameter will have the same
|
||||||
//! sign as x.
|
/// sign as x.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -141,6 +163,8 @@ namespace glm
|
|||||||
|
|
||||||
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -155,6 +179,8 @@ namespace glm
|
|||||||
|
|
||||||
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -167,9 +193,11 @@ namespace glm
|
|||||||
genType const & x,
|
genType const & x,
|
||||||
typename genType::value_type const & y);
|
typename genType::value_type const & y);
|
||||||
|
|
||||||
//! Returns min(max(x, minVal), maxVal) for each component in x
|
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||||
//! using the floating-point values minVal and maxVal.
|
/// using the floating-point values minVal and maxVal.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -243,16 +271,18 @@ namespace glm
|
|||||||
typename genType::value_type const & edge,
|
typename genType::value_type const & edge,
|
||||||
genType const & x);
|
genType const & x);
|
||||||
|
|
||||||
//! Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||||
//! performs smooth Hermite interpolation between 0 and 1
|
/// performs smooth Hermite interpolation between 0 and 1
|
||||||
//! when edge0 < x < edge1. This is useful in cases where
|
/// when edge0 < x < edge1. This is useful in cases where
|
||||||
//! you would want a threshold function with a smooth
|
/// you would want a threshold function with a smooth
|
||||||
//! transition. This is equivalent to:
|
/// transition. This is equivalent to:
|
||||||
//! genType t;
|
/// genType t;
|
||||||
//! t = clamp ((x – edge0) / (edge1 – edge0), 0, 1);
|
/// t = clamp ((x – edge0) / (edge1 – edge0), 0, 1);
|
||||||
//! return t * t * (3 – 2 * t);
|
/// return t * t * (3 – 2 * t);
|
||||||
//! Results are undefined if edge0 >= edge1.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -267,97 +297,123 @@ namespace glm
|
|||||||
typename genType::value_type const & edge1,
|
typename genType::value_type const & edge1,
|
||||||
genType const & x);
|
genType const & x);
|
||||||
|
|
||||||
//! Returns true if x holds a NaN (not a number)
|
/// Returns true if x holds a NaN (not a number)
|
||||||
//! representation in the underlying implementation's set of
|
/// representation in the underlying implementation's set of
|
||||||
//! floating point representations. Returns false otherwise,
|
/// floating point representations. Returns false otherwise,
|
||||||
//! including for implementations with no NaN
|
/// including for implementations with no NaN
|
||||||
//! representations.
|
/// representations.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
typename genType::bool_type isnan(genType const & x);
|
typename genType::bool_type isnan(genType const & x);
|
||||||
|
|
||||||
//! Returns true if x holds a positive infinity or negative
|
/// Returns true if x holds a positive infinity or negative
|
||||||
//! infinity representation in the underlying implementation's
|
/// infinity representation in the underlying implementation's
|
||||||
//! set of floating point representations. Returns false
|
/// set of floating point representations. Returns false
|
||||||
//! otherwise, including for implementations with no infinity
|
/// otherwise, including for implementations with no infinity
|
||||||
//! representations.
|
/// representations.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
typename genType::bool_type isinf(genType const & x);
|
typename genType::bool_type isinf(genType const & x);
|
||||||
|
|
||||||
//! Returns a signed integer value representing
|
/// Returns a signed integer value representing
|
||||||
//! the encoding of a floating-point value. The floatingpoint
|
/// the encoding of a floating-point value. The floatingpoint
|
||||||
//! value's bit-level representation is preserved.
|
/// value's 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/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType, typename genIType>
|
template <typename genType, typename genIType>
|
||||||
genIType floatBitsToInt(genType const & value);
|
genIType floatBitsToInt(genType const & value);
|
||||||
|
|
||||||
//! Returns a unsigned integer value representing
|
/// Returns a unsigned integer value representing
|
||||||
//! the encoding of a floating-point value. The floatingpoint
|
/// the encoding of a floating-point value. The floatingpoint
|
||||||
//! value's bit-level representation is preserved.
|
/// value's 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/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType, typename genUType>
|
template <typename genType, typename genUType>
|
||||||
genUType floatBitsToUint(genType const & value);
|
genUType floatBitsToUint(genType const & value);
|
||||||
|
|
||||||
//! Returns a floating-point value corresponding to a signed
|
/// Returns a floating-point value corresponding to a signed
|
||||||
//! integer encoding of a floating-point value.
|
/// integer encoding of a floating-point value.
|
||||||
//! If an inf or NaN is passed in, it will not signal, and the
|
/// If an inf or NaN is passed in, it will not signal, and the
|
||||||
//! resulting floating point value is unspecified. Otherwise,
|
/// resulting floating point value is unspecified. Otherwise,
|
||||||
//! the bit-level representation is preserved.
|
/// the bit-level representation is preserved.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Single-precision floating-point scalar or vector types.
|
||||||
|
/// @tparam genIType Signed integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
|
///
|
||||||
|
/// @todo - Clarify this declaration, we don't need to actually specify the return type
|
||||||
template <typename genType, typename genIType>
|
template <typename genType, typename genIType>
|
||||||
genType intBitsToFloat(genIType const & value);
|
genType intBitsToFloat(genIType const & value);
|
||||||
|
|
||||||
//! Returns a floating-point value corresponding to a
|
/// Returns a floating-point value corresponding to a
|
||||||
//! unsigned integer encoding of a floating-point value.
|
/// unsigned integer encoding of a floating-point value.
|
||||||
//! If an inf or NaN is passed in, it will not signal, and the
|
/// If an inf or NaN is passed in, it will not signal, and the
|
||||||
//! resulting floating point value is unspecified. Otherwise,
|
/// resulting floating point value is unspecified. Otherwise,
|
||||||
//! the bit-level representation is preserved.
|
/// the bit-level representation is preserved.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Single-precision floating-point scalar or vector types.
|
||||||
|
/// @tparam genUType Unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
|
///
|
||||||
|
/// @todo - Clarify this declaration, we don't need to actually specify the return type
|
||||||
template <typename genType, typename genUType>
|
template <typename genType, typename genUType>
|
||||||
genType uintBitsToFloat(genUType const & value);
|
genType uintBitsToFloat(genUType const & value);
|
||||||
|
|
||||||
//! Computes and returns a * b + c.
|
/// Computes and returns a * b + c.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType fma(genType const & a, genType const & b, genType const & c);
|
genType fma(genType const & a, genType const & b, genType const & c);
|
||||||
|
|
||||||
//! Splits x into a floating-point significand in the range
|
/// Splits x into a floating-point significand in the range
|
||||||
//! [0.5, 1.0) and an integral exponent of two, such that:
|
/// [0.5, 1.0) and an integral exponent of two, such that:
|
||||||
//! x = significand * exp(2, exponent)
|
/// x = significand * exp(2, exponent)
|
||||||
//!
|
///
|
||||||
//! The significand is returned by the function and the
|
/// The significand is returned by the function and the
|
||||||
//! exponent is returned in the parameter exp. For a
|
/// exponent is returned in the parameter exp. For a
|
||||||
//! floating-point value of zero, the significant and exponent
|
/// floating-point value of zero, the significant and exponent
|
||||||
//! are both zero. For a floating-point value that is an
|
/// are both zero. For a floating-point value that is an
|
||||||
//! infinity or is not a number, the results are undefined.
|
/// infinity or is not a number, the results are undefined.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType, typename genIType>
|
template <typename genType, typename genIType>
|
||||||
genType frexp(genType const & x, genIType & exp);
|
genType frexp(genType const & x, genIType & exp);
|
||||||
|
|
||||||
//! Builds a floating-point number from x and the
|
/// Builds a floating-point number from x and the
|
||||||
//! corresponding integral exponent of two in exp, returning:
|
/// corresponding integral exponent of two in exp, returning:
|
||||||
//! significand * exp(2, exponent)
|
/// significand * exp(2, exponent)
|
||||||
//!
|
///
|
||||||
//! If this product is too large to be represented in the
|
/// If this product is too large to be represented in the
|
||||||
//! floating-point type, the result is undefined.
|
/// floating-point type, the result is undefined.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3</a>
|
||||||
template <typename genType, typename genIType>
|
template <typename genType, typename genIType>
|
||||||
|
@ -70,7 +70,7 @@ namespace detail
|
|||||||
return detail::Abs_<genFIType, std::numeric_limits<genFIType>::is_signed>::get(x);
|
return detail::Abs_<genFIType, std::numeric_limits<genFIType>::is_signed>::get(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(abs)
|
VECTORIZE_VEC(abs)
|
||||||
|
|
||||||
// sign
|
// sign
|
||||||
//Try something like based on x >> 31 to get the sign bit
|
//Try something like based on x >> 31 to get the sign bit
|
||||||
@ -94,7 +94,7 @@ namespace detail
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(sign)
|
VECTORIZE_VEC(sign)
|
||||||
|
|
||||||
// floor
|
// floor
|
||||||
template <>
|
template <>
|
||||||
@ -111,7 +111,7 @@ namespace detail
|
|||||||
return ::std::floor(x);
|
return ::std::floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(floor)
|
VECTORIZE_VEC(floor)
|
||||||
|
|
||||||
// trunc
|
// trunc
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -121,7 +121,7 @@ namespace detail
|
|||||||
return x < 0 ? -floor(-x) : floor(x);
|
return x < 0 ? -floor(-x) : floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(trunc)
|
VECTORIZE_VEC(trunc)
|
||||||
|
|
||||||
// round
|
// round
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -134,7 +134,7 @@ namespace detail
|
|||||||
return genType(int(x + genType(0.5)));
|
return genType(int(x + genType(0.5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(round)
|
VECTORIZE_VEC(round)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// roundEven
|
// roundEven
|
||||||
@ -161,7 +161,7 @@ namespace detail
|
|||||||
return genType(int(x + RoundValue));
|
return genType(int(x + RoundValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(roundEven)
|
VECTORIZE_VEC(roundEven)
|
||||||
|
|
||||||
// ceil
|
// ceil
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -172,7 +172,7 @@ namespace detail
|
|||||||
return ::std::ceil(x);
|
return ::std::ceil(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(ceil)
|
VECTORIZE_VEC(ceil)
|
||||||
|
|
||||||
// fract
|
// fract
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -186,7 +186,7 @@ namespace detail
|
|||||||
return x - ::std::floor(x);
|
return x - ::std::floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_1PARAM(fract)
|
VECTORIZE_VEC(fract)
|
||||||
|
|
||||||
// mod
|
// mod
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -201,83 +201,8 @@ namespace detail
|
|||||||
return x - y * floor(x / y);
|
return x - y * floor(x / y);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_SCA(mod)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> mod
|
VECTORIZE_VEC_VEC(mod)
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
typename detail::tvec2<T>::value_type const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
mod(x.x, y),
|
|
||||||
mod(x.y, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> mod
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
typename detail::tvec3<T>::value_type const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
mod(x.x, y),
|
|
||||||
mod(x.y, y),
|
|
||||||
mod(x.z, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> mod
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
typename detail::tvec4<T>::value_type const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
mod(x.x, y),
|
|
||||||
mod(x.y, y),
|
|
||||||
mod(x.z, y),
|
|
||||||
mod(x.w, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> mod
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
detail::tvec2<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
mod(x.x, y.x),
|
|
||||||
mod(x.y, y.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> mod
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
mod(x.x, y.x),
|
|
||||||
mod(x.y, y.y),
|
|
||||||
mod(x.z, y.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> mod
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
mod(x.x, y.x),
|
|
||||||
mod(x.y, y.y),
|
|
||||||
mod(x.z, y.z),
|
|
||||||
mod(x.w, y.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// modf
|
// modf
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -298,39 +223,39 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> modf
|
GLM_FUNC_QUALIFIER detail::tvec2<valType> modf
|
||||||
(
|
(
|
||||||
detail::tvec2<valType> const & x,
|
detail::tvec2<valType> const & x,
|
||||||
detail::tvec2<valType> const & y
|
detail::tvec2<valType> & i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec2<valType>(
|
return detail::tvec2<valType>(
|
||||||
modf(x.x, y.x),
|
modf(x.x, i.x),
|
||||||
modf(x.y, y.y));
|
modf(x.y, i.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> modf
|
GLM_FUNC_QUALIFIER detail::tvec3<valType> modf
|
||||||
(
|
(
|
||||||
detail::tvec3<valType> const & x,
|
detail::tvec3<valType> const & x,
|
||||||
detail::tvec3<valType> const & y
|
detail::tvec3<valType> & i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec3<valType>(
|
return detail::tvec3<valType>(
|
||||||
modf(x.x, y.x),
|
modf(x.x, i.x),
|
||||||
modf(x.y, y.y),
|
modf(x.y, i.y),
|
||||||
modf(x.z, y.z));
|
modf(x.z, i.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> modf
|
GLM_FUNC_QUALIFIER detail::tvec4<valType> modf
|
||||||
(
|
(
|
||||||
detail::tvec4<valType> const & x,
|
detail::tvec4<valType> const & x,
|
||||||
detail::tvec4<valType> const & y
|
detail::tvec4<valType> & i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec4<valType>(
|
return detail::tvec4<valType>(
|
||||||
modf(x.x, y.x),
|
modf(x.x, i.x),
|
||||||
modf(x.y, y.y),
|
modf(x.y, i.y),
|
||||||
modf(x.z, y.z),
|
modf(x.z, i.z),
|
||||||
modf(x.w, y.w));
|
modf(x.w, i.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Only valid if (INT_MIN <= x-y <= INT_MAX)
|
//// Only valid if (INT_MIN <= x-y <= INT_MAX)
|
||||||
@ -357,83 +282,8 @@ namespace detail
|
|||||||
return x < y ? x : y;
|
return x < y ? x : y;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_SCA(min)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> min
|
VECTORIZE_VEC_VEC(min)
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
typename detail::tvec2<T>::value_type const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
min(x.x, y),
|
|
||||||
min(x.y, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> min
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
typename detail::tvec3<T>::value_type const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
min(x.x, y),
|
|
||||||
min(x.y, y),
|
|
||||||
min(x.z, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> min
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
typename detail::tvec4<T>::value_type const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
min(x.x, y),
|
|
||||||
min(x.y, y),
|
|
||||||
min(x.z, y),
|
|
||||||
min(x.w, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> min
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
detail::tvec2<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
min(x.x, y.x),
|
|
||||||
min(x.y, y.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> min
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
min(x.x, y.x),
|
|
||||||
min(x.y, y.y),
|
|
||||||
min(x.z, y.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> min
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
min(x.x, y.x),
|
|
||||||
min(x.y, y.y),
|
|
||||||
min(x.z, y.z),
|
|
||||||
min(x.w, y.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// max
|
// max
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -451,82 +301,8 @@ namespace detail
|
|||||||
return x > y ? x : y;
|
return x > y ? x : y;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_SCA(max)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> max
|
VECTORIZE_VEC_VEC(max)
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
typename detail::tvec2<T>::value_type y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
max(x.x, y),
|
|
||||||
max(x.y, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> max
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
typename detail::tvec3<T>::value_type y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
max(x.x, y),
|
|
||||||
max(x.y, y),
|
|
||||||
max(x.z, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> max
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
typename detail::tvec4<T>::value_type y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
max(x.x, y),
|
|
||||||
max(x.y, y),
|
|
||||||
max(x.z, y),
|
|
||||||
max(x.w, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> max
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
detail::tvec2<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
max(x.x, y.x),
|
|
||||||
max(x.y, y.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> max
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
max(x.x, y.x),
|
|
||||||
max(x.y, y.y),
|
|
||||||
max(x.z, y.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> max
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & y)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
max(x.x, y.x),
|
|
||||||
max(x.y, y.y),
|
|
||||||
max(x.z, y.z),
|
|
||||||
max(x.w, y.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// clamp
|
// clamp
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
|
@ -43,6 +43,9 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns x raised to the y power.
|
/// Returns x raised to the y power.
|
||||||
///
|
///
|
||||||
|
/// @param x pow 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/pow.xml">GLSL pow man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -50,6 +53,9 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the natural exponentiation of x, i.e., e^x.
|
/// Returns the natural exponentiation of x, i.e., e^x.
|
||||||
///
|
///
|
||||||
|
/// @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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -59,6 +65,9 @@ namespace glm
|
|||||||
/// returns the value y which satisfies the equation x = e^y.
|
/// returns the value y which satisfies the equation x = e^y.
|
||||||
/// Results are undefined if x <= 0.
|
/// Results are undefined if x <= 0.
|
||||||
///
|
///
|
||||||
|
/// @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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -66,6 +75,9 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns 2 raised to the x power.
|
/// Returns 2 raised to the x power.
|
||||||
///
|
///
|
||||||
|
/// @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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -74,6 +86,9 @@ namespace glm
|
|||||||
/// Returns the base 2 log of x, i.e., returns the value y,
|
/// Returns the base 2 log of x, i.e., returns the value y,
|
||||||
/// which satisfies the equation x = 2 ^ y.
|
/// which satisfies the equation x = 2 ^ y.
|
||||||
///
|
///
|
||||||
|
/// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -81,6 +96,9 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the positive square root of x.
|
/// Returns the positive square root of x.
|
||||||
///
|
///
|
||||||
|
/// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -88,6 +106,9 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the reciprocal of the positive square root of x.
|
/// Returns the reciprocal of the positive square root of x.
|
||||||
///
|
///
|
||||||
|
/// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "_vectorize.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// pow
|
// pow
|
||||||
@ -41,44 +43,7 @@ namespace glm
|
|||||||
return ::std::pow(x, y);
|
return ::std::pow(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(pow)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> pow
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x,
|
|
||||||
detail::tvec2<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
pow(x.x, y.x),
|
|
||||||
pow(x.y, y.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> pow
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
pow(x.x, y.x),
|
|
||||||
pow(x.y, y.y),
|
|
||||||
pow(x.z, y.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> pow
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
pow(x.x, y.x),
|
|
||||||
pow(x.y, y.y),
|
|
||||||
pow(x.z, y.z),
|
|
||||||
pow(x.w, y.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// exp
|
// exp
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -92,41 +57,7 @@ namespace glm
|
|||||||
return ::std::exp(x);
|
return ::std::exp(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(exp)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> exp
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
exp(x.x),
|
|
||||||
exp(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> exp
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
exp(x.x),
|
|
||||||
exp(x.y),
|
|
||||||
exp(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> exp
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
exp(x.x),
|
|
||||||
exp(x.y),
|
|
||||||
exp(x.z),
|
|
||||||
exp(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// log
|
// log
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -140,41 +71,7 @@ namespace glm
|
|||||||
return ::std::log(x);
|
return ::std::log(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(log)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> log
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
log(x.x),
|
|
||||||
log(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> log
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
log(x.x),
|
|
||||||
log(x.y),
|
|
||||||
log(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> log
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
log(x.x),
|
|
||||||
log(x.y),
|
|
||||||
log(x.z),
|
|
||||||
log(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
//exp2, ln2 = 0.69314718055994530941723212145818f
|
//exp2, ln2 = 0.69314718055994530941723212145818f
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -188,41 +85,7 @@ namespace glm
|
|||||||
return ::std::exp(genType(0.69314718055994530941723212145818) * x);
|
return ::std::exp(genType(0.69314718055994530941723212145818) * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(exp2)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> exp2
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
exp2(x.x),
|
|
||||||
exp2(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> exp2
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
exp2(x.x),
|
|
||||||
exp2(x.y),
|
|
||||||
exp2(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> exp2
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
exp2(x.x),
|
|
||||||
exp2(x.y),
|
|
||||||
exp2(x.z),
|
|
||||||
exp2(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@ -255,44 +118,11 @@ namespace detail
|
|||||||
genType const & x
|
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);
|
return detail::compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(log2)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> log2
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
log2(x.x),
|
|
||||||
log2(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> log2
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
log2(x.x),
|
|
||||||
log2(x.y),
|
|
||||||
log2(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> log2
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
log2(x.x),
|
|
||||||
log2(x.y),
|
|
||||||
log2(x.z),
|
|
||||||
log2(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// sqrt
|
// sqrt
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -306,41 +136,7 @@ namespace detail
|
|||||||
return genType(::std::sqrt(x));
|
return genType(::std::sqrt(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(sqrt)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> sqrt
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
glm::sqrt(x.x),
|
|
||||||
glm::sqrt(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> sqrt
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
glm::sqrt(x.x),
|
|
||||||
glm::sqrt(x.y),
|
|
||||||
glm::sqrt(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> sqrt
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
glm::sqrt(x.x),
|
|
||||||
glm::sqrt(x.y),
|
|
||||||
glm::sqrt(x.z),
|
|
||||||
glm::sqrt(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType inversesqrt
|
GLM_FUNC_QUALIFIER genType inversesqrt
|
||||||
@ -353,40 +149,6 @@ namespace detail
|
|||||||
return genType(1) / ::std::sqrt(x);
|
return genType(1) / ::std::sqrt(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(inversesqrt)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> inversesqrt
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
inversesqrt(x.x),
|
|
||||||
inversesqrt(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> inversesqrt
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
inversesqrt(x.x),
|
|
||||||
inversesqrt(x.y),
|
|
||||||
inversesqrt(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> inversesqrt
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
inversesqrt(x.x),
|
|
||||||
inversesqrt(x.y),
|
|
||||||
inversesqrt(x.z),
|
|
||||||
inversesqrt(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -43,6 +43,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the length of x, i.e., sqrt(x * x).
|
/// Returns the length of x, i.e., sqrt(x * x).
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -51,6 +53,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -60,6 +64,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -69,12 +75,14 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the cross product of x and y.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename T>
|
template <typename valType>
|
||||||
detail::tvec3<T> cross(
|
detail::tvec3<valType> cross(
|
||||||
detail::tvec3<T> const & x,
|
detail::tvec3<valType> const & x,
|
||||||
detail::tvec3<T> const & y);
|
detail::tvec3<valType> const & y);
|
||||||
|
|
||||||
/// Returns a vector in the same direction as x but with length of 1.
|
/// Returns a vector in the same direction as x but with length of 1.
|
||||||
///
|
///
|
||||||
@ -86,6 +94,8 @@ namespace glm
|
|||||||
|
|
||||||
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -97,6 +107,8 @@ namespace glm
|
|||||||
/// For the incident vector I and surface orientation N,
|
/// For the incident vector I and surface orientation N,
|
||||||
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -108,6 +120,8 @@ namespace glm
|
|||||||
/// and the ratio of indices of refraction eta,
|
/// and the ratio of indices of refraction eta,
|
||||||
/// return the refraction vector.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "_vectorize.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// length
|
// length
|
||||||
|
@ -43,10 +43,12 @@ namespace glm
|
|||||||
/// @addtogroup core_func_integer
|
/// @addtogroup core_func_integer
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
//! Adds 32-bit unsigned integer x and y, returning the sum
|
/// Adds 32-bit unsigned integer x and y, returning the sum
|
||||||
//! modulo pow(2, 32). The value carry is set to 0 if the sum was
|
/// modulo pow(2, 32). The value carry is set to 0 if the sum was
|
||||||
//! less than pow(2, 32), or to 1 otherwise.
|
/// less than pow(2, 32), or to 1 otherwise.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genUType Unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genUType>
|
template <typename genUType>
|
||||||
@ -55,10 +57,12 @@ namespace glm
|
|||||||
genUType const & y,
|
genUType const & y,
|
||||||
genUType & carry);
|
genUType & carry);
|
||||||
|
|
||||||
//! Subtracts the 32-bit unsigned integer y from x, returning
|
/// Subtracts the 32-bit unsigned integer y from x, returning
|
||||||
//! the difference if non-negative, or pow(2, 32) plus the difference
|
/// the difference if non-negative, or pow(2, 32) plus the difference
|
||||||
//! otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise.
|
/// otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genUType Unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genUType>
|
template <typename genUType>
|
||||||
@ -67,10 +71,12 @@ namespace glm
|
|||||||
genUType const & y,
|
genUType const & y,
|
||||||
genUType & borrow);
|
genUType & borrow);
|
||||||
|
|
||||||
//! Multiplies 32-bit integers x and y, producing a 64-bit
|
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||||
//! result. The 32 least-significant bits are returned in lsb.
|
/// result. The 32 least-significant bits are returned in lsb.
|
||||||
//! The 32 most-significant bits are returned in msb.
|
/// The 32 most-significant bits are returned in msb.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genUType Unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genUType>
|
template <typename genUType>
|
||||||
@ -80,10 +86,12 @@ namespace glm
|
|||||||
genUType & msb,
|
genUType & msb,
|
||||||
genUType & lsb);
|
genUType & lsb);
|
||||||
|
|
||||||
//! Multiplies 32-bit integers x and y, producing a 64-bit
|
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||||
//! result. The 32 least-significant bits are returned in lsb.
|
/// result. The 32 least-significant bits are returned in lsb.
|
||||||
//! The 32 most-significant bits are returned in msb.
|
/// The 32 most-significant bits are returned in msb.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genIType Signed integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genIType>
|
template <typename genIType>
|
||||||
@ -93,17 +101,19 @@ namespace glm
|
|||||||
genIType & msb,
|
genIType & msb,
|
||||||
genIType & lsb);
|
genIType & lsb);
|
||||||
|
|
||||||
//! Extracts bits [offset, offset + bits - 1] from value,
|
/// Extracts bits [offset, offset + bits - 1] from value,
|
||||||
//! returning them in the least significant bits of the result.
|
/// returning them in the least significant bits of the result.
|
||||||
//! For unsigned data types, the most significant bits of the
|
/// For unsigned data types, the most significant bits of the
|
||||||
//! result will be set to zero. For signed data types, the
|
/// result will be set to zero. For signed data types, the
|
||||||
//! most significant bits will be set to the value of bit offset + base – 1.
|
/// most significant bits will be set to the value of bit offset + base – 1.
|
||||||
//!
|
///
|
||||||
//! If bits is zero, the result will be zero. The result will be
|
/// If bits is zero, the result will be zero. The result will be
|
||||||
//! undefined if offset or bits is negative, or if the sum of
|
/// undefined if offset or bits is negative, or if the sum of
|
||||||
//! offset and bits is greater than the number of bits used
|
/// offset and bits is greater than the number of bits used
|
||||||
//! to store the operand.
|
/// to store the operand.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genIUType>
|
template <typename genIUType>
|
||||||
@ -112,16 +122,18 @@ namespace glm
|
|||||||
int const & Offset,
|
int const & Offset,
|
||||||
int const & Bits);
|
int const & Bits);
|
||||||
|
|
||||||
//! Returns the insertion the bits least-significant bits of insert into base.
|
/// Returns the insertion the bits least-significant bits of insert into base.
|
||||||
//!
|
///
|
||||||
//! The result will have bits [offset, offset + bits - 1] taken
|
/// The result will have bits [offset, offset + bits - 1] taken
|
||||||
//! from bits [0, bits – 1] of insert, and all other bits taken
|
/// from bits [0, bits – 1] of insert, and all other bits taken
|
||||||
//! directly from the corresponding bits of base. If bits is
|
/// directly from the corresponding bits of base. If bits is
|
||||||
//! zero, the result will simply be base. The result will be
|
/// zero, the result will simply be base. The result will be
|
||||||
//! undefined if offset or bits is negative, or if the sum of
|
/// undefined if offset or bits is negative, or if the sum of
|
||||||
//! offset and bits is greater than the number of bits used to
|
/// offset and bits is greater than the number of bits used to
|
||||||
//! store the operand.
|
/// store the operand.
|
||||||
//!
|
///
|
||||||
|
/// @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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genIUType>
|
template <typename genIUType>
|
||||||
@ -131,40 +143,54 @@ namespace glm
|
|||||||
int const & Offset,
|
int const & Offset,
|
||||||
int const & Bits);
|
int const & Bits);
|
||||||
|
|
||||||
//! Returns the reversal of the bits of value.
|
/// Returns the reversal of the bits of value.
|
||||||
//! The bit numbered n of the result will be taken from bit (bits - 1) - n of value,
|
/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,
|
||||||
//! where bits is the total number of bits used to represent value.
|
/// where bits is the total number of bits used to represent value.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename genIUType>
|
template <typename genIUType>
|
||||||
genIUType bitfieldReverse(genIUType const & value);
|
genIUType bitfieldReverse(genIUType const & value);
|
||||||
|
|
||||||
//! Returns the number of bits set to 1 in the binary representation of value.
|
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename T, template <typename> class C>
|
///
|
||||||
typename C<T>::signed_type bitCount(C<T> const & Value);
|
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||||
|
template <typename T, template <typename> class genIUType>
|
||||||
|
typename genIUType<T>::signed_type bitCount(genIUType<T> const & Value);
|
||||||
|
|
||||||
//! Returns the bit number of the least significant bit set to
|
/// Returns the bit number of the least significant bit set to
|
||||||
//! 1 in the binary representation of value.
|
/// 1 in the binary representation of value.
|
||||||
//! If value is zero, -1 will be returned.
|
/// If value is zero, -1 will be returned.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename T, template <typename> class C>
|
///
|
||||||
typename C<T>::signed_type findLSB(C<T> const & Value);
|
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||||
|
template <typename T, template <typename> class genIUType>
|
||||||
|
typename genIUType<T>::signed_type findLSB(genIUType<T> const & Value);
|
||||||
|
|
||||||
//! Returns the bit number of the most significant bit in the binary representation of value.
|
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||||
//! For positive integers, the result will be the bit number of the most significant bit set to 1.
|
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||||
//! For negative integers, the result will be the bit number of the most significant
|
/// For negative integers, the result will be the bit number of the most significant
|
||||||
//! bit set to 0. For a value of zero or negative one, -1 will be returned.
|
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8</a>
|
||||||
template <typename T, template <typename> class C>
|
///
|
||||||
typename C<T>::signed_type findMSB(C<T> const & Value);
|
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||||
|
template <typename T, template <typename> class genIUType>
|
||||||
|
typename genIUType<T>::signed_type findMSB(genIUType<T> const & Value);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "_vectorize.hpp"
|
||||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#pragma intrinsic(_BitScanReverse)
|
#pragma intrinsic(_BitScanReverse)
|
||||||
@ -415,41 +416,7 @@ namespace glm
|
|||||||
return Out;
|
return Out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(bitfieldReverse)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> bitfieldReverse
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
bitfieldReverse(value[0]),
|
|
||||||
bitfieldReverse(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> bitfieldReverse
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
bitfieldReverse(value[0]),
|
|
||||||
bitfieldReverse(value[1]),
|
|
||||||
bitfieldReverse(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> bitfieldReverse
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
bitfieldReverse(value[0]),
|
|
||||||
bitfieldReverse(value[1]),
|
|
||||||
bitfieldReverse(value[2]),
|
|
||||||
bitfieldReverse(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// bitCount
|
// bitCount
|
||||||
template <typename genIUType>
|
template <typename genIUType>
|
||||||
|
@ -48,6 +48,8 @@ namespace glm
|
|||||||
/// Multiply matrix x by matrix y component-wise, i.e.,
|
/// Multiply matrix x by matrix y component-wise, i.e.,
|
||||||
/// result[i][j] is the scalar product of x[i][j] and y[i][j].
|
/// result[i][j] is the scalar product of x[i][j] and y[i][j].
|
||||||
///
|
///
|
||||||
|
/// @tparam matType Floating-point matrix types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename matType>
|
template <typename matType>
|
||||||
@ -59,8 +61,12 @@ namespace glm
|
|||||||
/// and the second parameter r as a row vector
|
/// and the second parameter r as a row vector
|
||||||
/// and does a linear algebraic matrix multiply c * r.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</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(
|
matType outerProduct(
|
||||||
vecType const & c,
|
vecType const & c,
|
||||||
@ -68,6 +74,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns the transposed matrix of x
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename matType>
|
template <typename matType>
|
||||||
@ -76,51 +84,63 @@ namespace glm
|
|||||||
|
|
||||||
/// Return the determinant of a mat2 matrix.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename T>
|
template <typename valType>
|
||||||
typename detail::tmat2x2<T>::value_type determinant(
|
typename detail::tmat2x2<valType>::value_type determinant(
|
||||||
detail::tmat2x2<T> const & m);
|
detail::tmat2x2<valType> const & m);
|
||||||
|
|
||||||
/// Return the determinant of a mat3 matrix.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename T>
|
template <typename valType>
|
||||||
typename detail::tmat3x3<T>::value_type determinant(
|
typename detail::tmat3x3<valType>::value_type determinant(
|
||||||
detail::tmat3x3<T> const & m);
|
detail::tmat3x3<valType> const & m);
|
||||||
|
|
||||||
/// Return the determinant of a mat4 matrix.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename T>
|
template <typename valType>
|
||||||
typename detail::tmat4x4<T>::value_type determinant(
|
typename detail::tmat4x4<valType>::value_type determinant(
|
||||||
detail::tmat4x4<T> const & m);
|
detail::tmat4x4<valType> const & m);
|
||||||
|
|
||||||
/// Return the inverse of a mat2 matrix.
|
/// Return the inverse of a mat2 matrix.
|
||||||
///
|
///
|
||||||
|
/// @tparam valType Floating-point scalar types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename T>
|
template <typename valType>
|
||||||
detail::tmat2x2<T> inverse(
|
detail::tmat2x2<valType> inverse(
|
||||||
detail::tmat2x2<T> const & m);
|
detail::tmat2x2<valType> const & m);
|
||||||
|
|
||||||
/// Return the inverse of a mat3 matrix.
|
/// Return the inverse of a mat3 matrix.
|
||||||
///
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
/// @tparam valType Floating-point scalar types.
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
|
||||||
template <typename T>
|
|
||||||
detail::tmat3x3<T> inverse(
|
|
||||||
detail::tmat3x3<T> const & m);
|
|
||||||
|
|
||||||
/// Return the inverse of a mat4 matrix.
|
|
||||||
///
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6</a>
|
||||||
template <typename T>
|
template <typename valType>
|
||||||
detail::tmat4x4<T> inverse(
|
detail::tmat3x3<valType> inverse(
|
||||||
detail::tmat4x4<T> const & m);
|
detail::tmat3x3<valType> const & m);
|
||||||
|
|
||||||
|
/// 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</a>
|
||||||
|
template <typename valType>
|
||||||
|
detail::tmat4x4<valType> inverse(
|
||||||
|
detail::tmat4x4<valType> const & m);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "_vectorize.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// matrixCompMult
|
// matrixCompMult
|
||||||
|
@ -45,6 +45,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns a 1D noise value based on the input value x.
|
/// Returns a 1D noise value based on the input value x.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -52,6 +54,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns a 2D noise value based on the input value x.
|
/// Returns a 2D noise value based on the input value x.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -59,6 +63,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns a 3D noise value based on the input value x.
|
/// Returns a 3D noise value based on the input value x.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -66,6 +72,8 @@ namespace glm
|
|||||||
|
|
||||||
/// Returns a 4D noise value based on the input value x.
|
/// Returns a 4D noise value based on the input value x.
|
||||||
///
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v)
|
GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v)
|
||||||
{
|
{
|
||||||
detail::uint16 A(detail::uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f)));
|
detail::uint16 A(detail::uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f)));
|
||||||
@ -155,5 +155,4 @@ GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
|
|||||||
detail::tvec2<detail::hdata> Unpack = *(detail::tvec2<detail::hdata>*)&v;
|
detail::tvec2<detail::hdata> Unpack = *(detail::tvec2<detail::hdata>*)&v;
|
||||||
return vec2(detail::toFloat32(Unpack.x), detail::toFloat32(Unpack.y));
|
return vec2(detail::toFloat32(Unpack.x), detail::toFloat32(Unpack.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -45,119 +45,149 @@ namespace glm
|
|||||||
/// @addtogroup core_func_trigonometric
|
/// @addtogroup core_func_trigonometric
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
//! Converts degrees to radians and returns the result.
|
/// 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/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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType radians(genType const & degrees);
|
genType radians(genType const & degrees);
|
||||||
|
|
||||||
//! Converts radians to degrees and returns the result.
|
/// Converts radians to degrees and returns the result.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType degrees(genType const & radians);
|
genType degrees(genType const & radians);
|
||||||
|
|
||||||
//! The standard trigonometric sine function.
|
/// The standard trigonometric sine function.
|
||||||
//! The values returned by this function will range from [-1, 1].
|
/// The values returned by this function will range from [-1, 1].
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType sin(genType const & angle);
|
genType sin(genType const & angle);
|
||||||
|
|
||||||
//! The standard trigonometric cosine function.
|
/// The standard trigonometric cosine function.
|
||||||
//! The values returned by this function will range from [-1, 1].
|
/// The values returned by this function will range from [-1, 1].
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType cos(genType const & angle);
|
genType cos(genType const & angle);
|
||||||
|
|
||||||
//! The standard trigonometric tangent function.
|
/// The standard trigonometric tangent function.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType tan(genType const & angle);
|
genType tan(genType const & angle);
|
||||||
|
|
||||||
//! Arc sine. Returns an angle whose sine is x.
|
/// Arc sine. Returns an angle whose sine is x.
|
||||||
//! The range of values returned by this function is [-PI/2, PI/2].
|
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||||
//! Results are undefined if |x| > 1.
|
/// Results are undefined if |x| > 1.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType asin(genType const & x);
|
genType asin(genType const & x);
|
||||||
|
|
||||||
//! Arc cosine. Returns an angle whose sine is x.
|
/// Arc cosine. Returns an angle whose sine is x.
|
||||||
//! The range of values returned by this function is [0, PI].
|
/// The range of values returned by this function is [0, PI].
|
||||||
//! Results are undefined if |x| > 1.
|
/// Results are undefined if |x| > 1.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType acos(genType const & x);
|
genType acos(genType const & x);
|
||||||
|
|
||||||
//! Arc tangent. Returns an angle whose tangent is y/x.
|
/// Arc tangent. Returns an angle whose tangent is y/x.
|
||||||
//! The signs of x and y are used to determine what
|
/// The signs of x and y are used to determine what
|
||||||
//! quadrant the angle is in. The range of values returned
|
/// quadrant the angle is in. The range of values returned
|
||||||
//! by this function is [-PI, PI]. Results are undefined
|
/// by this function is [-PI, PI]. Results are undefined
|
||||||
//! if x and y are both 0.
|
/// if x and y are both 0.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType atan(genType const & y, genType const & x);
|
genType atan(genType const & y, genType const & x);
|
||||||
|
|
||||||
//! Arc tangent. Returns an angle whose tangent is y_over_x.
|
/// Arc tangent. Returns an angle whose tangent is y_over_x.
|
||||||
//! The range of values returned by this function is [-PI/2, PI/2].
|
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @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</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType atan(genType const & y_over_x);
|
genType atan(genType const & y_over_x);
|
||||||
|
|
||||||
//! Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType sinh(genType const & angle);
|
genType sinh(genType const & angle);
|
||||||
|
|
||||||
//! Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType cosh(genType const & angle);
|
genType cosh(genType const & angle);
|
||||||
|
|
||||||
//! Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType tanh(genType const & angle);
|
genType tanh(genType const & angle);
|
||||||
|
|
||||||
//! Arc hyperbolic sine; returns the inverse of sinh.
|
/// Arc hyperbolic sine; returns the inverse of sinh.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType asinh(genType const & x);
|
genType asinh(genType const & x);
|
||||||
|
|
||||||
//! Arc hyperbolic cosine; returns the non-negative inverse
|
/// Arc hyperbolic cosine; returns the non-negative inverse
|
||||||
//! of cosh. Results are undefined if x < 1.
|
/// of cosh. Results are undefined if x < 1.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType acosh(genType const & x);
|
genType acosh(genType const & x);
|
||||||
|
|
||||||
//! Arc hyperbolic tangent; returns the inverse of tanh.
|
/// Arc hyperbolic tangent; returns the inverse of tanh.
|
||||||
//! Results are undefined if abs(x) >= 1.
|
/// Results are undefined if abs(x) >= 1.
|
||||||
//!
|
///
|
||||||
|
/// @tparam genType Floating-point scalar or vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1</a>
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
|
@ -26,8 +26,10 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
// radians
|
// radians
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType radians
|
GLM_FUNC_QUALIFIER genType radians
|
||||||
@ -37,45 +39,11 @@ GLM_FUNC_QUALIFIER genType radians
|
|||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'radians' only accept floating-point input");
|
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'radians' only accept floating-point input");
|
||||||
|
|
||||||
const genType pi = genType(3.1415926535897932384626433832795);
|
genType const pi = genType(3.1415926535897932384626433832795);
|
||||||
return degrees * (pi / genType(180));
|
return degrees * (pi / genType(180));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(radians)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> radians
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & degrees
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
radians(degrees.x),
|
|
||||||
radians(degrees.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> radians
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & degrees
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
radians(degrees.x),
|
|
||||||
radians(degrees.y),
|
|
||||||
radians(degrees.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> radians
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & degrees
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
radians(degrees.x),
|
|
||||||
radians(degrees.y),
|
|
||||||
radians(degrees.z),
|
|
||||||
radians(degrees.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// degrees
|
// degrees
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -90,41 +58,7 @@ GLM_FUNC_QUALIFIER genType degrees
|
|||||||
return radians * (genType(180) / pi);
|
return radians * (genType(180) / pi);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(degrees)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> degrees
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & radians
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
degrees(radians.x),
|
|
||||||
degrees(radians.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> degrees
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & radians
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
degrees(radians.x),
|
|
||||||
degrees(radians.y),
|
|
||||||
degrees(radians.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> degrees
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & radians
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
degrees(radians.x),
|
|
||||||
degrees(radians.y),
|
|
||||||
degrees(radians.z),
|
|
||||||
degrees(radians.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// sin
|
// sin
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -138,41 +72,7 @@ GLM_FUNC_QUALIFIER genType sin
|
|||||||
return ::std::sin(angle);
|
return ::std::sin(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(sin)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> sin
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
sin(angle.x),
|
|
||||||
sin(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> sin
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
sin(angle.x),
|
|
||||||
sin(angle.y),
|
|
||||||
sin(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> sin
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
sin(angle.x),
|
|
||||||
sin(angle.y),
|
|
||||||
sin(angle.z),
|
|
||||||
sin(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// cos
|
// cos
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -183,41 +83,7 @@ GLM_FUNC_QUALIFIER genType cos(genType const & angle)
|
|||||||
return ::std::cos(angle);
|
return ::std::cos(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(cos)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> cos
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
cos(angle.x),
|
|
||||||
cos(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> cos
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
cos(angle.x),
|
|
||||||
cos(angle.y),
|
|
||||||
cos(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> cos
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
cos(angle.x),
|
|
||||||
cos(angle.y),
|
|
||||||
cos(angle.z),
|
|
||||||
cos(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// tan
|
// tan
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -231,41 +97,7 @@ GLM_FUNC_QUALIFIER genType tan
|
|||||||
return ::std::tan(angle);
|
return ::std::tan(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(tan)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> tan
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
tan(angle.x),
|
|
||||||
tan(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> tan
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
tan(angle.x),
|
|
||||||
tan(angle.y),
|
|
||||||
tan(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> tan
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
tan(angle.x),
|
|
||||||
tan(angle.y),
|
|
||||||
tan(angle.z),
|
|
||||||
tan(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// asin
|
// asin
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -279,41 +111,7 @@ GLM_FUNC_QUALIFIER genType asin
|
|||||||
return ::std::asin(x);
|
return ::std::asin(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(asin)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> asin
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
asin(x.x),
|
|
||||||
asin(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> asin
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
asin(x.x),
|
|
||||||
asin(x.y),
|
|
||||||
asin(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> asin
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
asin(x.x),
|
|
||||||
asin(x.y),
|
|
||||||
asin(x.z),
|
|
||||||
asin(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acos
|
// acos
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -327,41 +125,7 @@ GLM_FUNC_QUALIFIER genType acos
|
|||||||
return ::std::acos(x);
|
return ::std::acos(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(acos)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> acos
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
acos(x.x),
|
|
||||||
acos(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> acos
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
acos(x.x),
|
|
||||||
acos(x.y),
|
|
||||||
acos(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> acos
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
acos(x.x),
|
|
||||||
acos(x.y),
|
|
||||||
acos(x.z),
|
|
||||||
acos(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// atan
|
// atan
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -376,44 +140,7 @@ GLM_FUNC_QUALIFIER genType atan
|
|||||||
return ::std::atan2(y, x);
|
return ::std::atan2(y, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(atan)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> atan
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & y,
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
atan(y.x, x.x),
|
|
||||||
atan(y.y, x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> atan
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & y,
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
atan(y.x, x.x),
|
|
||||||
atan(y.y, x.y),
|
|
||||||
atan(y.z, x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> atan
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & y,
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
atan(y.x, x.x),
|
|
||||||
atan(y.y, x.y),
|
|
||||||
atan(y.z, x.z),
|
|
||||||
atan(y.w, x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType atan
|
GLM_FUNC_QUALIFIER genType atan
|
||||||
@ -426,41 +153,7 @@ GLM_FUNC_QUALIFIER genType atan
|
|||||||
return ::std::atan(x);
|
return ::std::atan(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(atan)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> atan
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
atan(x.x),
|
|
||||||
atan(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> atan
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
atan(x.x),
|
|
||||||
atan(x.y),
|
|
||||||
atan(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> atan
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
atan(x.x),
|
|
||||||
atan(x.y),
|
|
||||||
atan(x.z),
|
|
||||||
atan(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// sinh
|
// sinh
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -474,41 +167,7 @@ GLM_FUNC_QUALIFIER genType sinh
|
|||||||
return std::sinh(angle);
|
return std::sinh(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(sinh)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> sinh
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
sinh(angle.x),
|
|
||||||
sinh(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> sinh
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
sinh(angle.x),
|
|
||||||
sinh(angle.y),
|
|
||||||
sinh(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> sinh
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
sinh(angle.x),
|
|
||||||
sinh(angle.y),
|
|
||||||
sinh(angle.z),
|
|
||||||
sinh(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// cosh
|
// cosh
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -522,41 +181,7 @@ GLM_FUNC_QUALIFIER genType cosh
|
|||||||
return std::cosh(angle);
|
return std::cosh(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(cosh)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> cosh
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
cosh(angle.x),
|
|
||||||
cosh(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> cosh
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
cosh(angle.x),
|
|
||||||
cosh(angle.y),
|
|
||||||
cosh(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> cosh
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
cosh(angle.x),
|
|
||||||
cosh(angle.y),
|
|
||||||
cosh(angle.z),
|
|
||||||
cosh(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// tanh
|
// tanh
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -570,41 +195,7 @@ GLM_FUNC_QUALIFIER genType tanh
|
|||||||
return std::tanh(angle);
|
return std::tanh(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(tanh)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> tanh
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
tanh(angle.x),
|
|
||||||
tanh(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> tanh
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
tanh(angle.x),
|
|
||||||
tanh(angle.y),
|
|
||||||
tanh(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> tanh
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
tanh(angle.x),
|
|
||||||
tanh(angle.y),
|
|
||||||
tanh(angle.z),
|
|
||||||
tanh(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// asinh
|
// asinh
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -618,41 +209,7 @@ GLM_FUNC_QUALIFIER genType asinh
|
|||||||
return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x));
|
return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(asinh)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> asinh
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
asinh(x.x),
|
|
||||||
asinh(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> asinh
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
asinh(x.x),
|
|
||||||
asinh(x.y),
|
|
||||||
asinh(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> asinh
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
asinh(x.x),
|
|
||||||
asinh(x.y),
|
|
||||||
asinh(x.z),
|
|
||||||
asinh(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acosh
|
// acosh
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -668,41 +225,7 @@ GLM_FUNC_QUALIFIER genType acosh
|
|||||||
return log(x + sqrt(x * x - genType(1)));
|
return log(x + sqrt(x * x - genType(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(acosh)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> acosh
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
acosh(x.x),
|
|
||||||
acosh(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> acosh
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
acosh(x.x),
|
|
||||||
acosh(x.y),
|
|
||||||
acosh(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> acosh
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
acosh(x.x),
|
|
||||||
acosh(x.y),
|
|
||||||
acosh(x.z),
|
|
||||||
acosh(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// atanh
|
// atanh
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -718,40 +241,6 @@ GLM_FUNC_QUALIFIER genType atanh
|
|||||||
return genType(0.5) * log((genType(1) + x) / (genType(1) - x));
|
return genType(0.5) * log((genType(1) + x) / (genType(1) - x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(atanh)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> atanh
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
atanh(x.x),
|
|
||||||
atanh(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> atanh
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
atanh(x.x),
|
|
||||||
atanh(x.y),
|
|
||||||
atanh(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> atanh
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
atanh(x.x),
|
|
||||||
atanh(x.y),
|
|
||||||
atanh(x.z),
|
|
||||||
atanh(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -48,65 +48,83 @@ namespace glm
|
|||||||
/// @addtogroup core_func_vector_relational
|
/// @addtogroup core_func_vector_relational
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
//! Returns the component-wise comparison result of x < y.
|
/// Returns the component-wise comparison result of x < y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Floating-point or integer vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
//template <typename T, template <typename> class vecType>
|
template <typename vecType>
|
||||||
//GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThan(vecType<T> const & x, vecType<T> const & y);
|
GLM_FUNC_QUALIFIER typename vecType::bool_type lessThan(vecType const & x, vecType const & y);
|
||||||
|
|
||||||
//! Returns the component-wise comparison of result x <= y.
|
/// Returns the component-wise comparison of result x <= y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Floating-point or integer vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <typename T, template <typename> class vecType>
|
template <typename T, template <typename> class vecType>
|
||||||
GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThanEqual(vecType<T> const & x, vecType<T> const & y);
|
GLM_FUNC_QUALIFIER typename vecType<T>::bool_type lessThanEqual(vecType<T> const & x, vecType<T> const & y);
|
||||||
|
|
||||||
//! Returns the component-wise comparison of result x > y.
|
/// Returns the component-wise comparison of result x > y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Floating-point or integer vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <typename T, template <typename> class vecType>
|
template <typename T, template <typename> class vecType>
|
||||||
GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThan(vecType<T> const & x, vecType<T> const & y);
|
GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThan(vecType<T> const & x, vecType<T> const & y);
|
||||||
|
|
||||||
//! Returns the component-wise comparison of result x >= y.
|
/// Returns the component-wise comparison of result x >= y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Floating-point or integer vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <typename T, template <typename> class vecType>
|
template <typename T, template <typename> class vecType>
|
||||||
typename vecType<T>::bool_type greaterThanEqual(vecType<T> const & x, vecType<T> const & y);
|
typename vecType<T>::bool_type greaterThanEqual(vecType<T> const & x, vecType<T> const & y);
|
||||||
|
|
||||||
//! Returns the component-wise comparison of result x == y.
|
/// Returns the component-wise comparison of result x == y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Floating-point, integer or boolean vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
//template <typename T, template <typename> class vecType>
|
template <typename T, template <typename> class vecType>
|
||||||
//GLM_FUNC_QUALIFIER typename vecType<T>::bool_type equal(vecType<T> const & x, vecType<T> const & y);
|
GLM_FUNC_QUALIFIER typename vecType<T>::bool_type equal(vecType<T> const & x, vecType<T> const & y);
|
||||||
|
|
||||||
//! Returns the component-wise comparison of result x != y.
|
/// Returns the component-wise comparison of result x != y.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Floating-point, integer or boolean vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <typename T, template <typename> class vecType>
|
template <typename T, template <typename> class vecType>
|
||||||
typename vecType<T>::bool_type notEqual(vecType<T> const & x, vecType<T> const & y);
|
typename vecType<T>::bool_type notEqual(vecType<T> const & x, vecType<T> const & y);
|
||||||
|
|
||||||
//! Returns true if any component of x is true.
|
/// Returns true if any component of x is true.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Boolean vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <template <typename> class vecType>
|
template <template <typename> class vecType>
|
||||||
bool any(vecType<bool> const & v);
|
bool any(vecType<bool> const & v);
|
||||||
|
|
||||||
//! Returns true if all components of x are true.
|
/// Returns true if all components of x are true.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Boolean vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <template <typename> class vecType>
|
template <template <typename> class vecType>
|
||||||
bool all(vecType<bool> const & v);
|
bool all(vecType<bool> const & v);
|
||||||
|
|
||||||
//! Returns the component-wise logical complement of x.
|
/// Returns the component-wise logical complement of x.
|
||||||
//! /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
|
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
|
||||||
//!
|
///
|
||||||
|
/// @tparam vecType Boolean vector types.
|
||||||
|
///
|
||||||
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
|
/// @see - <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
|
||||||
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
/// @see - <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7</a>
|
||||||
template <template <typename> class vecType>
|
template <template <typename> class vecType>
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail{
|
namespace detail
|
||||||
|
{
|
||||||
#if 0//ndef _MSC_EXTENSIONS
|
#ifndef _MSC_EXTENSIONS
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// hvec2
|
// hvec2
|
||||||
@ -514,494 +514,6 @@ GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator-=
|
|||||||
(
|
(
|
||||||
tvec3<thalf> const & v
|
tvec3<thalf> const & v
|
||||||
)
|
)
|
||||||
{
|
|
||||||
this->x -= v.x;
|
|
||||||
this->y -= v.y;
|
|
||||||
this->z -= v.z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator*=
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x *= s;
|
|
||||||
this->y *= s;
|
|
||||||
this->z *= s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator*=
|
|
||||||
(
|
|
||||||
tvec3<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x *= v.x;
|
|
||||||
this->y *= v.y;
|
|
||||||
this->z *= v.z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator/=
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x /= s;
|
|
||||||
this->y /= s;
|
|
||||||
this->z /= s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator/=
|
|
||||||
(
|
|
||||||
tvec3<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x /= v.x;
|
|
||||||
this->y /= v.y;
|
|
||||||
this->z /= v.z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator++()
|
|
||||||
{
|
|
||||||
++this->x;
|
|
||||||
++this->y;
|
|
||||||
++this->z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator--()
|
|
||||||
{
|
|
||||||
--this->x;
|
|
||||||
--this->y;
|
|
||||||
--this->z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Swizzle operators
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER thalf tvec3<thalf>::swizzle(comp x) const
|
|
||||||
{
|
|
||||||
return (*this)[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec2<thalf> tvec3<thalf>::swizzle(comp x, comp y) const
|
|
||||||
{
|
|
||||||
return tvec2<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z) const
|
|
||||||
{
|
|
||||||
return tvec3<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y],
|
|
||||||
(*this)[z]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z, comp w) const
|
|
||||||
{
|
|
||||||
return tvec4<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y],
|
|
||||||
(*this)[z],
|
|
||||||
(*this)[w]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tref3<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z)
|
|
||||||
{
|
|
||||||
return tref3<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y],
|
|
||||||
(*this)[z]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// hvec4
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::size_type tvec4<thalf>::length() const
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::size_type tvec4<thalf>::value_size()
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Accesses
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER thalf & tvec4<thalf>::operator[]
|
|
||||||
(
|
|
||||||
tvec4<thalf>::size_type i
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(/*i >= tvec4<thalf>::size_type(0) && */i < tvec4<thalf>::value_size());
|
|
||||||
|
|
||||||
return (&x)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER thalf const & tvec4<thalf>::operator[]
|
|
||||||
(
|
|
||||||
tvec4<thalf>::size_type i
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
assert(/*i >= tvec4<thalf>::size_type(0) && */i < tvec4<thalf>::value_size());
|
|
||||||
|
|
||||||
return (&x)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Implicit basic constructors
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4() :
|
|
||||||
x(thalf(0)),
|
|
||||||
y(thalf(0)),
|
|
||||||
z(thalf(0)),
|
|
||||||
w(thalf(0))
|
|
||||||
{}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
tvec4<thalf> const & v
|
|
||||||
) :
|
|
||||||
x(v.x),
|
|
||||||
y(v.y),
|
|
||||||
z(v.z),
|
|
||||||
w(v.w)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Explicit basic constructors
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
) :
|
|
||||||
x(s),
|
|
||||||
y(s),
|
|
||||||
z(s),
|
|
||||||
w(s)
|
|
||||||
{}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
thalf const & s1,
|
|
||||||
thalf const & s2,
|
|
||||||
thalf const & s3,
|
|
||||||
thalf const & s4
|
|
||||||
) :
|
|
||||||
x(s1),
|
|
||||||
y(s2),
|
|
||||||
z(s3),
|
|
||||||
w(s4)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Swizzle constructors
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
tref4<thalf> const & r
|
|
||||||
) :
|
|
||||||
x(r.x),
|
|
||||||
y(r.y),
|
|
||||||
z(r.z),
|
|
||||||
w(r.w)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Convertion scalar constructors
|
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
U const & x
|
|
||||||
) :
|
|
||||||
x(thalf(x)),
|
|
||||||
y(thalf(x)),
|
|
||||||
z(thalf(x)),
|
|
||||||
w(thalf(x))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename A, typename B, typename C, typename D>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
A const & x,
|
|
||||||
B const & y,
|
|
||||||
C const & z,
|
|
||||||
D const & w
|
|
||||||
) :
|
|
||||||
x(thalf(x)),
|
|
||||||
y(thalf(y)),
|
|
||||||
z(thalf(z)),
|
|
||||||
w(thalf(w))
|
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Convertion vector constructors
|
|
||||||
|
|
||||||
template <typename A, typename B, typename C>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
tvec2<A> const & v,
|
|
||||||
B const & s1,
|
|
||||||
C const & s2
|
|
||||||
) :
|
|
||||||
x(thalf(v.x)),
|
|
||||||
y(thalf(v.y)),
|
|
||||||
z(thalf(s1)),
|
|
||||||
w(thalf(s2))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename A, typename B, typename C>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
A const & s1,
|
|
||||||
tvec2<B> const & v,
|
|
||||||
C const & s2
|
|
||||||
) :
|
|
||||||
x(thalf(s1)),
|
|
||||||
y(thalf(v.x)),
|
|
||||||
z(thalf(v.y)),
|
|
||||||
w(thalf(s2))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename A, typename B, typename C>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
A const & s1,
|
|
||||||
B const & s2,
|
|
||||||
tvec2<C> const & v
|
|
||||||
) :
|
|
||||||
x(thalf(s1)),
|
|
||||||
y(thalf(s2)),
|
|
||||||
z(thalf(v.x)),
|
|
||||||
w(thalf(v.y))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename A, typename B>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
tvec3<A> const & v,
|
|
||||||
B const & s
|
|
||||||
) :
|
|
||||||
x(thalf(v.x)),
|
|
||||||
y(thalf(v.y)),
|
|
||||||
z(thalf(v.z)),
|
|
||||||
w(thalf(s))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename A, typename B>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
A const & s,
|
|
||||||
tvec3<B> const & v
|
|
||||||
) :
|
|
||||||
x(thalf(s)),
|
|
||||||
y(thalf(v.x)),
|
|
||||||
z(thalf(v.y)),
|
|
||||||
w(thalf(v.z))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename A, typename B>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
tvec2<A> const & v1,
|
|
||||||
tvec2<B> const & v2
|
|
||||||
) :
|
|
||||||
x(thalf(v1.x)),
|
|
||||||
y(thalf(v1.y)),
|
|
||||||
z(thalf(v2.x)),
|
|
||||||
w(thalf(v2.y))
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
|
||||||
(
|
|
||||||
tvec4<U> const & v
|
|
||||||
) :
|
|
||||||
x(thalf(v.x)),
|
|
||||||
y(thalf(v.y)),
|
|
||||||
z(thalf(v.z)),
|
|
||||||
w(thalf(v.w))
|
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Unary arithmetic operators
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator=
|
|
||||||
(
|
|
||||||
tvec4<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x = v.x;
|
|
||||||
this->y = v.y;
|
|
||||||
this->z = v.z;
|
|
||||||
this->w = v.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator+=
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x += s;
|
|
||||||
this->y += s;
|
|
||||||
this->z += s;
|
|
||||||
this->w += s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator+=
|
|
||||||
(
|
|
||||||
tvec4<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x += v.x;
|
|
||||||
this->y += v.y;
|
|
||||||
this->z += v.z;
|
|
||||||
this->w += v.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator-=
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x -= s;
|
|
||||||
this->y -= s;
|
|
||||||
this->z -= s;
|
|
||||||
this->w -= s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator-=
|
|
||||||
(
|
|
||||||
tvec4<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x -= v.x;
|
|
||||||
this->y -= v.y;
|
|
||||||
this->z -= v.z;
|
|
||||||
this->w -= v.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator*=
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x *= s;
|
|
||||||
this->y *= s;
|
|
||||||
this->z *= s;
|
|
||||||
this->w *= s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator*=
|
|
||||||
(
|
|
||||||
tvec4<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x *= v.x;
|
|
||||||
this->y *= v.y;
|
|
||||||
this->z *= v.z;
|
|
||||||
this->w *= v.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator/=
|
|
||||||
(
|
|
||||||
thalf const & s
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x /= s;
|
|
||||||
this->y /= s;
|
|
||||||
this->z /= s;
|
|
||||||
this->w /= s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator/=
|
|
||||||
(
|
|
||||||
tvec4<thalf> const & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->x /= v.x;
|
|
||||||
this->y /= v.y;
|
|
||||||
this->z /= v.z;
|
|
||||||
this->w /= v.w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator++()
|
|
||||||
{
|
|
||||||
++this->x;
|
|
||||||
++this->y;
|
|
||||||
++this->z;
|
|
||||||
++this->w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator--()
|
|
||||||
{
|
|
||||||
--this->x;
|
|
||||||
--this->y;
|
|
||||||
--this->z;
|
|
||||||
--this->w;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// Swizzle operators
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER thalf tvec4<thalf>::swizzle(comp x) const
|
|
||||||
{
|
|
||||||
return (*this)[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec2<thalf> tvec4<thalf>::swizzle(comp x, comp y) const
|
|
||||||
{
|
|
||||||
return tvec2<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec3<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z) const
|
|
||||||
{
|
|
||||||
return tvec3<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y],
|
|
||||||
(*this)[z]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tvec4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w) const
|
|
||||||
{
|
|
||||||
return tvec4<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y],
|
|
||||||
(*this)[z],
|
|
||||||
(*this)[w]);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER tref4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w)
|
|
||||||
{
|
|
||||||
return tref4<thalf>(
|
|
||||||
(*this)[x],
|
|
||||||
(*this)[y],
|
|
||||||
(*this)[z],
|
|
||||||
(*this)[w]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif//_MSC_EXTENSIONS
|
#endif//_MSC_EXTENSIONS
|
||||||
|
|
||||||
|
@ -26,13 +26,15 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType row(
|
GLM_FUNC_QUALIFIER genType row
|
||||||
|
(
|
||||||
genType const & m,
|
genType const & m,
|
||||||
int index,
|
int index,
|
||||||
typename genType::row_type const & x)
|
typename genType::row_type const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
genType Result = m;
|
genType Result = m;
|
||||||
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
||||||
@ -41,9 +43,11 @@ GLM_FUNC_QUALIFIER genType row(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER typename genType::row_type row(
|
GLM_FUNC_QUALIFIER typename genType::row_type row
|
||||||
|
(
|
||||||
genType const & m,
|
genType const & m,
|
||||||
int index)
|
int index
|
||||||
|
)
|
||||||
{
|
{
|
||||||
typename genType::row_type Result;
|
typename genType::row_type Result;
|
||||||
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
||||||
@ -52,10 +56,12 @@ GLM_FUNC_QUALIFIER typename genType::row_type row(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType column(
|
GLM_FUNC_QUALIFIER genType column
|
||||||
|
(
|
||||||
genType const & m,
|
genType const & m,
|
||||||
int index,
|
int index,
|
||||||
typename genType::col_type const & x)
|
typename genType::col_type const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
genType Result = m;
|
genType Result = m;
|
||||||
Result[index] = x;
|
Result[index] = x;
|
||||||
@ -63,12 +69,12 @@ GLM_FUNC_QUALIFIER genType column(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER typename genType::col_type column(
|
GLM_FUNC_QUALIFIER typename genType::col_type column
|
||||||
|
(
|
||||||
genType const & m,
|
genType const & m,
|
||||||
int index)
|
int index
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return m[index];
|
return m[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> affineInverse
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> affineInverse
|
||||||
(
|
(
|
||||||
@ -57,8 +57,10 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> affineInverse
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose(
|
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose
|
||||||
detail::tmat2x2<valType> const & m)
|
(
|
||||||
|
detail::tmat2x2<valType> const & m
|
||||||
|
)
|
||||||
{
|
{
|
||||||
valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||||
|
|
||||||
@ -72,8 +74,10 @@ GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose
|
||||||
detail::tmat3x3<valType> const & m)
|
(
|
||||||
|
detail::tmat3x3<valType> const & m
|
||||||
|
)
|
||||||
{
|
{
|
||||||
valType Determinant =
|
valType Determinant =
|
||||||
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
|
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
|
||||||
@ -96,8 +100,10 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose
|
||||||
detail::tmat4x4<valType> const & m)
|
(
|
||||||
|
detail::tmat4x4<valType> const & m
|
||||||
|
)
|
||||||
{
|
{
|
||||||
valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||||
valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||||
@ -150,5 +156,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose(
|
|||||||
|
|
||||||
return Inverse;
|
return Inverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate
|
||||||
(
|
(
|
||||||
@ -409,5 +409,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> lookAt
|
|||||||
*/
|
*/
|
||||||
return translate(Result, -eye);
|
return translate(Result, -eye);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
// - GLM core
|
// - GLM core
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T mod289(T const & x)
|
GLM_FUNC_QUALIFIER T mod289(T const & x)
|
||||||
{
|
{
|
||||||
@ -848,5 +848,4 @@ GLM_FUNC_QUALIFIER T simplex(detail::tvec4<T> const & v)
|
|||||||
(dot(m0 * m0, detail::tvec3<T>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
(dot(m0 * m0, detail::tvec3<T>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
||||||
dot(m1 * m1, detail::tvec2<T>(dot(p3, x3), dot(p4, x4))));
|
dot(m1 * m1, detail::tvec2<T>(dot(p3, x3), dot(p4, x4))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail{
|
namespace detail
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER tquat<T>::tquat() :
|
GLM_FUNC_QUALIFIER tquat<T>::tquat() :
|
||||||
x(0),
|
x(0),
|
||||||
|
@ -9,77 +9,51 @@
|
|||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
struct compute_linearRand
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T operator() (T const & Min, T const & Max) const
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(0, "'linearRand' invalid template parameter type. GLM_GTC_random only supports floating-point template types.");
|
||||||
|
return Min;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER glm::half linearRand
|
GLM_FUNC_QUALIFIER half compute_linearRand::operator()<half> (half const & Min, half const & Max) const
|
||||||
(
|
|
||||||
glm::half const & Min,
|
|
||||||
glm::half const & Max
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return glm::half(float(std::rand()) / float(RAND_MAX) * (float(Max) - float(Min)) + float(Min));
|
return half(float(std::rand()) / float(RAND_MAX) * (float(Max) - float(Min)) + float(Min));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER float linearRand
|
GLM_FUNC_QUALIFIER float compute_linearRand::operator()<float> (float const & Min, float const & Max) const
|
||||||
(
|
|
||||||
float const & Min,
|
|
||||||
float const & Max
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return float(std::rand()) / float(RAND_MAX) * (Max - Min) + Min;
|
return float(std::rand()) / float(RAND_MAX) * (Max - Min) + Min;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER double linearRand
|
GLM_FUNC_QUALIFIER double compute_linearRand::operator()<double> (double const & Min, double const & Max) const
|
||||||
(
|
|
||||||
double const & Min,
|
|
||||||
double const & Max
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return double(std::rand()) / double(RAND_MAX) * (Max - Min) + Min;
|
return double(std::rand()) / double(RAND_MAX) * (Max - Min) + Min;
|
||||||
}
|
}
|
||||||
|
}//namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> linearRand
|
GLM_FUNC_QUALIFIER genType linearRand
|
||||||
(
|
(
|
||||||
detail::tvec2<T> const & Min,
|
genType const & Min,
|
||||||
detail::tvec2<T> const & Max
|
genType const & Max
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec2<T>(
|
return detail::compute_linearRand()(Min, Max);
|
||||||
linearRand(Min.x, Max.x),
|
|
||||||
linearRand(Min.y, Max.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(linearRand)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> linearRand
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & Min,
|
|
||||||
detail::tvec3<T> const & Max
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
linearRand(Min.x, Max.x),
|
|
||||||
linearRand(Min.y, Max.y),
|
|
||||||
linearRand(Min.z, Max.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> linearRand
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & Min,
|
|
||||||
detail::tvec4<T> const & Max
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
linearRand(Min.x, Max.x),
|
|
||||||
linearRand(Min.y, Max.y),
|
|
||||||
linearRand(Min.z, Max.z),
|
|
||||||
linearRand(Min.w, Max.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType gaussRand
|
GLM_FUNC_QUALIFIER genType gaussRand
|
||||||
@ -101,44 +75,7 @@ GLM_FUNC_QUALIFIER genType gaussRand
|
|||||||
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
|
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(gaussRand)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> gaussRand
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & Mean,
|
|
||||||
detail::tvec2<T> const & Deviation
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
gaussRand(Mean.x, Deviation.x),
|
|
||||||
gaussRand(Mean.y, Deviation.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> gaussRand
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & Mean,
|
|
||||||
detail::tvec3<T> const & Deviation
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
gaussRand(Mean.x, Deviation.x),
|
|
||||||
gaussRand(Mean.y, Deviation.y),
|
|
||||||
gaussRand(Mean.z, Deviation.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> gaussRand
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & Mean,
|
|
||||||
detail::tvec4<T> const & Deviation
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
gaussRand(Mean.x, Deviation.x),
|
|
||||||
gaussRand(Mean.y, Deviation.y),
|
|
||||||
gaussRand(Mean.z, Deviation.z),
|
|
||||||
gaussRand(Mean.w, Deviation.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> diskRand
|
GLM_FUNC_QUALIFIER detail::tvec2<T> diskRand
|
||||||
@ -204,5 +141,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> sphericalRand
|
|||||||
|
|
||||||
return detail::tvec3<T>(x, y, z) * Radius;
|
return detail::tvec3<T>(x, y, z) * Radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T, template <typename> class vecType>
|
template <typename T, template <typename> class vecType>
|
||||||
GLM_FUNC_QUALIFIER T swizzle
|
GLM_FUNC_QUALIFIER T swizzle
|
||||||
(
|
(
|
||||||
@ -113,78 +113,4 @@ GLM_FUNC_QUALIFIER detail::tref4<T> swizzle
|
|||||||
{
|
{
|
||||||
return detail::tref4<T>(v[x], v[y], v[z], v[w]);
|
return detail::tref4<T>(v[x], v[y], v[z], v[w]);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
template <comp x>
|
|
||||||
GLM_FUNC_QUALIFIER float& swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<float> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return v[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x>
|
|
||||||
GLM_FUNC_QUALIFIER int& swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<int> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return v[x];
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x, comp y>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tref2<float> swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<float> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tref2<float>(v[x], v[y]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x, comp y>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tref2<int> swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<int> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tref2<int>(v[x], v[y]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x, comp y, comp z>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tref3<float> swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<float> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tref3<float>(v[x], v[y], v[z]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x, comp y, comp z>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tref3<int> swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<int> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tref3<int>(v[x], v[y], v[z]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x, comp y, comp z, comp w>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tref4<float> swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<float> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tref4<float>(v[x], v[y], v[z], v[w]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <comp x, comp y, comp z, comp w>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tref4<int> swizzle
|
|
||||||
(
|
|
||||||
detail::tvec4<int> & v
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tref4<int>(v[x], v[y], v[z], v[w]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
186
glm/gtx/bit.inl
186
glm/gtx/bit.inl
@ -8,9 +8,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "../core/_detail.hpp"
|
#include "../core/_detail.hpp"
|
||||||
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genIType>
|
template <typename genIType>
|
||||||
GLM_FUNC_QUALIFIER genIType mask
|
GLM_FUNC_QUALIFIER genIType mask
|
||||||
(
|
(
|
||||||
@ -20,41 +21,7 @@ GLM_FUNC_QUALIFIER genIType mask
|
|||||||
return ((genIType(1) << (count)) - genIType(1));
|
return ((genIType(1) << (count)) - genIType(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valIType>
|
VECTORIZE_VEC(mask)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valIType> mask
|
|
||||||
(
|
|
||||||
detail::tvec2<valIType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valIType>(
|
|
||||||
mask(count[0]),
|
|
||||||
mask(count[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valIType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valIType> mask
|
|
||||||
(
|
|
||||||
detail::tvec3<valIType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valIType>(
|
|
||||||
mask(count[0]),
|
|
||||||
mask(count[1]),
|
|
||||||
mask(count[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valIType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valIType> mask
|
|
||||||
(
|
|
||||||
detail::tvec4<valIType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valIType>(
|
|
||||||
mask(count[0]),
|
|
||||||
mask(count[1]),
|
|
||||||
mask(count[2]),
|
|
||||||
mask(count[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// extractField
|
// extractField
|
||||||
template <typename genIType>
|
template <typename genIType>
|
||||||
@ -458,41 +425,7 @@ GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType const & value)
|
|||||||
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
|
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(powerOfTwoAbove)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoAbove
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
powerOfTwoAbove(value[0]),
|
|
||||||
powerOfTwoAbove(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoAbove
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
powerOfTwoAbove(value[0]),
|
|
||||||
powerOfTwoAbove(value[1]),
|
|
||||||
powerOfTwoAbove(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoAbove
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
powerOfTwoAbove(value[0]),
|
|
||||||
powerOfTwoAbove(value[1]),
|
|
||||||
powerOfTwoAbove(value[2]),
|
|
||||||
powerOfTwoAbove(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// powerOfTwoBelow
|
// powerOfTwoBelow
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -504,41 +437,7 @@ GLM_FUNC_QUALIFIER genType powerOfTwoBelow
|
|||||||
return isPowerOfTwo(value) ? value : highestBitValue(value);
|
return isPowerOfTwo(value) ? value : highestBitValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(powerOfTwoBelow)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoBelow
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
powerOfTwoBelow(value[0]),
|
|
||||||
powerOfTwoBelow(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoBelow
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
powerOfTwoBelow(value[0]),
|
|
||||||
powerOfTwoBelow(value[1]),
|
|
||||||
powerOfTwoBelow(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoBelow
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
powerOfTwoBelow(value[0]),
|
|
||||||
powerOfTwoBelow(value[1]),
|
|
||||||
powerOfTwoBelow(value[2]),
|
|
||||||
powerOfTwoBelow(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// powerOfTwoNearest
|
// powerOfTwoNearest
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -555,41 +454,7 @@ GLM_FUNC_QUALIFIER genType powerOfTwoNearest
|
|||||||
return (next - value) < (value - prev) ? next : prev;
|
return (next - value) < (value - prev) ? next : prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(powerOfTwoNearest)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoNearest
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
powerOfTwoNearest(value[0]),
|
|
||||||
powerOfTwoNearest(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoNearest
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
powerOfTwoNearest(value[0]),
|
|
||||||
powerOfTwoNearest(value[1]),
|
|
||||||
powerOfTwoNearest(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoNearest
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
powerOfTwoNearest(value[0]),
|
|
||||||
powerOfTwoNearest(value[1]),
|
|
||||||
powerOfTwoNearest(value[2]),
|
|
||||||
powerOfTwoNearest(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
|
GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
|
||||||
@ -604,41 +469,7 @@ GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
|
|||||||
return Out;
|
return Out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(bitRevert)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRevert
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
bitRevert(Value[0]),
|
|
||||||
bitRevert(Value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRevert
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
bitRevert(Value[0]),
|
|
||||||
bitRevert(Value[1]),
|
|
||||||
bitRevert(Value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRevert
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
bitRevert(Value[0]),
|
|
||||||
bitRevert(Value[1]),
|
|
||||||
bitRevert(Value[2]),
|
|
||||||
bitRevert(Value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType bitRotateRight(genType const & In, std::size_t Shift)
|
GLM_FUNC_QUALIFIER genType bitRotateRight(genType const & In, std::size_t Shift)
|
||||||
@ -769,5 +600,4 @@ GLM_FUNC_QUALIFIER genIUType fillBitfieldWithZero
|
|||||||
Result &= ~(1 << i);
|
Result &= ~(1 << i);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#ifndef glm_gtx_closest_point
|
#ifndef glm_gtx_closest_point
|
||||||
#define glm_gtx_closest_point
|
#define glm_gtx_closest_point
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
|
GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
|
||||||
(
|
(
|
||||||
@ -31,7 +31,6 @@ GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
|
|||||||
if(Distance >= LineLength) return b;
|
if(Distance >= LineLength) return b;
|
||||||
return a + LineDirection * Distance;
|
return a + LineDirection * Distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
#endif//glm_gtx_closest_point
|
#endif//glm_gtx_closest_point
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/color_cast.inl
|
// File : glm/gtx/color_cast.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER uint8 u8channel_cast(T a)
|
GLM_FUNC_QUALIFIER uint8 u8channel_cast(T a)
|
||||||
{
|
{
|
||||||
@ -730,5 +730,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint64>(uint64 color)
|
|||||||
result.w = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
result.w = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/color_space.inl
|
// File : glm/gtx/color_space.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> rgbColor(const detail::tvec3<T>& hsvColor)
|
GLM_FUNC_QUALIFIER detail::tvec3<T> rgbColor(const detail::tvec3<T>& hsvColor)
|
||||||
{
|
{
|
||||||
@ -146,5 +146,4 @@ GLM_FUNC_QUALIFIER T luminosity(const detail::tvec3<T>& color)
|
|||||||
const detail::tvec3<T> tmp = detail::tvec3<T>(0.33, 0.59, 0.11);
|
const detail::tvec3<T> tmp = detail::tvec3<T>(0.33, 0.59, 0.11);
|
||||||
return dot(color, tmp);
|
return dot(color, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/color_space_YCoCg.inl
|
// File : glm/gtx/color_space_YCoCg.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg
|
GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg
|
||||||
(
|
(
|
||||||
@ -61,5 +61,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCgR2rgb
|
|||||||
result.r = result.b + YCoCgRColor.y;
|
result.r = result.b + YCoCgRColor.y;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/compatibility.inl
|
// File : glm/gtx/compatibility.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
// isfinite
|
// isfinite
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER bool isfinite(
|
GLM_FUNC_QUALIFIER bool isfinite(
|
||||||
@ -133,5 +133,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> isnan(
|
|||||||
isnan(x.z),
|
isnan(x.z),
|
||||||
isnan(x.w));
|
isnan(x.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : gtx_component_wise.inl
|
// File : gtx_component_wise.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
|
GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
|
||||||
{
|
{
|
||||||
@ -44,5 +44,4 @@ GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v)
|
|||||||
result = max(result, v[i]);
|
result = max(result, v[i]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -20,773 +20,8 @@
|
|||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
/// THE SOFTWARE.
|
/// THE SOFTWARE.
|
||||||
///
|
///
|
||||||
/// @ref gtc_half_float
|
/// @ref gtx_constants
|
||||||
/// @file glm/gtc/half_float.inl
|
/// @file glm/gtx/constants.inl
|
||||||
/// @date 2009-04-29 / 2011-06-05
|
/// @date 2011-10-14 / 2011-10-14
|
||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "../core/_detail.hpp"
|
|
||||||
|
|
||||||
namespace glm{
|
|
||||||
|
|
||||||
template <typename genIType>
|
|
||||||
GLM_FUNC_QUALIFIER genIType mask
|
|
||||||
(
|
|
||||||
genIType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return ((genIType(1) << (count)) - genIType(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valIType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valIType> mask
|
|
||||||
(
|
|
||||||
detail::tvec2<valIType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valIType>(
|
|
||||||
mask(count[0]),
|
|
||||||
mask(count[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valIType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valIType> mask
|
|
||||||
(
|
|
||||||
detail::tvec3<valIType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valIType>(
|
|
||||||
mask(count[0]),
|
|
||||||
mask(count[1]),
|
|
||||||
mask(count[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valIType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valIType> mask
|
|
||||||
(
|
|
||||||
detail::tvec4<valIType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valIType>(
|
|
||||||
mask(count[0]),
|
|
||||||
mask(count[1]),
|
|
||||||
mask(count[2]),
|
|
||||||
mask(count[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// extractField
|
|
||||||
template <typename genIType>
|
|
||||||
GLM_FUNC_QUALIFIER genIType extractField
|
|
||||||
(
|
|
||||||
half const & value,
|
|
||||||
genIType const & first,
|
|
||||||
genIType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(first + count < sizeof(half));
|
|
||||||
return (value._data() << first) >> ((sizeof(half) << 3) - count);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIType>
|
|
||||||
GLM_FUNC_QUALIFIER genIType extractField
|
|
||||||
(
|
|
||||||
float const & value,
|
|
||||||
genIType const & first,
|
|
||||||
genIType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(first + count < sizeof(float));
|
|
||||||
return (detail::uif32(value).i << first) >> ((sizeof(float) << 3) - count);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIType>
|
|
||||||
GLM_FUNC_QUALIFIER genIType extractField
|
|
||||||
(
|
|
||||||
double const & value,
|
|
||||||
genIType const & first,
|
|
||||||
genIType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(first + count < sizeof(double));
|
|
||||||
return (detail::uif64(value).i << first) >> ((sizeof(double) << genIType(3)) - count);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER genIUType extractField
|
|
||||||
(
|
|
||||||
genIUType const & Value,
|
|
||||||
sizeType const & First,
|
|
||||||
sizeType const & Count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sizeType GenSize = sizeof(genIUType) << 3;
|
|
||||||
|
|
||||||
assert(First + Count <= GenSize);
|
|
||||||
|
|
||||||
genIUType ShiftLeft = Count ? Value << (GenSize - (Count + First)) : 0;
|
|
||||||
genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Count);
|
|
||||||
|
|
||||||
return ShiftBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
|
|
||||||
(
|
|
||||||
detail::tvec2<genIUType> const & value,
|
|
||||||
sizeType const & first,
|
|
||||||
sizeType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<genIUType>(
|
|
||||||
extractField(value[0], first, count),
|
|
||||||
extractField(value[1], first, count));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
|
|
||||||
(
|
|
||||||
detail::tvec3<genIUType> const & value,
|
|
||||||
sizeType const & first,
|
|
||||||
sizeType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<genIUType>(
|
|
||||||
extractField(value[0], first, count),
|
|
||||||
extractField(value[1], first, count),
|
|
||||||
extractField(value[2], first, count));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
|
|
||||||
(
|
|
||||||
detail::tvec4<genIUType> const & value,
|
|
||||||
sizeType const & first,
|
|
||||||
sizeType const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<genIUType>(
|
|
||||||
extractField(value[0], first, count),
|
|
||||||
extractField(value[1], first, count),
|
|
||||||
extractField(value[2], first, count),
|
|
||||||
extractField(value[3], first, count));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
|
|
||||||
(
|
|
||||||
detail::tvec2<genIUType> const & value,
|
|
||||||
detail::tvec2<sizeType> const & first,
|
|
||||||
detail::tvec2<sizeType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<genIUType>(
|
|
||||||
extractField(value[0], first[0], count[0]),
|
|
||||||
extractField(value[1], first[1], count[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
|
|
||||||
(
|
|
||||||
detail::tvec3<genIUType> const & value,
|
|
||||||
detail::tvec3<sizeType> const & first,
|
|
||||||
detail::tvec3<sizeType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<genIUType>(
|
|
||||||
extractField(value[0], first[0], count[0]),
|
|
||||||
extractField(value[1], first[1], count[1]),
|
|
||||||
extractField(value[2], first[2], count[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
|
|
||||||
(
|
|
||||||
detail::tvec4<genIUType> const & value,
|
|
||||||
detail::tvec4<sizeType> const & first,
|
|
||||||
detail::tvec4<sizeType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<genIUType>(
|
|
||||||
extractField(value[0], first[0], count[0]),
|
|
||||||
extractField(value[1], first[1], count[1]),
|
|
||||||
extractField(value[2], first[2], count[2]),
|
|
||||||
extractField(value[3], first[3], count[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
|
|
||||||
(
|
|
||||||
genIUType const & value,
|
|
||||||
detail::tvec2<sizeType> const & first,
|
|
||||||
detail::tvec2<sizeType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<genIUType>(
|
|
||||||
extractField(value, first[0], count[0]),
|
|
||||||
extractField(value, first[1], count[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
|
|
||||||
(
|
|
||||||
genIUType const & value,
|
|
||||||
detail::tvec3<sizeType> const & first,
|
|
||||||
detail::tvec3<sizeType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<genIUType>(
|
|
||||||
extractField(value, first[0], count[0]),
|
|
||||||
extractField(value, first[1], count[1]),
|
|
||||||
extractField(value, first[2], count[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType, typename sizeType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
|
|
||||||
(
|
|
||||||
genIUType const & value,
|
|
||||||
detail::tvec4<sizeType> const & first,
|
|
||||||
detail::tvec4<sizeType> const & count
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<genIUType>(
|
|
||||||
extractField(value, first[0], count[0]),
|
|
||||||
extractField(value, first[1], count[1]),
|
|
||||||
extractField(value, first[2], count[2]),
|
|
||||||
extractField(value, first[3], count[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// lowestBit
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER int lowestBit
|
|
||||||
(
|
|
||||||
genType const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(Value != genType(0)); // not valid call
|
|
||||||
|
|
||||||
genType Bit;
|
|
||||||
for(Bit = genType(0); !(Value & (1 << Bit)); ++Bit){}
|
|
||||||
return Bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<int> lowestBit
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<int>(
|
|
||||||
lowestBit(value[0]),
|
|
||||||
lowestBit(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<int> lowestBit
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<int>(
|
|
||||||
lowestBit(value[0]),
|
|
||||||
lowestBit(value[1]),
|
|
||||||
lowestBit(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<int> lowestBit
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<int>(
|
|
||||||
lowestBit(value[0]),
|
|
||||||
lowestBit(value[1]),
|
|
||||||
lowestBit(value[2]),
|
|
||||||
lowestBit(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// highestBit
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER int highestBit
|
|
||||||
(
|
|
||||||
genType const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(value != genType(0)); // not valid call
|
|
||||||
|
|
||||||
genType bit = genType(-1);
|
|
||||||
for(genType tmp = value; tmp; tmp >>= 1, ++bit){}
|
|
||||||
return bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//template <>
|
|
||||||
//GLM_FUNC_QUALIFIER int highestBit<int>
|
|
||||||
//(
|
|
||||||
// int value
|
|
||||||
//)
|
|
||||||
//{
|
|
||||||
// int bit = -1;
|
|
||||||
// for(int tmp = value; tmp; tmp >>= 1, ++bit);
|
|
||||||
// return bit;
|
|
||||||
//}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<int> highestBit
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<int>(
|
|
||||||
highestBit(value[0]),
|
|
||||||
highestBit(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<int> highestBit
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<int>(
|
|
||||||
highestBit(value[0]),
|
|
||||||
highestBit(value[1]),
|
|
||||||
highestBit(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<int> highestBit
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<int>(
|
|
||||||
highestBit(value[0]),
|
|
||||||
highestBit(value[1]),
|
|
||||||
highestBit(value[2]),
|
|
||||||
highestBit(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// highestBitValue
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType highestBitValue
|
|
||||||
(
|
|
||||||
genType const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
genType tmp = value;
|
|
||||||
genType result = genType(0);
|
|
||||||
while(tmp)
|
|
||||||
{
|
|
||||||
result = (tmp & (~tmp + 1)); // grab lowest bit
|
|
||||||
tmp &= ~result; // clear lowest bit
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<int> highestBitValue
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<int>(
|
|
||||||
highestBitValue(value[0]),
|
|
||||||
highestBitValue(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<int> highestBitValue
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<int>(
|
|
||||||
highestBitValue(value[0]),
|
|
||||||
highestBitValue(value[1]),
|
|
||||||
highestBitValue(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<int> highestBitValue
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<int>(
|
|
||||||
highestBitValue(value[0]),
|
|
||||||
highestBitValue(value[1]),
|
|
||||||
highestBitValue(value[2]),
|
|
||||||
highestBitValue(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// isPowerOfTwo
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER bool isPowerOfTwo(genType const & Value)
|
|
||||||
{
|
|
||||||
//detail::If<std::numeric_limits<genType>::is_signed>::apply(abs, Value);
|
|
||||||
//return !(Value & (Value - 1));
|
|
||||||
|
|
||||||
// For old complier?
|
|
||||||
genType Result = Value;
|
|
||||||
if(std::numeric_limits<genType>::is_signed)
|
|
||||||
Result = abs(Result);
|
|
||||||
return !(Result & (Result - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<bool> isPowerOfTwo
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<bool>(
|
|
||||||
isPowerOfTwo(value[0]),
|
|
||||||
isPowerOfTwo(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<bool> isPowerOfTwo
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<bool>(
|
|
||||||
isPowerOfTwo(value[0]),
|
|
||||||
isPowerOfTwo(value[1]),
|
|
||||||
isPowerOfTwo(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> isPowerOfTwo
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<bool>(
|
|
||||||
isPowerOfTwo(value[0]),
|
|
||||||
isPowerOfTwo(value[1]),
|
|
||||||
isPowerOfTwo(value[2]),
|
|
||||||
isPowerOfTwo(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// powerOfTwoAbove
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType const & value)
|
|
||||||
{
|
|
||||||
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoAbove
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
powerOfTwoAbove(value[0]),
|
|
||||||
powerOfTwoAbove(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoAbove
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
powerOfTwoAbove(value[0]),
|
|
||||||
powerOfTwoAbove(value[1]),
|
|
||||||
powerOfTwoAbove(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoAbove
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
powerOfTwoAbove(value[0]),
|
|
||||||
powerOfTwoAbove(value[1]),
|
|
||||||
powerOfTwoAbove(value[2]),
|
|
||||||
powerOfTwoAbove(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// powerOfTwoBelow
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType powerOfTwoBelow
|
|
||||||
(
|
|
||||||
genType const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return isPowerOfTwo(value) ? value : highestBitValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoBelow
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
powerOfTwoBelow(value[0]),
|
|
||||||
powerOfTwoBelow(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoBelow
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
powerOfTwoBelow(value[0]),
|
|
||||||
powerOfTwoBelow(value[1]),
|
|
||||||
powerOfTwoBelow(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoBelow
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
powerOfTwoBelow(value[0]),
|
|
||||||
powerOfTwoBelow(value[1]),
|
|
||||||
powerOfTwoBelow(value[2]),
|
|
||||||
powerOfTwoBelow(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// powerOfTwoNearest
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType powerOfTwoNearest
|
|
||||||
(
|
|
||||||
genType const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if(isPowerOfTwo(value))
|
|
||||||
return value;
|
|
||||||
|
|
||||||
genType prev = highestBitValue(value);
|
|
||||||
genType next = prev << 1;
|
|
||||||
return (next - value) < (value - prev) ? next : prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoNearest
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
powerOfTwoNearest(value[0]),
|
|
||||||
powerOfTwoNearest(value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoNearest
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
powerOfTwoNearest(value[0]),
|
|
||||||
powerOfTwoNearest(value[1]),
|
|
||||||
powerOfTwoNearest(value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoNearest
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
powerOfTwoNearest(value[0]),
|
|
||||||
powerOfTwoNearest(value[1]),
|
|
||||||
powerOfTwoNearest(value[2]),
|
|
||||||
powerOfTwoNearest(value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRevert' only accept integer values");
|
|
||||||
|
|
||||||
genType Out = 0;
|
|
||||||
std::size_t BitSize = sizeof(genType) * 8;
|
|
||||||
for(std::size_t i = 0; i < BitSize; ++i)
|
|
||||||
if(In & (genType(1) << i))
|
|
||||||
Out |= genType(1) << (BitSize - 1 - i);
|
|
||||||
return Out;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRevert
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
bitRevert(Value[0]),
|
|
||||||
bitRevert(Value[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRevert
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
bitRevert(Value[0]),
|
|
||||||
bitRevert(Value[1]),
|
|
||||||
bitRevert(Value[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRevert
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & Value
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
bitRevert(Value[0]),
|
|
||||||
bitRevert(Value[1]),
|
|
||||||
bitRevert(Value[2]),
|
|
||||||
bitRevert(Value[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType bitRotateRight(genType const & In, std::size_t Shift)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRotateRight' only accept integer values");
|
|
||||||
|
|
||||||
std::size_t BitSize = sizeof(genType) * 8;
|
|
||||||
return (In << Shift) | (In >> (BitSize - Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRotateRight
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & Value,
|
|
||||||
std::size_t Shift
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
bitRotateRight(Value[0], Shift),
|
|
||||||
bitRotateRight(Value[1], Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRotateRight
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & Value,
|
|
||||||
std::size_t Shift
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
bitRotateRight(Value[0], Shift),
|
|
||||||
bitRotateRight(Value[1], Shift),
|
|
||||||
bitRotateRight(Value[2], Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateRight
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & Value,
|
|
||||||
std::size_t Shift
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
bitRotateRight(Value[0], Shift),
|
|
||||||
bitRotateRight(Value[1], Shift),
|
|
||||||
bitRotateRight(Value[2], Shift),
|
|
||||||
bitRotateRight(Value[3], Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genType>
|
|
||||||
GLM_FUNC_QUALIFIER genType bitRotateLeft(genType const & In, std::size_t Shift)
|
|
||||||
{
|
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRotateLeft' only accept integer values");
|
|
||||||
|
|
||||||
std::size_t BitSize = sizeof(genType) * 8;
|
|
||||||
return (In >> Shift) | (In << (BitSize - Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRotateLeft
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & Value,
|
|
||||||
std::size_t Shift
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
bitRotateLeft(Value[0], Shift),
|
|
||||||
bitRotateLeft(Value[1], Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRotateLeft
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & Value,
|
|
||||||
std::size_t Shift
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
bitRotateLeft(Value[0], Shift),
|
|
||||||
bitRotateLeft(Value[1], Shift),
|
|
||||||
bitRotateLeft(Value[2], Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateLeft
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & Value,
|
|
||||||
std::size_t Shift
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
bitRotateLeft(Value[0], Shift),
|
|
||||||
bitRotateLeft(Value[1], Shift),
|
|
||||||
bitRotateLeft(Value[2], Shift),
|
|
||||||
bitRotateLeft(Value[3], Shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType>
|
|
||||||
GLM_FUNC_QUALIFIER genIUType fillBitfieldWithOne
|
|
||||||
(
|
|
||||||
genIUType const & Value,
|
|
||||||
int const & FromBit,
|
|
||||||
int const & ToBit
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(FromBit <= ToBit);
|
|
||||||
assert(ToBit <= sizeof(genIUType) * std::size_t(8));
|
|
||||||
|
|
||||||
genIUType Result = Value;
|
|
||||||
for(std::size_t i = 0; i <= ToBit; ++i)
|
|
||||||
Result |= (1 << i);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename genIUType>
|
|
||||||
GLM_FUNC_QUALIFIER genIUType fillBitfieldWithZero
|
|
||||||
(
|
|
||||||
genIUType const & Value,
|
|
||||||
int const & FromBit,
|
|
||||||
int const & ToBit
|
|
||||||
)
|
|
||||||
{
|
|
||||||
assert(FromBit <= ToBit);
|
|
||||||
assert(ToBit <= sizeof(genIUType) * std::size_t(8));
|
|
||||||
|
|
||||||
genIUType Result = Value;
|
|
||||||
for(std::size_t i = 0; i <= ToBit; ++i)
|
|
||||||
Result &= ~(1 << i);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/epsilon.inl
|
// File : glm/gtx/epsilon.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER bool equalEpsilon
|
GLM_FUNC_QUALIFIER bool equalEpsilon
|
||||||
(
|
(
|
||||||
@ -226,5 +226,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
|
|||||||
abs(x.z - y.z) >= epsilon.z,
|
abs(x.z - y.z) >= epsilon.z,
|
||||||
abs(x.w - y.w) >= epsilon.w);
|
abs(x.w - y.w) >= epsilon.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/euler_angles.inl
|
// File : glm/gtx/euler_angles.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleX
|
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleX
|
||||||
(
|
(
|
||||||
@ -241,5 +241,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> orientate4
|
|||||||
{
|
{
|
||||||
return yawPitchRoll(angles.z, angles.x, angles.y);
|
return yawPitchRoll(angles.z, angles.x, angles.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/extend.inl
|
// File : glm/gtx/extend.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
genType extend
|
genType extend
|
||||||
(
|
(
|
||||||
@ -52,5 +52,4 @@ detail::tvec4<valType> extend
|
|||||||
{
|
{
|
||||||
return Origin + (Source - Origin) * Distance;
|
return Origin + (Source - Origin) * Distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -54,17 +54,17 @@ namespace glm
|
|||||||
|
|
||||||
//! Faster than the common pow function but less accurate.
|
//! Faster than the common pow function but less accurate.
|
||||||
//! From GLM_GTX_fast_exponential extension.
|
//! From GLM_GTX_fast_exponential extension.
|
||||||
template <typename valType>
|
template <typename genType>
|
||||||
valType fastPow(
|
genType fastPow(
|
||||||
valType const & x,
|
genType const & x,
|
||||||
valType const & y);
|
genType const & y);
|
||||||
|
|
||||||
//! Faster than the common pow function but less accurate.
|
//! Faster than the common pow function but less accurate.
|
||||||
//! From GLM_GTX_fast_exponential extension.
|
//! From GLM_GTX_fast_exponential extension.
|
||||||
template <typename T, typename U>
|
template <typename genTypeT, typename genTypeU>
|
||||||
T fastPow(
|
genTypeT fastPow(
|
||||||
const T& x,
|
genTypeT const & x,
|
||||||
const U& y);
|
genTypeU const & y);
|
||||||
|
|
||||||
//! Faster than the common exp function but less accurate.
|
//! Faster than the common exp function but less accurate.
|
||||||
//! From GLM_GTX_fast_exponential extension.
|
//! From GLM_GTX_fast_exponential extension.
|
||||||
|
@ -7,47 +7,18 @@
|
|||||||
// File : glm/gtx/fast_exponential.inl
|
// File : glm/gtx/fast_exponential.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
// fastPow:
|
// fastPow:
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER T fastPow(const T x, const T y)
|
GLM_FUNC_QUALIFIER genType fastPow(genType const & x, genType const & y)
|
||||||
{
|
{
|
||||||
return exp(y * log(x));
|
return exp(y * log(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(fastPow)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow(
|
|
||||||
const detail::tvec2<T>& x,
|
|
||||||
const detail::tvec2<T>& y)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastPow(x.x, y.x),
|
|
||||||
fastPow(x.y, y.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow(
|
|
||||||
const detail::tvec3<T>& x,
|
|
||||||
const detail::tvec3<T>& y)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastPow(x.x, y.x),
|
|
||||||
fastPow(x.y, y.y),
|
|
||||||
fastPow(x.z, y.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow(
|
|
||||||
const detail::tvec4<T>& x,
|
|
||||||
const detail::tvec4<T>& y)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastPow(x.x, y.x),
|
|
||||||
fastPow(x.y, y.y),
|
|
||||||
fastPow(x.z, y.z),
|
|
||||||
fastPow(x.w, y.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastPow(const T x, int y)
|
GLM_FUNC_QUALIFIER T fastPow(const T x, int y)
|
||||||
@ -137,39 +108,12 @@ GLM_FUNC_QUALIFIER float fastExp(float x)
|
|||||||
return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);;
|
return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastExp(x.x),
|
|
||||||
fastExp(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastExp)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastExp(x.x),
|
|
||||||
fastExp(x.y),
|
|
||||||
fastExp(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastExp(x.x),
|
|
||||||
fastExp(x.y),
|
|
||||||
fastExp(x.z),
|
|
||||||
fastExp(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// fastLog
|
// fastLog
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER T fastLog(const T x)
|
GLM_FUNC_QUALIFIER genType fastLog(genType const & x)
|
||||||
{
|
{
|
||||||
return std::log(x);
|
return std::log(x);
|
||||||
}
|
}
|
||||||
@ -183,108 +127,24 @@ GLM_FUNC_QUALIFIER float fastLog(float x)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastLog)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastLog(x.x),
|
|
||||||
fastLog(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastLog(x.x),
|
|
||||||
fastLog(x.y),
|
|
||||||
fastLog(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastLog(x.x),
|
|
||||||
fastLog(x.y),
|
|
||||||
fastLog(x.z),
|
|
||||||
fastLog(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
//fastExp2, ln2 = 0.69314718055994530941723212145818f
|
//fastExp2, ln2 = 0.69314718055994530941723212145818f
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER T fastExp2(const T x)
|
GLM_FUNC_QUALIFIER genType fastExp2(genType const & x)
|
||||||
{
|
{
|
||||||
return fastExp(0.69314718055994530941723212145818f * x);
|
return fastExp(0.69314718055994530941723212145818f * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastExp2)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp2(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastExp2(x.x),
|
|
||||||
fastExp2(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp2(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastExp2(x.x),
|
|
||||||
fastExp2(x.y),
|
|
||||||
fastExp2(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp2(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastExp2(x.x),
|
|
||||||
fastExp2(x.y),
|
|
||||||
fastExp2(x.z),
|
|
||||||
fastExp2(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// fastLog2, ln2 = 0.69314718055994530941723212145818f
|
// fastLog2, ln2 = 0.69314718055994530941723212145818f
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER T fastLog2(const T x)
|
GLM_FUNC_QUALIFIER genType fastLog2(genType const & x)
|
||||||
{
|
{
|
||||||
return fastLog(x) / 0.69314718055994530941723212145818f;
|
return fastLog(x) / 0.69314718055994530941723212145818f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastLog2)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog2(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastLog2(x.x),
|
|
||||||
fastLog2(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog2(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastLog2(x.x),
|
|
||||||
fastLog2(x.y),
|
|
||||||
fastLog2(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog2(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastLog2(x.x),
|
|
||||||
fastLog2(x.y),
|
|
||||||
fastLog2(x.z),
|
|
||||||
fastLog2(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -2,13 +2,15 @@
|
|||||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Created : 2006-01-04
|
// Created : 2006-01-04
|
||||||
// Updated : 2008-10-07
|
// Updated : 2011-10-14
|
||||||
// Licence : This source is under MIT License
|
// Licence : This source is under MIT License
|
||||||
// File : glm/gtx/fast_square_root.inl
|
// File : glm/gtx/fast_square_root.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
// fastSqrt
|
// fastSqrt
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType fastSqrt
|
GLM_FUNC_QUALIFIER genType fastSqrt
|
||||||
@ -16,44 +18,12 @@ GLM_FUNC_QUALIFIER genType fastSqrt
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'fastSqrt' only accept floating-point input");
|
||||||
|
|
||||||
return genType(1) / fastInverseSqrt(x);
|
return genType(1) / fastInverseSqrt(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(fastSqrt)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> fastSqrt
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
fastSqrt(x.x),
|
|
||||||
fastSqrt(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> fastSqrt
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
fastSqrt(x.x),
|
|
||||||
fastSqrt(x.y),
|
|
||||||
fastSqrt(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> fastSqrt
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
fastSqrt(x.x),
|
|
||||||
fastSqrt(x.y),
|
|
||||||
fastSqrt(x.z),
|
|
||||||
fastSqrt(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// fastInversesqrt
|
// fastInversesqrt
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -73,41 +43,7 @@ GLM_FUNC_QUALIFIER genType fastInverseSqrt
|
|||||||
return genType(tmp);
|
return genType(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(fastInverseSqrt)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> fastInverseSqrt
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
fastInverseSqrt(x.x),
|
|
||||||
fastInverseSqrt(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> fastInverseSqrt
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
fastInverseSqrt(x.x),
|
|
||||||
fastInverseSqrt(x.y),
|
|
||||||
fastInverseSqrt(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> fastInverseSqrt
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
fastInverseSqrt(x.x),
|
|
||||||
fastInverseSqrt(x.y),
|
|
||||||
fastInverseSqrt(x.z),
|
|
||||||
fastInverseSqrt(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// fastLength
|
// fastLength
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -160,36 +96,6 @@ GLM_FUNC_QUALIFIER genType fastDistance
|
|||||||
return fastLength(y - x);
|
return fastLength(y - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER valType fastDistance
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x,
|
|
||||||
detail::tvec2<valType> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return fastLength(y - x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER valType fastDistance
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x,
|
|
||||||
detail::tvec3<valType> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return fastLength(y - x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER valType fastDistance
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x,
|
|
||||||
detail::tvec4<valType> const & y
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return fastLength(y - x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fastNormalize
|
// fastNormalize
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType fastNormalize
|
GLM_FUNC_QUALIFIER genType fastNormalize
|
||||||
@ -229,5 +135,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<valType> fastNormalize
|
|||||||
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
||||||
return x * fastInverseSqrt(sqr);
|
return x * fastInverseSqrt(sqr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -2,267 +2,76 @@
|
|||||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Created : 2006-01-08
|
// Created : 2006-01-08
|
||||||
// Updated : 2006-01-08
|
// Updated : 2011-10-14
|
||||||
// Licence : This source is under MIT License
|
// Licence : This source is under MIT License
|
||||||
// File : glm/gtx/fast_trigonometry.inl
|
// File : glm/gtx/fast_trigonometry.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
// sin
|
// sin
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastSin(const T x)
|
GLM_FUNC_QUALIFIER T fastSin(T const & x)
|
||||||
{
|
{
|
||||||
return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040));
|
return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastSin)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastSin(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastSin(x.x),
|
|
||||||
fastSin(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastSin(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastSin(x.x),
|
|
||||||
fastSin(x.y),
|
|
||||||
fastSin(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastSin(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastSin(x.x),
|
|
||||||
fastSin(x.y),
|
|
||||||
fastSin(x.z),
|
|
||||||
fastSin(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// cos
|
// cos
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastCos(const T x)
|
GLM_FUNC_QUALIFIER T fastCos(T const & x)
|
||||||
{
|
{
|
||||||
return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888));
|
return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastCos)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastCos(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastCos(x.x),
|
|
||||||
fastCos(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastCos(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastCos(x.x),
|
|
||||||
fastCos(x.y),
|
|
||||||
fastCos(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastCos(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastCos(x.x),
|
|
||||||
fastCos(x.y),
|
|
||||||
fastCos(x.z),
|
|
||||||
fastCos(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// tan
|
// tan
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastTan(const T x)
|
GLM_FUNC_QUALIFIER T fastTan(T const & x)
|
||||||
{
|
{
|
||||||
return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539));
|
return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastTan)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastTan(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastTan(x.x),
|
|
||||||
fastTan(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastTan(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastTan(x.x),
|
|
||||||
fastTan(x.y),
|
|
||||||
fastTan(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastTan(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastTan(x.x),
|
|
||||||
fastTan(x.y),
|
|
||||||
fastTan(x.z),
|
|
||||||
fastTan(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// asin
|
// asin
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastAsin(const T x)
|
GLM_FUNC_QUALIFIER T fastAsin(T const & x)
|
||||||
{
|
{
|
||||||
return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159));
|
return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> detail::tvec2<T> fastAsin(
|
VECTORIZE_VEC(fastAsin)
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastAsin(x.x),
|
|
||||||
fastAsin(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> detail::tvec3<T> fastAsin(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastAsin(x.x),
|
|
||||||
fastAsin(x.y),
|
|
||||||
fastAsin(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> detail::tvec4<T> fastAsin(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastAsin(x.x),
|
|
||||||
fastAsin(x.y),
|
|
||||||
fastAsin(x.z),
|
|
||||||
fastAsin(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acos
|
// acos
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastAcos(const T x)
|
GLM_FUNC_QUALIFIER T fastAcos(T const & x)
|
||||||
{
|
{
|
||||||
return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
|
return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> detail::tvec2<T> fastAcos(
|
VECTORIZE_VEC(fastAcos)
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastAcos(x.x),
|
|
||||||
fastAcos(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> detail::tvec3<T> fastAcos(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastAcos(x.x),
|
|
||||||
fastAcos(x.y),
|
|
||||||
fastAcos(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> detail::tvec4<T> fastAcos(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastAcos(x.x),
|
|
||||||
fastAcos(x.y),
|
|
||||||
fastAcos(x.z),
|
|
||||||
fastAcos(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// atan
|
// atan
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T fastAtan(const T y, const T x)
|
GLM_FUNC_QUALIFIER T fastAtan(T const & y, T const & x)
|
||||||
{
|
{
|
||||||
T sgn = sign(y) * sign(x);
|
T sgn = sign(y) * sign(x);
|
||||||
return abs(fastAtan(y / x)) * sgn;
|
return abs(fastAtan(y / x)) * sgn;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(fastAtan)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
|
|
||||||
const detail::tvec2<T>& y,
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastAtan(y.x, x.x),
|
|
||||||
fastAtan(y.y, x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
|
GLM_FUNC_QUALIFIER T fastAtan(T const & x)
|
||||||
const detail::tvec3<T>& y,
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastAtan(y.x, x.x),
|
|
||||||
fastAtan(y.y, x.y),
|
|
||||||
fastAtan(y.z, x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
|
|
||||||
const detail::tvec4<T>& y,
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastAtan(y.x, x.x),
|
|
||||||
fastAtan(y.y, x.y),
|
|
||||||
fastAtan(y.z, x.z),
|
|
||||||
fastAtan(y.w, x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER T fastAtan(const T x)
|
|
||||||
{
|
{
|
||||||
return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909));
|
return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC(fastAtan)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
|
|
||||||
const detail::tvec2<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec2<T>(
|
|
||||||
fastAtan(x.x),
|
|
||||||
fastAtan(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
|
|
||||||
const detail::tvec3<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec3<T>(
|
|
||||||
fastAtan(x.x),
|
|
||||||
fastAtan(x.y),
|
|
||||||
fastAtan(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
|
|
||||||
const detail::tvec4<T>& x)
|
|
||||||
{
|
|
||||||
return detail::tvec4<T>(
|
|
||||||
fastAtan(x.x),
|
|
||||||
fastAtan(x.y),
|
|
||||||
fastAtan(x.z),
|
|
||||||
fastAtan(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/gradient_paint.inl
|
// File : glm/gtx/gradient_paint.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
valType radialGradient
|
valType radialGradient
|
||||||
(
|
(
|
||||||
@ -40,5 +40,4 @@ valType linearGradient
|
|||||||
detail::tvec2<valType> Dist = Point1 - Point0;
|
detail::tvec2<valType> Dist = Point1 - Point0;
|
||||||
return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist);
|
return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,24 +7,27 @@
|
|||||||
// File : glm/gtx/handed_coordinate_space.inl
|
// File : glm/gtx/handed_coordinate_space.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER bool rightHanded(
|
GLM_FUNC_QUALIFIER bool rightHanded
|
||||||
|
(
|
||||||
detail::tvec3<T> const & tangent,
|
detail::tvec3<T> const & tangent,
|
||||||
detail::tvec3<T> const & binormal,
|
detail::tvec3<T> const & binormal,
|
||||||
detail::tvec3<T> const & normal)
|
detail::tvec3<T> const & normal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dot(cross(normal, tangent), binormal) > T(0);
|
return dot(cross(normal, tangent), binormal) > T(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER bool leftHanded(
|
GLM_FUNC_QUALIFIER bool leftHanded
|
||||||
|
(
|
||||||
detail::tvec3<T> const & tangent,
|
detail::tvec3<T> const & tangent,
|
||||||
detail::tvec3<T> const & binormal,
|
detail::tvec3<T> const & binormal,
|
||||||
detail::tvec3<T> const & normal)
|
detail::tvec3<T> const & normal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dot(cross(normal, tangent), binormal) < T(0);
|
return dot(cross(normal, tangent), binormal) < T(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -55,57 +55,57 @@ namespace glm
|
|||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> boxInertia3(
|
detail::tmat3x3<T> boxInertia3(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const detail::tvec3<T>& Scale);
|
detail::tvec3<T> const & Scale);
|
||||||
|
|
||||||
//! Build an inertia matrix for a box.
|
//! Build an inertia matrix for a box.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> boxInertia4(
|
detail::tmat4x4<T> boxInertia4(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const detail::tvec3<T>& Scale);
|
detail::tvec3<T> const & Scale);
|
||||||
|
|
||||||
//! Build an inertia matrix for a disk.
|
//! Build an inertia matrix for a disk.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> diskInertia3(
|
detail::tmat3x3<T> diskInertia3(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const T Radius);
|
T const & Radius);
|
||||||
|
|
||||||
//! Build an inertia matrix for a disk.
|
//! Build an inertia matrix for a disk.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> diskInertia4(
|
detail::tmat4x4<T> diskInertia4(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const T Radius);
|
T const & Radius);
|
||||||
|
|
||||||
//! Build an inertia matrix for a ball.
|
//! Build an inertia matrix for a ball.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> ballInertia3(
|
detail::tmat3x3<T> ballInertia3(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const T Radius);
|
T const & Radius);
|
||||||
|
|
||||||
//! Build an inertia matrix for a ball.
|
//! Build an inertia matrix for a ball.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> ballInertia4(
|
detail::tmat4x4<T> ballInertia4(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const T Radius);
|
T const & Radius);
|
||||||
|
|
||||||
//! Build an inertia matrix for a sphere.
|
//! Build an inertia matrix for a sphere.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> sphereInertia3(
|
detail::tmat3x3<T> sphereInertia3(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const T Radius);
|
T const & Radius);
|
||||||
|
|
||||||
//! Build an inertia matrix for a sphere.
|
//! Build an inertia matrix for a sphere.
|
||||||
//! From GLM_GTX_inertia extension.
|
//! From GLM_GTX_inertia extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> sphereInertia4(
|
detail::tmat4x4<T> sphereInertia4(
|
||||||
const T Mass,
|
T const & Mass,
|
||||||
const T Radius);
|
T const & Radius);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}// namespace glm
|
}// namespace glm
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
// File : glm/gtx/inertia.inl
|
// File : glm/gtx/inertia.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3
|
||||||
const T Mass,
|
(
|
||||||
const detail::tvec3<T>& Scale)
|
T const & Mass,
|
||||||
|
detail::tvec3<T> const & Scale
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tmat3x3<T> Result(T(1));
|
detail::tmat3x3<T> Result(T(1));
|
||||||
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
|
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
|
||||||
@ -22,9 +24,11 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4
|
||||||
const T Mass,
|
(
|
||||||
const detail::tvec3<T>& Scale)
|
T const & Mass,
|
||||||
|
detail::tvec3<T> const & Scale
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tmat4x4<T> Result(T(1));
|
detail::tmat4x4<T> Result(T(1));
|
||||||
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
|
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
|
||||||
@ -34,9 +38,11 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3
|
||||||
const T Mass,
|
(
|
||||||
const T Radius)
|
T const & Mass,
|
||||||
|
T const & Radius
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T a = Mass * Radius * Radius / T(2);
|
T a = Mass * Radius * Radius / T(2);
|
||||||
detail::tmat3x3<T> Result(a);
|
detail::tmat3x3<T> Result(a);
|
||||||
@ -45,9 +51,11 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4
|
||||||
const T Mass,
|
(
|
||||||
const T Radius)
|
T const & Mass,
|
||||||
|
T const & Radius
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T a = Mass * Radius * Radius / T(2);
|
T a = Mass * Radius * Radius / T(2);
|
||||||
detail::tmat4x4<T> Result(a);
|
detail::tmat4x4<T> Result(a);
|
||||||
@ -57,18 +65,22 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3
|
||||||
const T Mass,
|
(
|
||||||
const T Radius)
|
T const & Mass,
|
||||||
|
T const & Radius
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T a = T(2) * Mass * Radius * Radius / T(5);
|
T a = T(2) * Mass * Radius * Radius / T(5);
|
||||||
return detail::tmat3x3<T>(a);
|
return detail::tmat3x3<T>(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4
|
||||||
const T Mass,
|
(
|
||||||
const T Radius)
|
T const & Mass,
|
||||||
|
T const & Radius
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T a = T(2) * Mass * Radius * Radius / T(5);
|
T a = T(2) * Mass * Radius * Radius / T(5);
|
||||||
detail::tmat4x4<T> Result(a);
|
detail::tmat4x4<T> Result(a);
|
||||||
@ -77,23 +89,26 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3
|
||||||
const T Mass,
|
(
|
||||||
const T Radius)
|
T const & Mass,
|
||||||
|
T const & Radius
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T a = T(2) * Mass * Radius * Radius / T(3);
|
T a = T(2) * Mass * Radius * Radius / T(3);
|
||||||
return detail::tmat3x3<T>(a);
|
return detail::tmat3x3<T>(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4
|
||||||
const T Mass,
|
(
|
||||||
const T Radius)
|
T const & Mass,
|
||||||
|
T const & Radius
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T a = T(2) * Mass * Radius * Radius / T(3);
|
T a = T(2) * Mass * Radius * Radius / T(3);
|
||||||
detail::tmat4x4<T> Result(a);
|
detail::tmat4x4<T> Result(a);
|
||||||
Result[3][3] = T(1);
|
Result[3][3] = T(1);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,11 +7,13 @@
|
|||||||
// File : glm/gtx/int_10_10_10_2.inl
|
// File : glm/gtx/int_10_10_10_2.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast(glm::vec4 const & v)
|
GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast
|
||||||
|
(
|
||||||
|
glm::vec4 const & v
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30);
|
return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/integer.inl
|
// File : glm/gtx/integer.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
// pow
|
// pow
|
||||||
GLM_FUNC_QUALIFIER int pow(int x, int y)
|
GLM_FUNC_QUALIFIER int pow(int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER bool intersectRayTriangle
|
GLM_FUNC_QUALIFIER bool intersectRayTriangle
|
||||||
(
|
(
|
||||||
@ -193,5 +193,4 @@ GLM_FUNC_QUALIFIER bool intersectLineSphere
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
// File : glm/gtx/log_base.inl
|
// File : glm/gtx/log_base.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType log(
|
GLM_FUNC_QUALIFIER genType log(
|
||||||
genType const & x,
|
genType const & x,
|
||||||
@ -19,70 +21,6 @@ GLM_FUNC_QUALIFIER genType log(
|
|||||||
return glm::log(x) / glm::log(base);
|
return glm::log(x) / glm::log(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC_SCA(log)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
|
VECTORIZE_VEC_VEC(log)
|
||||||
detail::tvec2<valType> const & v,
|
|
||||||
valType const & base)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
log(v.x, base),
|
|
||||||
log(v.y, base));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
|
|
||||||
detail::tvec3<valType> const & v,
|
|
||||||
valType const & base)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
log(v.x, base),
|
|
||||||
log(v.y, base),
|
|
||||||
log(v.z, base));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
|
|
||||||
detail::tvec4<valType> const & v,
|
|
||||||
valType const & base)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
log(v.x, base),
|
|
||||||
log(v.y, base),
|
|
||||||
log(v.z, base),
|
|
||||||
log(v.w, base));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
|
|
||||||
detail::tvec2<valType> const & v,
|
|
||||||
detail::tvec2<valType> const & base)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
log(v.x, base.x),
|
|
||||||
log(v.y, base.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
|
|
||||||
detail::tvec3<valType> const & v,
|
|
||||||
detail::tvec3<valType> const & base)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
log(v.x, base.x),
|
|
||||||
log(v.y, base.y),
|
|
||||||
log(v.z, base.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
|
|
||||||
detail::tvec4<valType> const & v,
|
|
||||||
detail::tvec4<valType> const & base)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
log(v.x, base.x),
|
|
||||||
log(v.y, base.y),
|
|
||||||
log(v.z, base.z),
|
|
||||||
log(v.w, base.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,11 +7,13 @@
|
|||||||
// File : glm/gtx/matrix_cross_product.inl
|
// File : glm/gtx/matrix_cross_product.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3
|
||||||
detail::tvec3<T> const & x)
|
(
|
||||||
|
detail::tvec3<T> const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tmat3x3<T> Result(T(0));
|
detail::tmat3x3<T> Result(T(0));
|
||||||
Result[0][1] = x.z;
|
Result[0][1] = x.z;
|
||||||
@ -24,8 +26,10 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4
|
||||||
detail::tvec3<T> const & x)
|
(
|
||||||
|
detail::tvec3<T> const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tmat4x4<T> Result(T(0));
|
detail::tmat4x4<T> Result(T(0));
|
||||||
Result[0][1] = x.z;
|
Result[0][1] = x.z;
|
||||||
|
@ -7,13 +7,15 @@
|
|||||||
// File : glm/gtx/matrix_interpolation.inl
|
// File : glm/gtx/matrix_interpolation.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER void axisAngle(
|
GLM_FUNC_QUALIFIER void axisAngle
|
||||||
|
(
|
||||||
detail::tmat4x4<T> const & mat,
|
detail::tmat4x4<T> const & mat,
|
||||||
detail::tvec3<T> & axis,
|
detail::tvec3<T> & axis,
|
||||||
T & angle)
|
T & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T epsilon = (T)0.01;
|
T epsilon = (T)0.01;
|
||||||
T epsilon2 = (T)0.1;
|
T epsilon2 = (T)0.1;
|
||||||
@ -76,9 +78,11 @@ GLM_FUNC_QUALIFIER void axisAngle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix
|
||||||
|
(
|
||||||
detail::tvec3<T> const & axis,
|
detail::tvec3<T> const & axis,
|
||||||
T const angle)
|
T const angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T c = cos(angle);
|
T c = cos(angle);
|
||||||
T s = sin(angle);
|
T s = sin(angle);
|
||||||
@ -94,10 +98,12 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate
|
||||||
|
(
|
||||||
detail::tmat4x4<T> const & m1,
|
detail::tmat4x4<T> const & m1,
|
||||||
detail::tmat4x4<T> const & m2,
|
detail::tmat4x4<T> const & m2,
|
||||||
T const delta)
|
T const delta
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tmat4x4<T> dltRotation = m2 * transpose(m1);
|
detail::tmat4x4<T> dltRotation = m2 * transpose(m1);
|
||||||
detail::tvec3<T> dltAxis;
|
detail::tvec3<T> dltAxis;
|
||||||
@ -109,5 +115,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
|
|||||||
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
|
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -55,85 +55,85 @@ namespace glm
|
|||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat2x2<T> rowMajor2(
|
detail::tmat2x2<T> rowMajor2(
|
||||||
const detail::tvec2<T>& v1,
|
detail::tvec2<T> const & v1,
|
||||||
const detail::tvec2<T>& v2);
|
detail::tvec2<T> const & v2);
|
||||||
|
|
||||||
//! Build a row major matrix from other matrix.
|
//! Build a row major matrix from other matrix.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat2x2<T> rowMajor2(
|
detail::tmat2x2<T> rowMajor2(
|
||||||
const detail::tmat2x2<T>& m);
|
detail::tmat2x2<T> const & m);
|
||||||
|
|
||||||
//! Build a row major matrix from row vectors.
|
//! Build a row major matrix from row vectors.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> rowMajor3(
|
detail::tmat3x3<T> rowMajor3(
|
||||||
const detail::tvec3<T>& v1,
|
detail::tvec3<T> const & v1,
|
||||||
const detail::tvec3<T>& v2,
|
detail::tvec3<T> const & v2,
|
||||||
const detail::tvec3<T>& v3);
|
detail::tvec3<T> const & v3);
|
||||||
|
|
||||||
//! Build a row major matrix from other matrix.
|
//! Build a row major matrix from other matrix.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> rowMajor3(
|
detail::tmat3x3<T> rowMajor3(
|
||||||
const detail::tmat3x3<T>& m);
|
detail::tmat3x3<T> const & m);
|
||||||
|
|
||||||
//! Build a row major matrix from row vectors.
|
//! Build a row major matrix from row vectors.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> rowMajor4(
|
detail::tmat4x4<T> rowMajor4(
|
||||||
const detail::tvec4<T>& v1,
|
detail::tvec4<T> const & v1,
|
||||||
const detail::tvec4<T>& v2,
|
detail::tvec4<T> const & v2,
|
||||||
const detail::tvec4<T>& v3,
|
detail::tvec4<T> const & v3,
|
||||||
const detail::tvec4<T>& v4);
|
detail::tvec4<T> const & v4);
|
||||||
|
|
||||||
//! Build a row major matrix from other matrix.
|
//! Build a row major matrix from other matrix.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> rowMajor4(
|
detail::tmat4x4<T> rowMajor4(
|
||||||
const detail::tmat4x4<T>& m);
|
detail::tmat4x4<T> const & m);
|
||||||
|
|
||||||
//! Build a column major matrix from column vectors.
|
//! Build a column major matrix from column vectors.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat2x2<T> colMajor2(
|
detail::tmat2x2<T> colMajor2(
|
||||||
const detail::tvec2<T>& v1,
|
detail::tvec2<T> const & v1,
|
||||||
const detail::tvec2<T>& v2);
|
detail::tvec2<T> const & v2);
|
||||||
|
|
||||||
//! Build a column major matrix from other matrix.
|
//! Build a column major matrix from other matrix.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat2x2<T> colMajor2(
|
detail::tmat2x2<T> colMajor2(
|
||||||
const detail::tmat2x2<T>& m);
|
detail::tmat2x2<T> const & m);
|
||||||
|
|
||||||
//! Build a column major matrix from column vectors.
|
//! Build a column major matrix from column vectors.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> colMajor3(
|
detail::tmat3x3<T> colMajor3(
|
||||||
const detail::tvec3<T>& v1,
|
detail::tvec3<T> const & v1,
|
||||||
const detail::tvec3<T>& v2,
|
detail::tvec3<T> const & v2,
|
||||||
const detail::tvec3<T>& v3);
|
detail::tvec3<T> const & v3);
|
||||||
|
|
||||||
//! Build a column major matrix from other matrix.
|
//! Build a column major matrix from other matrix.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat3x3<T> colMajor3(
|
detail::tmat3x3<T> colMajor3(
|
||||||
const detail::tmat3x3<T>& m);
|
detail::tmat3x3<T> const & m);
|
||||||
|
|
||||||
//! Build a column major matrix from column vectors.
|
//! Build a column major matrix from column vectors.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> colMajor4(
|
detail::tmat4x4<T> colMajor4(
|
||||||
const detail::tvec4<T>& v1,
|
detail::tvec4<T> const & v1,
|
||||||
const detail::tvec4<T>& v2,
|
detail::tvec4<T> const & v2,
|
||||||
const detail::tvec4<T>& v3,
|
detail::tvec4<T> const & v3,
|
||||||
const detail::tvec4<T>& v4);
|
detail::tvec4<T> const & v4);
|
||||||
|
|
||||||
//! Build a column major matrix from other matrix.
|
//! Build a column major matrix from other matrix.
|
||||||
//! From GLM_GTX_matrix_major_storage extension.
|
//! From GLM_GTX_matrix_major_storage extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tmat4x4<T> colMajor4(
|
detail::tmat4x4<T> colMajor4(
|
||||||
const detail::tmat4x4<T>& m);
|
detail::tmat4x4<T> const & m);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
// File : glm/gtx/matrix_major_storage.inl
|
// File : glm/gtx/matrix_major_storage.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2(
|
GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2
|
||||||
const detail::tvec2<T>& v1,
|
(
|
||||||
const detail::tvec2<T>& v2)
|
detail::tvec2<T> const & v1,
|
||||||
|
detail::tvec2<T> const & v2
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tmat2x2<T> Result;
|
detail::tmat2x2<T> Result;
|
||||||
Result[0][0] = v1.x;
|
Result[0][0] = v1.x;
|
||||||
@ -168,5 +170,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
|
|||||||
{
|
{
|
||||||
return detail::tmat4x4<T>(m);
|
return detail::tmat4x4<T>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/matrix_operation.inl
|
// File : glm/gtx/matrix_operation.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
|
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
|
||||||
(
|
(
|
||||||
@ -121,5 +121,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
|
|||||||
Result[1][1] = v[1];
|
Result[1][1] = v[1];
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -56,57 +56,57 @@ namespace glm
|
|||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool isNull(
|
bool isNull(
|
||||||
const detail::tmat2x2<T>& m,
|
detail::tmat2x2<T> const & m,
|
||||||
const T epsilon = std::numeric_limits<T>::epsilon());
|
T const & epsilon = std::numeric_limits<T>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix a null matrix.
|
//! Return if a matrix a null matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool isNull(
|
bool isNull(
|
||||||
const detail::tmat3x3<T>& m,
|
detail::tmat3x3<T> const & m,
|
||||||
const T epsilon = std::numeric_limits<T>::epsilon());
|
T const & epsilon = std::numeric_limits<T>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix a null matrix.
|
//! Return if a matrix a null matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool isNull(
|
bool isNull(
|
||||||
const detail::tmat4x4<T>& m,
|
detail::tmat4x4<T> const & m,
|
||||||
const T epsilon = std::numeric_limits<T>::epsilon());
|
T const & epsilon = std::numeric_limits<T>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix an identity matrix.
|
//! Return if a matrix an identity matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename genType>
|
template<typename genType>
|
||||||
bool isIdentity(
|
bool isIdentity(
|
||||||
const genType& m,
|
genType const & m,
|
||||||
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
|
typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix a normalized matrix.
|
//! Return if a matrix a normalized matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool isNormalized(
|
bool isNormalized(
|
||||||
const detail::tmat2x2<T>& m,
|
detail::tmat2x2<T> const & m,
|
||||||
const T epsilon = std::numeric_limits<T>::epsilon());
|
T const & epsilon = std::numeric_limits<T>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix a normalized matrix.
|
//! Return if a matrix a normalized matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool isNormalized(
|
bool isNormalized(
|
||||||
const detail::tmat3x3<T>& m,
|
detail::tmat3x3<T> const & m,
|
||||||
const T epsilon = std::numeric_limits<T>::epsilon());
|
T const & epsilon = std::numeric_limits<T>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix a normalized matrix.
|
//! Return if a matrix a normalized matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool isNormalized(
|
bool isNormalized(
|
||||||
const detail::tmat4x4<T>& m,
|
detail::tmat4x4<T> const & m,
|
||||||
const T epsilon = std::numeric_limits<T>::epsilon());
|
T const & epsilon = std::numeric_limits<T>::epsilon());
|
||||||
|
|
||||||
//! Return if a matrix an orthonormalized matrix.
|
//! Return if a matrix an orthonormalized matrix.
|
||||||
//! From GLM_GTX_matrix_query extension.
|
//! From GLM_GTX_matrix_query extension.
|
||||||
template<typename genType>
|
template<typename genType>
|
||||||
bool isOrthogonal(
|
bool isOrthogonal(
|
||||||
const genType& m,
|
genType const & m,
|
||||||
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
|
typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -10,12 +10,13 @@
|
|||||||
// - GLM core
|
// - GLM core
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER bool isNull(
|
GLM_FUNC_QUALIFIER bool isNull
|
||||||
const detail::tmat2x2<T>& m,
|
(
|
||||||
const T epsilon)
|
detail::tmat2x2<T> const & m,
|
||||||
|
T const & epsilon)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < 2 ; ++i)
|
for(int i = 0; result && i < 2 ; ++i)
|
||||||
@ -24,9 +25,11 @@ GLM_FUNC_QUALIFIER bool isNull(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER bool isNull(
|
GLM_FUNC_QUALIFIER bool isNull
|
||||||
const detail::tmat3x3<T>& m,
|
(
|
||||||
const T epsilon)
|
detail::tmat3x3<T> const & m,
|
||||||
|
T const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < 3 ; ++i)
|
for(int i = 0; result && i < 3 ; ++i)
|
||||||
@ -35,9 +38,11 @@ GLM_FUNC_QUALIFIER bool isNull(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER bool isNull(
|
GLM_FUNC_QUALIFIER bool isNull
|
||||||
const detail::tmat4x4<T>& m,
|
(
|
||||||
const T epsilon)
|
detail::tmat4x4<T> const & m,
|
||||||
|
T const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < 4 ; ++i)
|
for(int i = 0; result && i < 4 ; ++i)
|
||||||
@ -46,9 +51,11 @@ GLM_FUNC_QUALIFIER bool isNull(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename genType>
|
template<typename genType>
|
||||||
GLM_FUNC_QUALIFIER bool isIdentity(
|
GLM_FUNC_QUALIFIER bool isIdentity
|
||||||
const genType& m,
|
(
|
||||||
const typename genType::value_type epsilon)
|
genType const & m,
|
||||||
|
typename genType::value_type const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i)
|
for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i)
|
||||||
@ -64,9 +71,11 @@ GLM_FUNC_QUALIFIER bool isIdentity(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER bool isNormalized(
|
GLM_FUNC_QUALIFIER bool isNormalized
|
||||||
const detail::tmat2x2<T>& m,
|
(
|
||||||
const T epsilon)
|
detail::tmat2x2<T> const & m,
|
||||||
|
T const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < 2; ++i)
|
for(int i = 0; result && i < 2; ++i)
|
||||||
@ -82,9 +91,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER bool isNormalized(
|
GLM_FUNC_QUALIFIER bool isNormalized
|
||||||
const detail::tmat3x3<T>& m,
|
(
|
||||||
const T epsilon)
|
detail::tmat3x3<T> const & m,
|
||||||
|
T const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < 3; ++i)
|
for(int i = 0; result && i < 3; ++i)
|
||||||
@ -100,9 +111,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER bool isNormalized(
|
GLM_FUNC_QUALIFIER bool isNormalized
|
||||||
const detail::tmat4x4<T>& m,
|
(
|
||||||
const T epsilon)
|
detail::tmat4x4<T> const & m,
|
||||||
|
T const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < 4; ++i)
|
for(int i = 0; result && i < 4; ++i)
|
||||||
@ -118,9 +131,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename genType>
|
template<typename genType>
|
||||||
GLM_FUNC_QUALIFIER bool isOrthogonal(
|
GLM_FUNC_QUALIFIER bool isOrthogonal
|
||||||
const genType& m,
|
(
|
||||||
const typename genType::value_type epsilon)
|
genType const & m,
|
||||||
|
typename genType::value_type const & epsilon
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
for(int i = 0; result && i < genType::col_size() - 1; ++i)
|
for(int i = 0; result && i < genType::col_size() - 1; ++i)
|
||||||
@ -136,5 +151,4 @@ GLM_FUNC_QUALIFIER bool isOrthogonal(
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,15 +7,16 @@
|
|||||||
// File : glm/gtx/mixed_product.inl
|
// File : glm/gtx/mixed_product.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER valType mixedProduct(
|
GLM_FUNC_QUALIFIER valType mixedProduct
|
||||||
|
(
|
||||||
detail::tvec3<valType> const & v1,
|
detail::tvec3<valType> const & v1,
|
||||||
detail::tvec3<valType> const & v2,
|
detail::tvec3<valType> const & v2,
|
||||||
detail::tvec3<valType> const & v3)
|
detail::tvec3<valType> const & v3
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dot(cross(v1, v2), v3);
|
return dot(cross(v1, v2), v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -10,8 +10,10 @@
|
|||||||
// - GLM core
|
// - GLM core
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// higherMultiple
|
// higherMultiple
|
||||||
|
|
||||||
@ -62,44 +64,7 @@ GLM_FUNC_QUALIFIER double higherMultiple
|
|||||||
return Tmp ? Source + Multiple - double(Tmp) : Source;
|
return Tmp ? Source + Multiple - double(Tmp) : Source;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(higherMultiple)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> higherMultiple
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & Source,
|
|
||||||
detail::tvec2<T> const & Multiple
|
|
||||||
)
|
|
||||||
{
|
|
||||||
detail::tvec2<T> Result;
|
|
||||||
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
|
|
||||||
Result[i] = higherMultiple(Source[i], Multiple[i]);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> higherMultiple
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & Source,
|
|
||||||
detail::tvec3<T> const & Multiple
|
|
||||||
)
|
|
||||||
{
|
|
||||||
detail::tvec3<T> Result;
|
|
||||||
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
|
|
||||||
Result[i] = higherMultiple(Source[i], Multiple[i]);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> higherMultiple
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & Source,
|
|
||||||
detail::tvec4<T> const & Multiple
|
|
||||||
)
|
|
||||||
{
|
|
||||||
detail::tvec4<T> Result;
|
|
||||||
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
|
|
||||||
Result[i] = higherMultiple(Source[i], Multiple[i]);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
// lowerMultiple
|
// lowerMultiple
|
||||||
@ -151,43 +116,5 @@ GLM_FUNC_QUALIFIER double lowerMultiple
|
|||||||
return Tmp ? Source - double(Tmp) : Source;
|
return Tmp ? Source - double(Tmp) : Source;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
VECTORIZE_VEC_VEC(lowerMultiple)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> lowerMultiple
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & Source,
|
|
||||||
detail::tvec2<T> const & Multiple
|
|
||||||
)
|
|
||||||
{
|
|
||||||
detail::tvec2<T> Result;
|
|
||||||
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
|
|
||||||
Result[i] = lowerMultiple(Source[i], Multiple[i]);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> lowerMultiple
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & Source,
|
|
||||||
detail::tvec3<T> const & Multiple
|
|
||||||
)
|
|
||||||
{
|
|
||||||
detail::tvec3<T> Result;
|
|
||||||
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
|
|
||||||
Result[i] = lowerMultiple(Source[i], Multiple[i]);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> lowerMultiple
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & Source,
|
|
||||||
detail::tvec4<T> const & Multiple
|
|
||||||
)
|
|
||||||
{
|
|
||||||
detail::tvec4<T> Result;
|
|
||||||
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
|
|
||||||
Result[i] = lowerMultiple(Source[i], Multiple[i]);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -56,99 +56,73 @@ namespace glm
|
|||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T length2(
|
T length2(
|
||||||
const T x);
|
T const & x);
|
||||||
|
|
||||||
|
//! Returns the squared length of x.
|
||||||
|
//! From GLM_GTX_norm extension.
|
||||||
|
template <typename genType>
|
||||||
|
typename genType::value_type length2(
|
||||||
|
genType const & x);
|
||||||
|
|
||||||
//! Returns the squared length of x.
|
//! Returns the squared length of x.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T length2(
|
T length2(
|
||||||
const detail::tvec2<T> & x);
|
detail::tquat<T> const & q);
|
||||||
|
|
||||||
//! Returns the squared length of x.
|
|
||||||
//! From GLM_GTX_norm extension.
|
|
||||||
template <typename T>
|
|
||||||
T length2(
|
|
||||||
const detail::tvec3<T>& x);
|
|
||||||
|
|
||||||
//! Returns the squared length of x.
|
|
||||||
//! From GLM_GTX_norm extension.
|
|
||||||
template <typename T>
|
|
||||||
T length2(
|
|
||||||
const detail::tvec4<T>& x);
|
|
||||||
|
|
||||||
//! Returns the squared length of x.
|
|
||||||
//! From GLM_GTX_norm extension.
|
|
||||||
template <typename T>
|
|
||||||
T length2(
|
|
||||||
const detail::tquat<T>& q);
|
|
||||||
|
|
||||||
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T distance2(
|
T distance2(
|
||||||
const T p0,
|
T const & p0,
|
||||||
const T p1);
|
T const & p1);
|
||||||
|
|
||||||
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
T distance2(
|
typename genType::value_type distance2(
|
||||||
const detail::tvec2<T>& p0,
|
genType const & p0,
|
||||||
const detail::tvec2<T>& p1);
|
genType const & p1);
|
||||||
|
|
||||||
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
|
||||||
//! From GLM_GTX_norm extension.
|
|
||||||
template <typename T>
|
|
||||||
T distance2(
|
|
||||||
const detail::tvec3<T>& p0,
|
|
||||||
const detail::tvec3<T>& p1);
|
|
||||||
|
|
||||||
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
|
||||||
//! From GLM_GTX_norm extension.
|
|
||||||
template <typename T>
|
|
||||||
T distance2(
|
|
||||||
const detail::tvec4<T>& p0,
|
|
||||||
const detail::tvec4<T>& p1);
|
|
||||||
|
|
||||||
//! Returns the L1 norm between x and y.
|
//! Returns the L1 norm between x and y.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T l1Norm(
|
T l1Norm(
|
||||||
const detail::tvec3<T>& x,
|
detail::tvec3<T> const & x,
|
||||||
const detail::tvec3<T>& y);
|
detail::tvec3<T> const & y);
|
||||||
|
|
||||||
//! Returns the L1 norm of v.
|
//! Returns the L1 norm of v.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T l1Norm(
|
T l1Norm(
|
||||||
const detail::tvec3<T>& v);
|
detail::tvec3<T> const & v);
|
||||||
|
|
||||||
//! Returns the L2 norm between x and y.
|
//! Returns the L2 norm between x and y.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T l2Norm(
|
T l2Norm(
|
||||||
const detail::tvec3<T>& x,
|
detail::tvec3<T> const & x,
|
||||||
const detail::tvec3<T>& y);
|
detail::tvec3<T> const & y);
|
||||||
|
|
||||||
//! Returns the L2 norm of v.
|
//! Returns the L2 norm of v.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T l2Norm(
|
T l2Norm(
|
||||||
const detail::tvec3<T>& x);
|
detail::tvec3<T> const & x);
|
||||||
|
|
||||||
//! Returns the L norm between x and y.
|
//! Returns the L norm between x and y.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T lxNorm(
|
T lxNorm(
|
||||||
const detail::tvec3<T>& x,
|
detail::tvec3<T> const & x,
|
||||||
const detail::tvec3<T>& y,
|
detail::tvec3<T> const & y,
|
||||||
unsigned int Depth);
|
unsigned int Depth);
|
||||||
|
|
||||||
//! Returns the L norm of v.
|
//! Returns the L norm of v.
|
||||||
//! From GLM_GTX_norm extension.
|
//! From GLM_GTX_norm extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T lxNorm(
|
T lxNorm(
|
||||||
const detail::tvec3<T>& x,
|
detail::tvec3<T> const & x,
|
||||||
unsigned int Depth);
|
unsigned int Depth);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
112
glm/gtx/norm.inl
112
glm/gtx/norm.inl
@ -7,118 +7,148 @@
|
|||||||
// File : glm/gtx/norm.inl
|
// File : glm/gtx/norm.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T length2(
|
GLM_FUNC_QUALIFIER T length2
|
||||||
const T x)
|
(
|
||||||
|
T const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return x * x;
|
return x * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T length2(
|
GLM_FUNC_QUALIFIER T length2
|
||||||
const detail::tvec2<T>& x)
|
(
|
||||||
|
detail::tvec2<T> const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dot(x, x);
|
return dot(x, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T length2(
|
GLM_FUNC_QUALIFIER T length2
|
||||||
const detail::tvec3<T>& x)
|
(
|
||||||
|
detail::tvec3<T> const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dot(x, x);
|
return dot(x, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T length2(
|
GLM_FUNC_QUALIFIER T length2
|
||||||
const detail::tvec4<T>& x)
|
(
|
||||||
|
detail::tvec4<T> const & x
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return dot(x, x);
|
return dot(x, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T length2(
|
GLM_FUNC_QUALIFIER T length2
|
||||||
const detail::tquat<T>& q)
|
(
|
||||||
|
detail::tquat<T> const & q
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
|
return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T distance2(
|
GLM_FUNC_QUALIFIER T distance2
|
||||||
const T p0,
|
(
|
||||||
const T p1)
|
T const & p0,
|
||||||
|
T const & p1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return length2(p1 - p0);
|
return length2(p1 - p0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T distance2(
|
GLM_FUNC_QUALIFIER T distance2
|
||||||
const detail::tvec2<T>& p0,
|
(
|
||||||
const detail::tvec2<T>& p1)
|
detail::tvec2<T> const & p0,
|
||||||
|
detail::tvec2<T> const & p1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return length2(p1 - p0);
|
return length2(p1 - p0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T distance2(
|
GLM_FUNC_QUALIFIER T distance2
|
||||||
const detail::tvec3<T>& p0,
|
(
|
||||||
const detail::tvec3<T>& p1)
|
detail::tvec3<T> const & p0,
|
||||||
|
detail::tvec3<T> const & p1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return length2(p1 - p0);
|
return length2(p1 - p0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T distance2(
|
GLM_FUNC_QUALIFIER T distance2
|
||||||
const detail::tvec4<T>& p0,
|
(
|
||||||
const detail::tvec4<T>& p1)
|
detail::tvec4<T> const & p0,
|
||||||
|
detail::tvec4<T> const & p1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return length2(p1 - p0);
|
return length2(p1 - p0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T l1Norm(
|
GLM_FUNC_QUALIFIER T l1Norm
|
||||||
const detail::tvec3<T>& a,
|
(
|
||||||
const detail::tvec3<T>& b)
|
detail::tvec3<T> const & a,
|
||||||
|
detail::tvec3<T> const & b
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z);
|
return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T l1Norm(
|
GLM_FUNC_QUALIFIER T l1Norm
|
||||||
const detail::tvec3<T>& v)
|
(
|
||||||
|
detail::tvec3<T> const & v
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return abs(v.x) + abs(v.y) + abs(v.z);
|
return abs(v.x) + abs(v.y) + abs(v.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T l2Norm(
|
GLM_FUNC_QUALIFIER T l2Norm
|
||||||
const detail::tvec3<T>& a,
|
(
|
||||||
const detail::tvec3<T>& b)
|
detail::tvec3<T> const & a,
|
||||||
|
detail::tvec3<T> const & b
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return length(b - a);
|
return length(b - a);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T l2Norm(
|
GLM_FUNC_QUALIFIER T l2Norm
|
||||||
const detail::tvec3<T>& v)
|
(
|
||||||
|
detail::tvec3<T> const & v
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return length(v);
|
return length(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T lxNorm(
|
GLM_FUNC_QUALIFIER T lxNorm
|
||||||
const detail::tvec3<T>& x,
|
(
|
||||||
const detail::tvec3<T>& y,
|
detail::tvec3<T> const & x,
|
||||||
unsigned int Depth)
|
detail::tvec3<T> const & y,
|
||||||
|
unsigned int Depth
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth));
|
return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T lxNorm(
|
GLM_FUNC_QUALIFIER T lxNorm
|
||||||
const detail::tvec3<T>& v,
|
(
|
||||||
unsigned int Depth)
|
detail::tvec3<T> const & v,
|
||||||
|
unsigned int Depth
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth));
|
return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth));
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/normal.inl
|
// File : glm/gtx/normal.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
|
GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
|
||||||
(
|
(
|
||||||
@ -19,5 +19,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
|
|||||||
{
|
{
|
||||||
return normalize(cross(p1 - p2, p1 - p3));
|
return normalize(cross(p1 - p2, p1 - p3));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/normalize_dot.inl
|
// File : glm/gtx/normalize_dot.inl
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType normalizeDot
|
GLM_FUNC_QUALIFIER genType normalizeDot
|
||||||
(
|
(
|
||||||
@ -112,5 +112,4 @@ GLM_FUNC_QUALIFIER valType fastNormalizeDot
|
|||||||
fastInverseSqrt(glm::dot(x, x) *
|
fastInverseSqrt(glm::dot(x, x) *
|
||||||
glm::dot(y, y));
|
glm::dot(y, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/optimum_pow.inl
|
// File : glm/gtx/optimum_pow.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType pow2(const genType& x)
|
GLM_FUNC_QUALIFIER genType pow2(const genType& x)
|
||||||
{
|
{
|
||||||
@ -55,5 +55,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x)
|
|||||||
powOfTwo(x.z),
|
powOfTwo(x.z),
|
||||||
powOfTwo(x.w));
|
powOfTwo(x.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/orthonormalize.inl
|
// File : glm/gtx/orthonormalize.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> orthonormalize
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> orthonormalize
|
||||||
(
|
(
|
||||||
@ -40,5 +40,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> orthonormalize
|
|||||||
{
|
{
|
||||||
return normalize(x - y * dot(y, x));
|
return normalize(x - y * dot(y, x));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -54,24 +54,10 @@ namespace glm
|
|||||||
|
|
||||||
//! Projects x a perpendicular axis of Normal.
|
//! Projects x a perpendicular axis of Normal.
|
||||||
//! From GLM_GTX_perpendicular extension.
|
//! From GLM_GTX_perpendicular extension.
|
||||||
template <typename T>
|
template <typename vecType>
|
||||||
detail::tvec2<T> perp(
|
vecType perp(
|
||||||
detail::tvec2<T> const & x,
|
vecType const & x,
|
||||||
detail::tvec2<T> const & Normal);
|
vecType const & Normal);
|
||||||
|
|
||||||
//! Projects x a perpendicular axis of Normal.
|
|
||||||
//! From GLM_GTX_perpendicular extension.
|
|
||||||
template <typename T>
|
|
||||||
detail::tvec3<T> perp(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & Normal);
|
|
||||||
|
|
||||||
//! Projects x a perpendicular axis of Normal.
|
|
||||||
//! From GLM_GTX_perpendicular extension.
|
|
||||||
template <typename T>
|
|
||||||
detail::tvec4<T> perp(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & Normal);
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,30 +7,15 @@
|
|||||||
// File : glm/gtx/perpendicular.inl
|
// File : glm/gtx/perpendicular.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename vecType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> perp(
|
GLM_FUNC_QUALIFIER vecType perp
|
||||||
detail::tvec2<T> const & x,
|
(
|
||||||
detail::tvec2<T> const & Normal)
|
vecType const & x,
|
||||||
|
vecType const & Normal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return x - proj(x, Normal);
|
return x - proj(x, Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> perp(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & Normal)
|
|
||||||
{
|
|
||||||
return x - proj(x, Normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> perp(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & Normal)
|
|
||||||
{
|
|
||||||
return x - proj(x, Normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -53,12 +53,14 @@ namespace glm
|
|||||||
//! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.
|
//! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.
|
||||||
//! From GLM_GTX_polar_coordinates extension.
|
//! From GLM_GTX_polar_coordinates extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tvec3<T> polar(const detail::tvec3<T>& euclidean);
|
detail::tvec3<T> polar(
|
||||||
|
detail::tvec3<T> const & euclidean);
|
||||||
|
|
||||||
//! Convert Polar to Euclidean coordinates.
|
//! Convert Polar to Euclidean coordinates.
|
||||||
//! From GLM_GTX_polar_coordinates extension.
|
//! From GLM_GTX_polar_coordinates extension.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
detail::tvec3<T> euclidean(const detail::tvec3<T>& polar);
|
detail::tvec3<T> euclidean(
|
||||||
|
detail::tvec3<T> const & polar);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -10,8 +10,10 @@
|
|||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> polar(
|
GLM_FUNC_QUALIFIER detail::tvec3<T> polar
|
||||||
const detail::tvec3<T>& euclidean)
|
(
|
||||||
|
detail::tvec3<T> const & euclidean
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T length = length(euclidean);
|
T length = length(euclidean);
|
||||||
detail::tvec3<T> tmp = euclidean / length;
|
detail::tvec3<T> tmp = euclidean / length;
|
||||||
@ -24,8 +26,10 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean(
|
GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean
|
||||||
const detail::tvec3<T>& polar)
|
(
|
||||||
|
detail::tvec3<T> const & polar
|
||||||
|
)
|
||||||
{
|
{
|
||||||
T latitude = radians(polar.x);
|
T latitude = radians(polar.x);
|
||||||
T longitude = radians(polar.y);
|
T longitude = radians(polar.y);
|
||||||
|
@ -52,24 +52,10 @@ namespace glm
|
|||||||
|
|
||||||
//! Projects x on Normal.
|
//! Projects x on Normal.
|
||||||
//! From GLM_GTX_projection extension.
|
//! From GLM_GTX_projection extension.
|
||||||
template <typename T>
|
template <typename vecType>
|
||||||
detail::tvec2<T> proj(
|
vecType proj(
|
||||||
detail::tvec2<T> const & x,
|
vecType const & x,
|
||||||
detail::tvec2<T> const & Normal);
|
vecType const & Normal);
|
||||||
|
|
||||||
//! Projects x on Normal.
|
|
||||||
//! From GLM_GTX_projection extension.
|
|
||||||
template <typename T>
|
|
||||||
detail::tvec3<T> proj(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & Normal);
|
|
||||||
|
|
||||||
//! Projects x on Normal.
|
|
||||||
//! From GLM_GTX_projection extension.
|
|
||||||
template <typename T>
|
|
||||||
detail::tvec4<T> proj(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & Normal);
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,30 +7,15 @@
|
|||||||
// File : glm/gtx/projection.inl
|
// File : glm/gtx/projection.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename vecType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> proj(
|
GLM_FUNC_QUALIFIER vecType proj
|
||||||
detail::tvec2<T> const & x,
|
(
|
||||||
detail::tvec2<T> const & Normal)
|
vecType const & x,
|
||||||
|
vecType const & Normal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
|
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> proj(
|
|
||||||
detail::tvec3<T> const & x,
|
|
||||||
detail::tvec3<T> const & Normal)
|
|
||||||
{
|
|
||||||
return dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> proj(
|
|
||||||
detail::tvec4<T> const & x,
|
|
||||||
detail::tvec4<T> const & Normal)
|
|
||||||
{
|
|
||||||
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> cross
|
GLM_FUNC_QUALIFIER detail::tvec3<valType> cross
|
||||||
(
|
(
|
||||||
@ -295,5 +295,4 @@ GLM_FUNC_QUALIFIER detail::tquat<T> fastMix
|
|||||||
{
|
{
|
||||||
return glm::normalize(x * (T(1) - a) + (y * a));
|
return glm::normalize(x * (T(1) - a) + (y * a));
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -2,13 +2,15 @@
|
|||||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Created : 2008-10-09
|
// Created : 2008-10-09
|
||||||
// Updated : 2008-10-09
|
// Updated : 2011-10-14
|
||||||
// Licence : This source is under MIT License
|
// Licence : This source is under MIT License
|
||||||
// File : glm/gtx/reciprocal.inl
|
// File : glm/gtx/reciprocal.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
// sec
|
// sec
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType sec
|
GLM_FUNC_QUALIFIER genType sec
|
||||||
@ -21,41 +23,7 @@ GLM_FUNC_QUALIFIER genType sec
|
|||||||
return genType(1) / glm::cos(angle);
|
return genType(1) / glm::cos(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(sec)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> sec
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
sec(angle.x),
|
|
||||||
sec(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> sec
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
sec(angle.x),
|
|
||||||
sec(angle.y),
|
|
||||||
sec(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> sec
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
sec(angle.x),
|
|
||||||
sec(angle.y),
|
|
||||||
sec(angle.z),
|
|
||||||
sec(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// csc
|
// csc
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -69,41 +37,7 @@ GLM_FUNC_QUALIFIER genType csc
|
|||||||
return genType(1) / glm::sin(angle);
|
return genType(1) / glm::sin(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(csc)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> csc
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
csc(angle.x),
|
|
||||||
csc(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> csc
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
csc(angle.x),
|
|
||||||
csc(angle.y),
|
|
||||||
csc(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> csc
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
csc(angle.x),
|
|
||||||
csc(angle.y),
|
|
||||||
csc(angle.z),
|
|
||||||
csc(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// cot
|
// cot
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -117,41 +51,7 @@ GLM_FUNC_QUALIFIER genType cot
|
|||||||
return genType(1) / glm::tan(angle);
|
return genType(1) / glm::tan(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(cot)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> cot
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
cot(angle.x),
|
|
||||||
cot(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> cot
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
cot(angle.x),
|
|
||||||
cot(angle.y),
|
|
||||||
cot(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> cot
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
cot(angle.x),
|
|
||||||
cot(angle.y),
|
|
||||||
cot(angle.z),
|
|
||||||
cot(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// asec
|
// asec
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -165,41 +65,7 @@ GLM_FUNC_QUALIFIER genType asec
|
|||||||
return acos(genType(1) / x);
|
return acos(genType(1) / x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(asec)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> asec
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
asec(x.x),
|
|
||||||
asec(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> asec
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
asec(x.x),
|
|
||||||
asec(x.y),
|
|
||||||
asec(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> asec
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
asec(x.x),
|
|
||||||
asec(x.y),
|
|
||||||
asec(x.z),
|
|
||||||
asec(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acsc
|
// acsc
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -213,41 +79,7 @@ GLM_FUNC_QUALIFIER genType acsc
|
|||||||
return asin(genType(1) / x);
|
return asin(genType(1) / x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(acsc)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> acsc
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
acsc(x.x),
|
|
||||||
acsc(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> acsc
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
acsc(x.x),
|
|
||||||
acsc(x.y),
|
|
||||||
acsc(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> acsc
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
acsc(x.x),
|
|
||||||
acsc(x.y),
|
|
||||||
acsc(x.z),
|
|
||||||
acsc(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acot
|
// acot
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -262,41 +94,7 @@ GLM_FUNC_QUALIFIER genType acot
|
|||||||
return pi_over_2 - atan(x);
|
return pi_over_2 - atan(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(acot)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> acot
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
acot(x.x),
|
|
||||||
acot(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> acot
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
acot(x.x),
|
|
||||||
acot(x.y),
|
|
||||||
acot(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> acot
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
acot(x.x),
|
|
||||||
acot(x.y),
|
|
||||||
acot(x.z),
|
|
||||||
acot(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// sech
|
// sech
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -310,41 +108,7 @@ GLM_FUNC_QUALIFIER genType sech
|
|||||||
return genType(1) / glm::cosh(angle);
|
return genType(1) / glm::cosh(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(sech)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> sech
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
sech(angle.x),
|
|
||||||
sech(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> sech
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
sech(angle.x),
|
|
||||||
sech(angle.y),
|
|
||||||
sech(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> sech
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
sech(angle.x),
|
|
||||||
sech(angle.y),
|
|
||||||
sech(angle.z),
|
|
||||||
sech(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// csch
|
// csch
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -358,41 +122,7 @@ GLM_FUNC_QUALIFIER genType csch
|
|||||||
return genType(1) / glm::sinh(angle);
|
return genType(1) / glm::sinh(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(csch)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> csch
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
csch(angle.x),
|
|
||||||
csch(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> csch
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
csch(angle.x),
|
|
||||||
csch(angle.y),
|
|
||||||
csch(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> csch
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
csch(angle.x),
|
|
||||||
csch(angle.y),
|
|
||||||
csch(angle.z),
|
|
||||||
csch(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// coth
|
// coth
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -406,41 +136,7 @@ GLM_FUNC_QUALIFIER genType coth
|
|||||||
return glm::cosh(angle) / glm::sinh(angle);
|
return glm::cosh(angle) / glm::sinh(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(coth)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> coth
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
coth(angle.x),
|
|
||||||
coth(angle.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> coth
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
coth(angle.x),
|
|
||||||
coth(angle.y),
|
|
||||||
coth(angle.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> coth
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & angle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
coth(angle.x),
|
|
||||||
coth(angle.y),
|
|
||||||
coth(angle.z),
|
|
||||||
coth(angle.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// asech
|
// asech
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -454,41 +150,7 @@ GLM_FUNC_QUALIFIER genType asech
|
|||||||
return acosh(genType(1) / x);
|
return acosh(genType(1) / x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(asech)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> asech
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
asech(x.x),
|
|
||||||
asech(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> asech
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
asech(x.x),
|
|
||||||
asech(x.y),
|
|
||||||
asech(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> asech
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
asech(x.x),
|
|
||||||
asech(x.y),
|
|
||||||
asech(x.z),
|
|
||||||
asech(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acsch
|
// acsch
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -502,41 +164,7 @@ GLM_FUNC_QUALIFIER genType acsch
|
|||||||
return asinh(genType(1) / x);
|
return asinh(genType(1) / x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(acsch)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> acsch
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
acsch(x.x),
|
|
||||||
acsch(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> acsch
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
acsch(x.x),
|
|
||||||
acsch(x.y),
|
|
||||||
acsch(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> acsch
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
acsch(x.x),
|
|
||||||
acsch(x.y),
|
|
||||||
acsch(x.z),
|
|
||||||
acsch(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
// acoth
|
// acoth
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -550,40 +178,5 @@ GLM_FUNC_QUALIFIER genType acoth
|
|||||||
return atanh(genType(1) / x);
|
return atanh(genType(1) / x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename valType>
|
VECTORIZE_VEC(acoth)
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<valType> acoth
|
|
||||||
(
|
|
||||||
detail::tvec2<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec2<valType>(
|
|
||||||
acoth(x.x),
|
|
||||||
acoth(x.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<valType> acoth
|
|
||||||
(
|
|
||||||
detail::tvec3<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec3<valType>(
|
|
||||||
acoth(x.x),
|
|
||||||
acoth(x.y),
|
|
||||||
acoth(x.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename valType>
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<valType> acoth
|
|
||||||
(
|
|
||||||
detail::tvec4<valType> const & x
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return detail::tvec4<valType>(
|
|
||||||
acoth(x.x),
|
|
||||||
acoth(x.y),
|
|
||||||
acoth(x.z),
|
|
||||||
acoth(x.w));
|
|
||||||
}
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,26 +7,30 @@
|
|||||||
// File : glm/gtx/rotate_vector.inl
|
// File : glm/gtx/rotate_vector.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<T> rotate(
|
GLM_FUNC_QUALIFIER detail::tvec2<T> rotate
|
||||||
|
(
|
||||||
detail::tvec2<T> const & v,
|
detail::tvec2<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec2<T> Result;
|
detail::tvec2<T> Result;
|
||||||
const T Cos = cos(radians(angle));
|
T const Cos = cos(radians(angle));
|
||||||
const T Sin = sin(radians(angle));
|
T const Sin = sin(radians(angle));
|
||||||
Result.x = v.x * Cos - v.y * Sin;
|
Result.x = v.x * Cos - v.y * Sin;
|
||||||
Result.y = v.x * Sin + v.y * Cos;
|
Result.y = v.x * Sin + v.y * Cos;
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> rotate(
|
GLM_FUNC_QUALIFIER detail::tvec3<T> rotate
|
||||||
const detail::tvec3<T> & v,
|
(
|
||||||
|
detail::tvec3<T> const & v,
|
||||||
T const & angle,
|
T const & angle,
|
||||||
const detail::tvec3<T> & normal)
|
detail::tvec3<T> const & normal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return detail::tmat3x3<T>(glm::rotate(angle, normal)) * v;
|
return detail::tmat3x3<T>(glm::rotate(angle, normal)) * v;
|
||||||
}
|
}
|
||||||
@ -43,18 +47,22 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateGTX(
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> rotate(
|
GLM_FUNC_QUALIFIER detail::tvec4<T> rotate
|
||||||
|
(
|
||||||
detail::tvec4<T> const & v,
|
detail::tvec4<T> const & v,
|
||||||
T const & angle,
|
T const & angle,
|
||||||
detail::tvec3<T> const & normal)
|
detail::tvec3<T> const & normal
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return rotate(angle, normal) * v;
|
return rotate(angle, normal) * v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX(
|
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX
|
||||||
|
(
|
||||||
detail::tvec3<T> const & v,
|
detail::tvec3<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec3<T> Result = v;
|
detail::tvec3<T> Result = v;
|
||||||
const T Cos = cos(radians(angle));
|
const T Cos = cos(radians(angle));
|
||||||
@ -65,9 +73,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY(
|
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY
|
||||||
|
(
|
||||||
detail::tvec3<T> const & v,
|
detail::tvec3<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec3<T> Result = v;
|
detail::tvec3<T> Result = v;
|
||||||
const T Cos = cos(radians(angle));
|
const T Cos = cos(radians(angle));
|
||||||
@ -78,9 +88,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ(
|
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ
|
||||||
|
(
|
||||||
detail::tvec3<T> const & v,
|
detail::tvec3<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec3<T> Result = v;
|
detail::tvec3<T> Result = v;
|
||||||
const T Cos = cos(radians(angle));
|
const T Cos = cos(radians(angle));
|
||||||
@ -91,9 +103,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX(
|
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX
|
||||||
|
(
|
||||||
detail::tvec4<T> const & v,
|
detail::tvec4<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec4<T> Result = v;
|
detail::tvec4<T> Result = v;
|
||||||
const T Cos = cos(radians(angle));
|
const T Cos = cos(radians(angle));
|
||||||
@ -104,9 +118,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY(
|
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY
|
||||||
|
(
|
||||||
detail::tvec4<T> const & v,
|
detail::tvec4<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec4<T> Result = v;
|
detail::tvec4<T> Result = v;
|
||||||
const T Cos = cos(radians(angle));
|
const T Cos = cos(radians(angle));
|
||||||
@ -117,9 +133,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ(
|
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ
|
||||||
|
(
|
||||||
detail::tvec4<T> const & v,
|
detail::tvec4<T> const & v,
|
||||||
T const & angle)
|
T const & angle
|
||||||
|
)
|
||||||
{
|
{
|
||||||
detail::tvec4<T> Result = v;
|
detail::tvec4<T> Result = v;
|
||||||
const T Cos = cos(radians(angle));
|
const T Cos = cos(radians(angle));
|
||||||
@ -130,9 +148,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation
|
||||||
|
(
|
||||||
detail::tvec3<T> const & Normal,
|
detail::tvec3<T> const & Normal,
|
||||||
detail::tvec3<T> const & Up)
|
detail::tvec3<T> const & Up
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if(all(equal(Normal, Up)))
|
if(all(equal(Normal, Up)))
|
||||||
return detail::tmat4x4<T>(T(1));
|
return detail::tmat4x4<T>(T(1));
|
||||||
@ -141,5 +161,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation(
|
|||||||
T Angle = degrees(acos(dot(Normal, Up)));
|
T Angle = degrees(acos(dot(Normal, Up)));
|
||||||
return rotate(Angle, RotationAxis);
|
return rotate(Angle, RotationAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/transform2.inl
|
// File : glm/gtx/transform2.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearX2D(
|
GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearX2D(
|
||||||
const detail::tmat3x3<T>& m,
|
const detail::tmat3x3<T>& m,
|
||||||
@ -150,6 +150,5 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scaleBias(
|
|||||||
{
|
{
|
||||||
return m * scaleBias(scale, bias);
|
return m * scaleBias(scale, bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
|
103
glm/gtx/ulp.inl
103
glm/gtx/ulp.inl
@ -181,8 +181,8 @@ namespace detail
|
|||||||
# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward))
|
# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
GLM_FUNC_QUALIFIER float next_float(float const & x)
|
GLM_FUNC_QUALIFIER float next_float(float const & x)
|
||||||
{
|
{
|
||||||
return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max());
|
return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max());
|
||||||
@ -296,103 +296,4 @@ GLM_FUNC_QUALIFIER vecType<uint> float_distance(vecType<T> const & x, vecType<T>
|
|||||||
Result[i] = float_distance(x[i], y[i]);
|
Result[i] = float_distance(x[i], y[i]);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
inline std::size_t ulp
|
|
||||||
(
|
|
||||||
detail::thalf const & a,
|
|
||||||
detail::thalf const & b
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::size_t Count = 0;
|
|
||||||
float TempA(a);
|
|
||||||
float TempB(b);
|
|
||||||
//while((TempA = _nextafterf(TempA, TempB)) != TempB)
|
|
||||||
++Count;
|
|
||||||
return Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::size_t ulp
|
|
||||||
(
|
|
||||||
float const & a,
|
|
||||||
float const & b
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::size_t Count = 0;
|
|
||||||
float Temp = a;
|
|
||||||
//while((Temp = _nextafterf(Temp, b)) != b)
|
|
||||||
{
|
|
||||||
std::cout << Temp << " " << b << std::endl;
|
|
||||||
++Count;
|
|
||||||
}
|
|
||||||
return Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::size_t ulp
|
|
||||||
(
|
|
||||||
double const & a,
|
|
||||||
double const & b
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::size_t Count = 0;
|
|
||||||
double Temp = a;
|
|
||||||
//while((Temp = _nextafter(Temp, b)) != b)
|
|
||||||
{
|
|
||||||
std::cout << Temp << " " << b << std::endl;
|
|
||||||
++Count;
|
|
||||||
}
|
|
||||||
return Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline std::size_t ulp
|
|
||||||
(
|
|
||||||
detail::tvec2<T> const & a,
|
|
||||||
detail::tvec2<T> const & b
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::size_t ulps[] =
|
|
||||||
{
|
|
||||||
ulp(a[0], b[0]),
|
|
||||||
ulp(a[1], b[1])
|
|
||||||
};
|
|
||||||
|
|
||||||
return glm::max(ulps[0], ulps[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline std::size_t ulp
|
|
||||||
(
|
|
||||||
detail::tvec3<T> const & a,
|
|
||||||
detail::tvec3<T> const & b
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::size_t ulps[] =
|
|
||||||
{
|
|
||||||
ulp(a[0], b[0]),
|
|
||||||
ulp(a[1], b[1]),
|
|
||||||
ulp(a[2], b[2])
|
|
||||||
};
|
|
||||||
|
|
||||||
return glm::max(glm::max(ulps[0], ulps[1]), ulps[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline std::size_t ulp
|
|
||||||
(
|
|
||||||
detail::tvec4<T> const & a,
|
|
||||||
detail::tvec4<T> const & b
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::size_t ulps[] =
|
|
||||||
{
|
|
||||||
ulp(a[0], b[0]),
|
|
||||||
ulp(a[1], b[1]),
|
|
||||||
ulp(a[2], b[2]),
|
|
||||||
ulp(a[3], b[3])
|
|
||||||
};
|
|
||||||
|
|
||||||
return glm::max(glm::max(ulps[0], ulps[1]), glm::max(ulps[2], ulps[3]));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : glm/gtx/unsigned_int.inl
|
// File : glm/gtx/unsigned_int.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/vector_access.inl
|
// File : glm/gtx/vector_access.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename valType>
|
template <typename valType>
|
||||||
GLM_FUNC_QUALIFIER void set
|
GLM_FUNC_QUALIFIER void set
|
||||||
(
|
(
|
||||||
@ -50,5 +50,4 @@ GLM_FUNC_QUALIFIER void set
|
|||||||
v.z = z;
|
v.z = z;
|
||||||
v.w = w;
|
v.w = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/vector_angle.inl
|
// File : glm/gtx/vector_angle.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER typename genType::value_type angle
|
GLM_FUNC_QUALIFIER typename genType::value_type angle
|
||||||
(
|
(
|
||||||
@ -50,5 +50,4 @@ GLM_FUNC_QUALIFIER valType orientedAngle
|
|||||||
else
|
else
|
||||||
return Angle;
|
return Angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER bool areCollinear
|
GLM_FUNC_QUALIFIER bool areCollinear
|
||||||
(
|
(
|
||||||
@ -166,5 +166,4 @@ GLM_FUNC_QUALIFIER bool areSimilar
|
|||||||
similar = (abs(v0[i] - v1[i]) <= epsilon);
|
similar = (abs(v0[i] - v1[i]) <= epsilon);
|
||||||
return similar;
|
return similar;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
// File : glm/gtx/verbose_operator.inl
|
// File : glm/gtx/verbose_operator.inl
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b)
|
GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b)
|
||||||
{
|
{
|
||||||
@ -121,5 +121,4 @@ GLM_FUNC_QUALIFIER genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV
|
|||||||
{
|
{
|
||||||
return a * b + c;
|
return a * b + c;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
// - GLM core
|
// - GLM core
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm{
|
namespace glm
|
||||||
|
{
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType clamp
|
GLM_FUNC_QUALIFIER genType clamp
|
||||||
(
|
(
|
||||||
@ -162,5 +162,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> mirrorRepeat
|
|||||||
Result[i] = mirrorRepeat(Texcoord[i]);
|
Result[i] = mirrorRepeat(Texcoord[i]);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user