Replaced vecType by vec

This commit is contained in:
Christophe Riccio 2017-08-15 17:32:36 +02:00
parent 8a9582cc5e
commit da84db5481
6 changed files with 260 additions and 147 deletions

View File

@ -165,27 +165,6 @@ glm::vec3 lighting
}
*/
/*
template<typename T, glm::precision P, template<typename, glm::precision> class vecType>
T normalizeDotA(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
{
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
}
#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
template<GLM_TEMPLATE_GENTYPE vecType>
T normalizeDotB(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
{
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
}
template<typename vecType>
typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
{
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
}
*/
int main()
{
/*

View File

@ -29,24 +29,34 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL genType abs(genType x);
/// Returns x if x >= 0; otherwise, it returns -x.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or signed integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> abs(vec<L, T, P> const& x);
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
///
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> sign(vec<L, T, P> const& x);
/// Returns a value equal to the nearest integer that is less then or equal to x.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
///
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
@ -54,10 +64,11 @@ namespace glm
/// Returns a value equal to the nearest integer to x
/// whose absolute value is not larger than the absolute value of x.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
///
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
@ -68,10 +79,11 @@ namespace glm
/// implementation, presumably the direction that is fastest.
/// This includes the possibility that round(x) returns the
/// same value as roundEven(x) for all values of x.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
///
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
@ -80,10 +92,11 @@ namespace glm
/// Returns a value equal to the nearest integer to x.
/// 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.)
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
///
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
@ -92,9 +105,10 @@ namespace glm
/// Returns a value equal to the nearest integer
/// that is greater than or equal to x.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
@ -110,6 +124,14 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL genType fract(genType x);
/// Return x - floor(x).
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> fract(vec<L, T, P> const& x);
@ -123,11 +145,29 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL genType mod(genType x, genType y);
/// Modulus. Returns x - y * floor(x / y)
/// for each component in x using the floating point value y.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const & x, T y);
GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const& x, T y);
/// Modulus. Returns x - y * floor(x / y)
/// for each component in x using the floating point value y.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const & x, vec<L, T, P> const & y);
GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const& x, vec<L, T, P> const& y);
/// Returns the fractional part of x and sets i to the integer
/// part (as a whole number floating point value). Both the
@ -139,7 +179,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<typename genType>
GLM_FUNC_DECL genType modf(genType x, genType & i);
GLM_FUNC_DECL genType modf(genType x, genType& i);
/// Returns y if y < x; otherwise, it returns x.
///
@ -150,9 +190,25 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL genType min(genType x, genType y);
/// Returns y if y < x; otherwise, it returns x.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> min(vec<L, T, P> const& x, T y);
/// Returns y if y < x; otherwise, it returns x.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> min(vec<L, T, P> const& x, vec<L, T, P> const& y);
@ -165,9 +221,25 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL genType max(genType x, genType y);
/// Returns y if x < y; otherwise, it returns x.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> max(vec<L, T, P> const& x, T y);
/// Returns y if x < y; otherwise, it returns x.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> max(vec<L, T, P> const& x, vec<L, T, P> const& y);
@ -181,9 +253,27 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
/// Returns min(max(x, minVal), maxVal) for each component in x
/// using the floating-point values minVal and maxVal.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> clamp(vec<L, T, P> const & x, T minVal, T maxVal);
/// Returns min(max(x, minVal), maxVal) for each component in x
/// using the floating-point values minVal and maxVal.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> clamp(vec<L, T, P> const& x, vec<L, T, P> const& minVal, vec<L, T, P> const& maxVal);
@ -247,8 +337,9 @@ namespace glm
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
@ -257,8 +348,9 @@ namespace glm
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
@ -296,8 +388,9 @@ namespace glm
///
/// /!\ When using compiler fast math, this function may fail.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
@ -310,8 +403,9 @@ namespace glm
/// otherwise, including for implementations with no infinity
/// representations.
///
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
/// @tparam T Floating-point scalar types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
@ -330,10 +424,13 @@ namespace glm
/// the encoding of a floating-point value. The floatingpoint
/// value's bit-level representation is preserved.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, precision P>
GLM_FUNC_DECL vec<L, int, P> floatBitsToInt(vec<L, float, P> const & v);
GLM_FUNC_DECL vec<L, int, P> floatBitsToInt(vec<L, float, P> const& v);
/// Returns a unsigned integer value representing
/// the encoding of a floating-point value. The floatingpoint
@ -346,7 +443,10 @@ namespace glm
/// Returns a unsigned integer value representing
/// the encoding of a floating-point value. The floatingpoint
/// value's bit-level representation is preserved.
///
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, precision P>
@ -368,6 +468,9 @@ namespace glm
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, precision P>
@ -389,6 +492,9 @@ namespace glm
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template<length_t L, precision P>

View File

@ -24,50 +24,60 @@ namespace glm
/// Converts degrees to radians and returns the result.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL GLM_CONSTEXPR vecType<L, T, P> radians(vecType<L, T, P> const & degrees);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, P> radians(vec<L, T, P> const& degrees);
/// Converts radians to degrees and returns the result.
///
/// @tparam vecType Floating-point scalar or vector types.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL GLM_CONSTEXPR vecType<L, T, P> degrees(vecType<L, T, P> const & radians);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, P> degrees(vec<L, T, P> const& radians);
/// The standard trigonometric sine function.
/// The values returned by this function will range from [-1, 1].
///
/// @tparam vecType Floating-point scalar or vector types.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> sin(vecType<L, T, P> const & angle);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> sin(vec<L, T, P> const& angle);
/// The standard trigonometric cosine function.
/// The values returned by this function will range from [-1, 1].
///
/// @tparam vecType Floating-point scalar or vector types.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> cos(vecType<L, T, P> const & angle);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> cos(vec<L, T, P> const& angle);
/// The standard trigonometric tangent function.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> tan(vecType<L, T, P> const & angle);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> tan(vec<L, T, P> const& angle);
/// Arc sine. Returns an angle whose sine is x.
/// The range of values returned by this function is [-PI/2, PI/2].
@ -77,19 +87,21 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> asin(vecType<L, T, P> const & x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> asin(vec<L, T, P> const& x);
/// Arc cosine. Returns an angle whose sine is x.
/// The range of values returned by this function is [0, PI].
/// Results are undefined if |x| > 1.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> acos(vecType<L, T, P> const & x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> acos(vec<L, T, P> const& x);
/// Arc tangent. Returns an angle whose tangent is y/x.
/// The signs of x and y are used to determine what
@ -97,78 +109,94 @@ namespace glm
/// by this function is [-PI, PI]. Results are undefined
/// if x and y are both 0.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> atan(vecType<L, T, P> const & y, vecType<L, T, P> const & x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> atan(vec<L, T, P> const& y, vec<L, T, P> const& x);
/// Arc tangent. Returns an angle whose tangent is y_over_x.
/// The range of values returned by this function is [-PI/2, PI/2].
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> atan(vecType<L, T, P> const & y_over_x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> atan(vec<L, T, P> const& y_over_x);
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> sinh(vecType<L, T, P> const & angle);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> sinh(vec<L, T, P> const& angle);
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> cosh(vecType<L, T, P> const & angle);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> cosh(vec<L, T, P> const& angle);
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> tanh(vecType<L, T, P> const & angle);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> tanh(vec<L, T, P> const& angle);
/// Arc hyperbolic sine; returns the inverse of sinh.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> asinh(vecType<L, T, P> const & x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> asinh(vec<L, T, P> const& x);
/// Arc hyperbolic cosine; returns the non-negative inverse
/// of cosh. Results are undefined if x < 1.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> acosh(vecType<L, T, P> const & x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> acosh(vec<L, T, P> const& x);
/// Arc hyperbolic tangent; returns the inverse of tanh.
/// Results are undefined if abs(x) >= 1.
///
/// @tparam vecType Floating-point scalar or vector types.
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point scalar types
/// @tparam P Enumeration value precision
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, T, P> atanh(vecType<L, T, P> const & x);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, T, P> atanh(vec<L, T, P> const& x);
/// @}
}//namespace glm

View File

@ -16,8 +16,8 @@ namespace glm
return degrees * static_cast<genType>(0.01745329251994329576923690768489);
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<L, T, P> radians(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, P> radians(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(radians, v);
}
@ -31,8 +31,8 @@ namespace glm
return radians * static_cast<genType>(57.295779513082320876798154814105);
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<L, T, P> degrees(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, T, P> degrees(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(degrees, v);
}
@ -40,8 +40,8 @@ namespace glm
// sin
using ::std::sin;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> sin(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> sin(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(sin, v);
}
@ -49,8 +49,8 @@ namespace glm
// cos
using std::cos;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> cos(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> cos(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(cos, v);
}
@ -58,8 +58,8 @@ namespace glm
// tan
using std::tan;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> tan(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> tan(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(tan, v);
}
@ -67,8 +67,8 @@ namespace glm
// asin
using std::asin;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> asin(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> asin(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(asin, v);
}
@ -76,8 +76,8 @@ namespace glm
// acos
using std::acos;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> acos(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> acos(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(acos, v);
}
@ -91,16 +91,16 @@ namespace glm
return ::std::atan2(y, x);
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> atan(vecType<L, T, P> const & a, vecType<L, T, P> const & b)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> atan(vec<L, T, P> const& a, vec<L, T, P> const& b)
{
return detail::functor2<L, T, P>::call(::std::atan2, a, b);
}
using std::atan;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> atan(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> atan(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(atan, v);
}
@ -108,8 +108,8 @@ namespace glm
// sinh
using std::sinh;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> sinh(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> sinh(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(sinh, v);
}
@ -117,8 +117,8 @@ namespace glm
// cosh
using std::cosh;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> cosh(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> cosh(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(cosh, v);
}
@ -126,8 +126,8 @@ namespace glm
// tanh
using std::tanh;
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> tanh(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> tanh(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(tanh, v);
}
@ -145,8 +145,8 @@ namespace glm
}
# endif
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> asinh(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> asinh(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(asinh, v);
}
@ -166,8 +166,8 @@ namespace glm
}
# endif
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> acosh(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> acosh(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(acosh, v);
}
@ -187,8 +187,8 @@ namespace glm
}
# endif
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> atanh(vecType<L, T, P> const & v)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, T, P> atanh(vec<L, T, P> const& v)
{
return detail::functor1<L, T, T, P>::call(atanh, v);
}

View File

@ -151,17 +151,17 @@ namespace bitfieldReverse
return Result;
}
*/
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverseLoop(vecType<L, T, P> const & v)
template<glm::length_t L, typename T, glm::precision P>
GLM_FUNC_QUALIFIER glm::vec<L, T, P> bitfieldReverseLoop(glm::vec<L, T, P> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldReverse' only accept integer values");
vecType<L, T, P> Result(0);
glm::vec<L, T, P> Result(0);
T const BitSize = static_cast<T>(sizeof(T) * 8);
for(T i = 0; i < BitSize; ++i)
{
vecType<L, T, P> const BitSet(v & (static_cast<T>(1) << i));
vecType<L, T, P> const BitFirst(BitSet >> i);
glm::vec<L, T, P> const BitSet(v & (static_cast<T>(1) << i));
glm::vec<L, T, P> const BitFirst(BitSet >> i);
Result |= BitFirst << (BitSize - 1 - i);
}
return Result;
@ -197,8 +197,8 @@ namespace bitfieldReverse
template<bool EXEC = false>
struct compute_bitfieldReverseStep
{
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T, T)
template<glm::length_t L, typename T, glm::precision P>
GLM_FUNC_QUALIFIER static glm::vec<L, T, P> call(glm::vec<L, T, P> const & v, T, T)
{
return v;
}
@ -207,17 +207,17 @@ namespace bitfieldReverse
template<>
struct compute_bitfieldReverseStep<true>
{
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Mask, T Shift)
template<glm::length_t L, typename T, glm::precision P>
GLM_FUNC_QUALIFIER static glm::vec<L, T, P> call(glm::vec<L, T, P> const & v, T Mask, T Shift)
{
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
}
};
template<glm::length_t L, typename T, glm::precision P, template<glm::length_t, typename, glm::precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverseOps(vecType<L, T, P> const & v)
template<glm::length_t L, typename T, glm::precision P>
GLM_FUNC_QUALIFIER glm::vec<L, T, P> bitfieldReverseOps(glm::vec<L, T, P> const & v)
{
vecType<L, T, P> x(v);
glm::vec<L, T, P> x(v);
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));

View File

@ -169,7 +169,7 @@ namespace log2_
std::clock_t Begin = clock();
for(int i = 0; i < static_cast<int>(Count); ++i)
Result[i] = glm::log2(glm::vec4(i));
Result[i] = glm::log2(glm::vec4(static_cast<float>(i)));
std::clock_t End = clock();