Fix merge

This commit is contained in:
Christophe Riccio 2014-02-25 21:00:25 +01:00
commit ce431012c9
53 changed files with 572 additions and 704 deletions

View File

@ -29,10 +29,20 @@
#ifndef GLM_CORE_DETAIL_INCLUDED #ifndef GLM_CORE_DETAIL_INCLUDED
#define GLM_CORE_DETAIL_INCLUDED #define GLM_CORE_DETAIL_INCLUDED
#include "type_vec1.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
#include "type_vec3.hpp" #include "type_vec3.hpp"
#include "type_vec4.hpp" #include "type_vec4.hpp"
#define VECTORIZE1_VEC(func) \
template <typename T, precision P> \
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func( \
detail::tvec1<T, P> const & v) \
{ \
return detail::tvec1<T, P>( \
func(v.x)); \
}
#define VECTORIZE2_VEC(func) \ #define VECTORIZE2_VEC(func) \
template <typename T, precision P> \ template <typename T, precision P> \
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \ GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \
@ -67,10 +77,23 @@
} }
#define VECTORIZE_VEC(func) \ #define VECTORIZE_VEC(func) \
VECTORIZE1_VEC(func) \
VECTORIZE2_VEC(func) \ VECTORIZE2_VEC(func) \
VECTORIZE3_VEC(func) \ VECTORIZE3_VEC(func) \
VECTORIZE4_VEC(func) VECTORIZE4_VEC(func)
#define VECTORIZE1_VEC_SCA(func) \
template <typename T, precision P> \
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func \
( \
detail::tvec1<T, P> const & x, \
T const & y \
) \
{ \
return detail::tvec1<T, P>( \
func(x.x, y)); \
}
#define VECTORIZE2_VEC_SCA(func) \ #define VECTORIZE2_VEC_SCA(func) \
template <typename T, precision P> \ template <typename T, precision P> \
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \ GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
@ -114,6 +137,7 @@
} }
#define VECTORIZE_VEC_SCA(func) \ #define VECTORIZE_VEC_SCA(func) \
VECTORIZE1_VEC_SCA(func) \
VECTORIZE2_VEC_SCA(func) \ VECTORIZE2_VEC_SCA(func) \
VECTORIZE3_VEC_SCA(func) \ VECTORIZE3_VEC_SCA(func) \
VECTORIZE4_VEC_SCA(func) VECTORIZE4_VEC_SCA(func)

View File

@ -70,6 +70,8 @@ namespace detail
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a) GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x)); return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
} }
}; };
@ -91,6 +93,8 @@ namespace detail
{ {
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a) GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x)); return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
} }
}; };
@ -109,6 +113,8 @@ namespace detail
{ {
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, U const & a) GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, U const & a)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x)); return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x));
} }
}; };

View File

@ -99,7 +99,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType log2(genType const & x); GLM_FUNC_DECL genType log2(genType x);
/// Returns the positive square root of x. /// Returns the positive square root of x.
/// ///
@ -108,8 +108,11 @@ namespace glm
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType> //template <typename genType>
GLM_FUNC_DECL genType sqrt(genType const & x); //GLM_FUNC_DECL genType sqrt(genType const & x);
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & x);
/// Returns the reciprocal of the positive square root of x. /// Returns the reciprocal of the positive square root of x.
/// ///

View File

@ -31,8 +31,52 @@
#include <limits> #include <limits>
#include <cassert> #include <cassert>
namespace glm namespace glm{
namespace detail
{ {
template <bool isFloat>
struct compute_log2
{
template <typename T>
T operator() (T const & Value) const;
};
template <>
struct compute_log2<true>
{
template <typename T>
T operator() (T const & Value) const
{
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
}
};
template <template <class, precision> class vecType, typename T, precision P>
struct compute_inversesqrt
{
static vecType<T, P> call(vecType<T, P> const & x)
{
return static_cast<T>(1) / sqrt(x);
}
};
template <template <class, precision> class vecType>
struct compute_inversesqrt<vecType, float, lowp>
{
static vecType<float, lowp> call(vecType<float, lowp> const & x)
{
vecType<float, lowp> tmp(x);
vecType<float, lowp> xhalf(tmp * 0.5f);
vecType<uint, lowp>* p = reinterpret_cast<vecType<uint, lowp>*>(const_cast<vecType<float, lowp>*>(&x));
vecType<uint, lowp> i = vecType<uint, lowp>(0x5f375a86) - (*p >> vecType<uint, lowp>(1));
vecType<float, lowp>* ptmp = reinterpret_cast<vecType<float, lowp>*>(&i);
tmp = *ptmp;
tmp = tmp * (1.5f - xhalf * tmp * tmp);
return tmp;
}
};
}//namespace detail
// pow // pow
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType pow GLM_FUNC_QUALIFIER genType pow
@ -84,10 +128,7 @@ namespace glm
//exp2, ln2 = 0.69314718055994530941723212145818f //exp2, ln2 = 0.69314718055994530941723212145818f
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType exp2 GLM_FUNC_QUALIFIER genType exp2(genType const & x)
(
genType const & x
)
{ {
GLM_STATIC_ASSERT( GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_iec559,
@ -98,33 +139,9 @@ namespace glm
VECTORIZE_VEC(exp2) VECTORIZE_VEC(exp2)
namespace detail
{
template <bool isFloat>
struct compute_log2
{
template <typename T>
T operator() (T const & Value) const;
};
template <>
struct compute_log2<true>
{
template <typename T>
T operator() (T const & Value) const
{
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
}
};
}//namespace detail
// log2, ln2 = 0.69314718055994530941723212145818f // log2, ln2 = 0.69314718055994530941723212145818f
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType log2 GLM_FUNC_QUALIFIER genType log2(genType x)
(
genType const & x
)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
"GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support."); "GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support.");
@ -135,51 +152,66 @@ namespace detail
VECTORIZE_VEC(log2) VECTORIZE_VEC(log2)
// sqrt
template <typename genType>
GLM_FUNC_QUALIFIER genType sqrt
(
genType const & x
)
{
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'sqrt' only accept floating-point inputs");
assert(x >= genType(0));
return std::sqrt(x);
}
VECTORIZE_VEC(sqrt)
namespace detail namespace detail
{ {
template <template <class, precision> class vecType, typename T, precision P> template <template <class, precision> class vecType, typename T, precision P>
struct compute_inversesqrt struct compute_sqrt{};
template <typename T, precision P>
struct compute_sqrt<detail::tvec1, T, P>
{ {
static vecType<T, P> call(vecType<T, P> const & x) static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x)
{ {
return static_cast<T>(1) / sqrt(x); return detail::tvec1<T, P>(std::sqrt(x.x));
} }
}; };
template <template <class, precision> class vecType> template <typename T, precision P>
struct compute_inversesqrt<vecType, float, lowp> struct compute_sqrt<detail::tvec2, T, P>
{ {
static vecType<float, lowp> call(vecType<float, lowp> const & x) static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x)
{ {
vecType<float, lowp> tmp(x); return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y));
vecType<float, lowp> xhalf(tmp * 0.5f); }
vecType<uint, lowp> i = *reinterpret_cast<vecType<uint, lowp>*>(const_cast<vecType<float, lowp>*>(&x)); };
i = vecType<uint, lowp>(0x5f375a86) - (i >> vecType<uint, lowp>(1));
tmp = *reinterpret_cast<vecType<float, lowp>*>(&i); template <typename T, precision P>
tmp = tmp * (1.5f - xhalf * tmp * tmp); struct compute_sqrt<detail::tvec3, T, P>
return tmp; {
static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x)
{
return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z));
}
};
template <typename T, precision P>
struct compute_sqrt<detail::tvec4, T, P>
{
static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x)
{
return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w));
} }
}; };
}//namespace detail }//namespace detail
// sqrt
GLM_FUNC_QUALIFIER float sqrt(float x)
{
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x;
}
GLM_FUNC_QUALIFIER double sqrt(double x)
{
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x;
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
return detail::compute_sqrt<vecType, T, P>::call(x);
}
// inversesqrt // inversesqrt
GLM_FUNC_QUALIFIER float inversesqrt(float const & x) GLM_FUNC_QUALIFIER float inversesqrt(float const & x)
{ {

View File

@ -100,7 +100,8 @@ namespace glm
detail::toFloat16(v.x), detail::toFloat16(v.x),
detail::toFloat16(v.y)); detail::toFloat16(v.y));
return *reinterpret_cast<uint*>(&Unpack); uint * Result = reinterpret_cast<uint*>(&Unpack);
return *Result;
} }
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)

View File

@ -48,7 +48,11 @@ GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
//dot //dot
GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2) GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
{ {
<<<<<<< HEAD
# if(GLM_ARCH & GLM_ARCH_AVX) # if(GLM_ARCH & GLM_ARCH_AVX)
=======
# if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
>>>>>>> 0.9.5
return _mm_dp_ps(v1, v2, 0xff); return _mm_dp_ps(v1, v2, 0xff);
# else # else
__m128 mul0 = _mm_mul_ps(v1, v2); __m128 mul0 = _mm_mul_ps(v1, v2);

View File

@ -576,8 +576,8 @@
#define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_SSE2 0x0001 #define GLM_ARCH_SSE2 0x0001
#define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2 #define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2
#define GLM_ARCH_AVX 0x0004// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
#define GLM_ARCH_AVX2 0x0008// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
#if(defined(GLM_FORCE_PURE)) #if(defined(GLM_FORCE_PURE))
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
@ -601,36 +601,16 @@
# else # else
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
# endif # endif
#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64))) #elif(GLM_COMPILER & GLM_COMPILER_VC)
# if(GLM_PLATFORM == GLM_PLATFORM_WINCE) # if _M_IX86_FP == 2 && defined(__AVX__)
# define GLM_ARCH GLM_ARCH_PURE
# elif(defined(_M_CEE_PURE))
# define GLM_ARCH GLM_ARCH_PURE
/* TODO: Explore auto detection of instruction set support
# elif(defined(_M_IX86_FP))
# if(_M_IX86_FP >= 3)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(_M_IX86_FP >= 2)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH GLM_ARCH_PURE
# endif
*/
# elif(GLM_COMPILER >= GLM_COMPILER_VC11)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(GLM_COMPILER >= GLM_COMPILER_VC10) # elif _M_IX86_FP == 2
# if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version # define GLM_ARCH (GLM_ARCH_SSE2)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)//GLM_ARCH_AVX (Require SP1)
# else
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# endif
# elif(GLM_COMPILER >= GLM_COMPILER_VC9)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(GLM_COMPILER >= GLM_COMPILER_VC8)
# define GLM_ARCH GLM_ARCH_SSE2
# else # else
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH (GLM_ARCH_PURE)
# endif # endif
#elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC))
# define GLM_ARCH GLM_ARCH_PURE
#else #else
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
#endif #endif

View File

@ -80,37 +80,22 @@ namespace detail
ctor Null); ctor Null);
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL explicit tmat2x2(
T const & x); T const & x);
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL tmat2x2(
T const & x1, T const & y1, T const & x1, T const & y1,
T const & x2, T const & y2); T const & x2, T const & y2);
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL tmat2x2(
col_type const & v1, col_type const & v1,
col_type const & v2); col_type const & v2);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat2x2(std::initializer_list<U> l);
GLM_FUNC_DECL tmat2x2(std::initializer_list<tvec2<T, P> > l);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U, typename V, typename M, typename N> template <typename U, typename V, typename M, typename N>
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL tmat2x2(
U const & x1, V const & y1, U const & x1, V const & y1,
M const & x2, N const & y2); M const & x2, N const & y2);
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL tmat2x2(
tvec2<U, P> const & v1, tvec2<U, P> const & v1,
tvec2<V, P> const & v2); tvec2<V, P> const & v2);

View File

@ -118,29 +118,6 @@ namespace detail
this->value[1] = v1; this->value[1] = v1;
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec2<T, P>(*(p + 0), *(p + 1));
this->value[1] = tvec2<T, P>(*(p + 2), *(p + 3));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(std::initializer_list<tvec2<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>

View File

@ -73,37 +73,22 @@ namespace detail
ctor); ctor);
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL explicit tmat2x3(
T const & s); T const & s);
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL tmat2x3(
T const & x0, T const & y0, T const & z0, T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1); T const & x1, T const & y1, T const & z1);
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL tmat2x3(
col_type const & v0, col_type const & v0,
col_type const & v1); col_type const & v1);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat2x3(std::initializer_list<U> m);
GLM_FUNC_DECL tmat2x3(std::initializer_list<tvec3<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat2x3(tmat2x3<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2> template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2); X2 const & x2, Y2 const & y2, Z2 const & z2);
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL tmat2x3(
tvec3<U, P> const & v1, tvec3<U, P> const & v1,
tvec3<V, P> const & v2); tvec3<V, P> const & v2);

View File

@ -128,29 +128,6 @@ namespace detail
this->value[1] = v1; this->value[1] = v1;
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec3<T, P>(*(p + 0), *(p + 1), *(p + 2));
this->value[1] = tvec3<T, P>(*(p + 3), *(p + 4), *(p + 5));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(std::initializer_list<tvec3<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>

View File

@ -73,39 +73,24 @@ namespace detail
ctor); ctor);
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL explicit tmat2x4(
T const & s); T const & s);
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL tmat2x4(
T const & x0, T const & y0, T const & z0, T const & w0, T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1); T const & x1, T const & y1, T const & z1, T const & w1);
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL tmat2x4(
col_type const & v0, col_type const & v0,
col_type const & v1); col_type const & v1);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat2x4(std::initializer_list<U> m);
GLM_FUNC_DECL tmat2x4(std::initializer_list<tvec4<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat2x4(tmat2x4<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2> typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL tmat2x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2); X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x4( GLM_FUNC_DECL tmat2x4(
tvec4<U, P> const & v1, tvec4<U, P> const & v1,
tvec4<V, P> const & v2); tvec4<V, P> const & v2);

View File

@ -131,29 +131,6 @@ namespace detail
this->value[1] = v1; this->value[1] = v1;
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(std::initializer_list<tvec4<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>

View File

@ -73,44 +73,28 @@ namespace detail
ctor); ctor);
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL explicit tmat3x2(
T const & s); T const & s);
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL tmat3x2(
T const & x0, T const & y0, T const & x0, T const & y0,
T const & x1, T const & y1, T const & x1, T const & y1,
T const & x2, T const & y2); T const & x2, T const & y2);
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL tmat3x2(
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2); col_type const & v2);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat3x2(std::initializer_list<U> l);
GLM_FUNC_DECL tmat3x2(std::initializer_list<tvec2<T, P> > l);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat3x2(tmat3x2<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
this->value[2] = std::move(m.value[2]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template< template<
typename X1, typename Y1, typename X1, typename Y1,
typename X2, typename Y2, typename X2, typename Y2,
typename X3, typename Y3> typename X3, typename Y3>
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL tmat3x2(
X1 const & x1, Y1 const & y1, X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2, X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3); X3 const & x3, Y3 const & y3);
template <typename V1, typename V2, typename V3> template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL explicit tmat3x2( GLM_FUNC_DECL tmat3x2(
tvec2<V1, P> const & v1, tvec2<V1, P> const & v1,
tvec2<V2, P> const & v2, tvec2<V2, P> const & v2,
tvec2<V3, P> const & v3); tvec2<V3, P> const & v3);

View File

@ -136,31 +136,6 @@ namespace detail
this->value[2] = v2; this->value[2] = v2;
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec2<T, P>(*(p + 0), *(p + 1));
this->value[1] = tvec2<T, P>(*(p + 2), *(p + 3));
this->value[2] = tvec2<T, P>(*(p + 4), *(p + 5));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(std::initializer_list<tvec2<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>

View File

@ -78,44 +78,28 @@ namespace detail
ctor Null); ctor Null);
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL explicit tmat3x3(
T const & s); T const & s);
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL tmat3x3(
T const & x0, T const & y0, T const & z0, T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1, T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2); T const & x2, T const & y2, T const & z2);
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL tmat3x3(
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2); col_type const & v2);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat3x3(std::initializer_list<U> m);
GLM_FUNC_DECL tmat3x3(std::initializer_list<tvec3<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat3x3(tmat3x3<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
this->value[2] = std::move(m.value[2]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template< template<
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2, typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3> typename X3, typename Y3, typename Z3>
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL tmat3x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2, X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3); X3 const & x3, Y3 const & y3, Z3 const & z3);
template <typename V1, typename V2, typename V3> template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL explicit tmat3x3( GLM_FUNC_DECL tmat3x3(
tvec3<V1, P> const & v1, tvec3<V1, P> const & v1,
tvec3<V2, P> const & v2, tvec3<V2, P> const & v2,
tvec3<V3, P> const & v3); tvec3<V3, P> const & v3);

View File

@ -139,31 +139,6 @@ namespace detail
this->value[2] = v2; this->value[2] = v2;
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec3<T, P>(*(p + 0), *(p + 1), *(p + 2));
this->value[1] = tvec3<T, P>(*(p + 3), *(p + 4), *(p + 5));
this->value[2] = tvec3<T, P>(*(p + 6), *(p + 7), *(p + 8));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(std::initializer_list<tvec3<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>

View File

@ -73,44 +73,28 @@ namespace detail
ctor Null); ctor Null);
GLM_FUNC_DECL explicit tmat3x4( GLM_FUNC_DECL explicit tmat3x4(
T const & s); T const & s);
GLM_FUNC_DECL explicit tmat3x4( GLM_FUNC_DECL tmat3x4(
T const & x0, T const & y0, T const & z0, T const & w0, T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1, T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2); T const & x2, T const & y2, T const & z2, T const & w2);
GLM_FUNC_DECL explicit tmat3x4( GLM_FUNC_DECL tmat3x4(
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2); col_type const & v2);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat3x4(std::initializer_list<U> m);
GLM_FUNC_DECL tmat3x4(std::initializer_list<tvec4<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat3x4(tmat3x4<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
this->value[2] = std::move(m.value[2]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template< template<
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2, typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3> typename X3, typename Y3, typename Z3, typename W3>
GLM_FUNC_DECL explicit tmat3x4( GLM_FUNC_DECL tmat3x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3); X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3);
template <typename V1, typename V2, typename V3> template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL explicit tmat3x4( GLM_FUNC_DECL tmat3x4(
tvec4<V1, P> const & v1, tvec4<V1, P> const & v1,
tvec4<V2, P> const & v2, tvec4<V2, P> const & v2,
tvec4<V3, P> const & v3); tvec4<V3, P> const & v3);

View File

@ -170,31 +170,6 @@ namespace detail
this->value[2] = col_type(v3); this->value[2] = col_type(v3);
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
this->value[2] = tvec4<T, P>(*(p + 8), *(p + 9), *(p + 10), *(p + 11));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(std::initializer_list<tvec4<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
}
#endif//GLM_HAS_INITIALIZER_LISTS
// Conversion // Conversion
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>

View File

@ -73,34 +73,17 @@ namespace detail
ctor Null); ctor Null);
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL explicit tmat4x2(
T const & x); T const & x);
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL tmat4x2(
T const & x0, T const & y0, T const & x0, T const & y0,
T const & x1, T const & y1, T const & x1, T const & y1,
T const & x2, T const & y2, T const & x2, T const & y2,
T const & x3, T const & y3); T const & x3, T const & y3);
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL tmat4x2(
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2, col_type const & v2,
col_type const & v3); col_type const & v3);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat4x2(std::initializer_list<U> m);
GLM_FUNC_DECL tmat4x2(std::initializer_list<tvec2<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat4x2(tmat4x2<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
this->value[2] = std::move(m.value[2]);
this->value[3] = std::move(m.value[3]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
@ -109,14 +92,14 @@ namespace detail
typename X2, typename Y2, typename X2, typename Y2,
typename X3, typename Y3, typename X3, typename Y3,
typename X4, typename Y4> typename X4, typename Y4>
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL tmat4x2(
X1 const & x1, Y1 const & y1, X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2, X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3, X3 const & x3, Y3 const & y3,
X4 const & x4, Y4 const & y4); X4 const & x4, Y4 const & y4);
template <typename V1, typename V2, typename V3, typename V4> template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL explicit tmat4x2( GLM_FUNC_DECL tmat4x2(
tvec2<V1, P> const & v1, tvec2<V1, P> const & v1,
tvec2<V2, P> const & v2, tvec2<V2, P> const & v2,
tvec2<V3, P> const & v3, tvec2<V3, P> const & v3,

View File

@ -181,33 +181,6 @@ namespace detail
this->value[3] = col_type(v4); this->value[3] = col_type(v4);
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec2<T, P>(*(p + 0), *(p + 1));
this->value[1] = tvec2<T, P>(*(p + 2), *(p + 3));
this->value[2] = tvec2<T, P>(*(p + 4), *(p + 5));
this->value[3] = tvec2<T, P>(*(p + 6), *(p + 7));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(std::initializer_list<tvec2<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
this->value[3] = l.begin()[3];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion // Conversion
template <typename T, precision P> template <typename T, precision P>

View File

@ -73,34 +73,17 @@ namespace detail
ctor Null); ctor Null);
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL explicit tmat4x3(
T const & x); T const & x);
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL tmat4x3(
T const & x0, T const & y0, T const & z0, T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1, T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2, T const & x2, T const & y2, T const & z2,
T const & x3, T const & y3, T const & z3); T const & x3, T const & y3, T const & z3);
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL tmat4x3(
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2, col_type const & v2,
col_type const & v3); col_type const & v3);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat4x3(std::initializer_list<U> m);
GLM_FUNC_DECL tmat4x3(std::initializer_list<tvec3<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat4x3(tmat4x3<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
this->value[2] = std::move(m.value[2]);
this->value[3] = std::move(m.value[3]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
@ -109,14 +92,14 @@ namespace detail
typename X2, typename Y2, typename Z2, typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3, typename X3, typename Y3, typename Z3,
typename X4, typename Y4, typename Z4> typename X4, typename Y4, typename Z4>
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL tmat4x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2, X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3, X3 const & x3, Y3 const & y3, Z3 const & z3,
X4 const & x4, Y4 const & y4, Z4 const & z4); X4 const & x4, Y4 const & y4, Z4 const & z4);
template <typename V1, typename V2, typename V3, typename V4> template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL explicit tmat4x3( GLM_FUNC_DECL tmat4x3(
tvec3<V1, P> const & v1, tvec3<V1, P> const & v1,
tvec3<V2, P> const & v2, tvec3<V2, P> const & v2,
tvec3<V3, P> const & v3, tvec3<V3, P> const & v3,

View File

@ -140,33 +140,6 @@ namespace detail
this->value[3] = v3; this->value[3] = v3;
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec3<T, P>(*(p + 0), *(p + 1), *(p + 2));
this->value[1] = tvec3<T, P>(*(p + 3), *(p + 4), *(p + 5));
this->value[2] = tvec3<T, P>(*(p + 6), *(p + 7), *(p + 8));
this->value[3] = tvec3<T, P>(*(p + 9), *(p + 10), *(p + 11));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(std::initializer_list<tvec3<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
this->value[3] = l.begin()[3];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors

View File

@ -32,12 +32,6 @@
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec4.hpp" #include "type_vec4.hpp"
#include "type_mat.hpp" #include "type_mat.hpp"
#if GLM_HAS_INITIALIZER_LISTS
# include <initializer_list>
#endif
#if GLM_HAS_RVALUE_REFERENCES
# include <algorithm>
#endif
#include <limits> #include <limits>
#include <cstddef> #include <cstddef>
@ -77,34 +71,17 @@ namespace detail
ctor Null); ctor Null);
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL explicit tmat4x4(
T const & x); T const & x);
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL tmat4x4(
T const & x0, T const & y0, T const & z0, T const & w0, T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1, T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2, T const & x2, T const & y2, T const & z2, T const & w2,
T const & x3, T const & y3, T const & z3, T const & w3); T const & x3, T const & y3, T const & z3, T const & w3);
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL tmat4x4(
col_type const & v0, col_type const & v0,
col_type const & v1, col_type const & v1,
col_type const & v2, col_type const & v2,
col_type const & v3); col_type const & v3);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat4x4(std::initializer_list<U> m);
GLM_FUNC_DECL tmat4x4(std::initializer_list<tvec4<T, P> > m);
# endif//GLM_HAS_INITIALIZER_LISTS
# if(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> && m)
{
this->value[0] = std::move(m.value[0]);
this->value[1] = std::move(m.value[1]);
this->value[2] = std::move(m.value[2]);
this->value[3] = std::move(m.value[3]);
}
# endif//(GLM_HAS_DEFAULTED_FUNCTIONS && GLM_HAS_RVALUE_REFERENCES)
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
@ -113,14 +90,14 @@ namespace detail
typename X2, typename Y2, typename Z2, typename W2, typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3, typename X3, typename Y3, typename Z3, typename W3,
typename X4, typename Y4, typename Z4, typename W4> typename X4, typename Y4, typename Z4, typename W4>
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL tmat4x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3, X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4); X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
template <typename V1, typename V2, typename V3, typename V4> template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL explicit tmat4x4( GLM_FUNC_DECL tmat4x4(
tvec4<V1, P> const & v1, tvec4<V1, P> const & v1,
tvec4<V2, P> const & v2, tvec4<V2, P> const & v2,
tvec4<V3, P> const & v3, tvec4<V3, P> const & v3,

View File

@ -162,33 +162,6 @@ namespace detail
this->value[3] = col_type(m[3]); this->value[3] = col_type(m[3]);
} }
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
this->value[2] = tvec4<T, P>(*(p + 8), *(p + 9), *(p + 10), *(p + 11));
this->value[3] = tvec4<T, P>(*(p + 12), *(p + 13), *(p + 14), *(p + 15));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<tvec4<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
this->value[3] = l.begin()[3];
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P> template <typename T, precision P>

View File

@ -38,9 +38,6 @@
# include "_swizzle_func.hpp" # include "_swizzle_func.hpp"
# endif # endif
#endif //GLM_SWIZZLE #endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef> #include <cstddef>
namespace glm{ namespace glm{
@ -82,11 +79,6 @@ namespace detail
template <precision Q> template <precision Q>
GLM_FUNC_DECL tvec1(tvec1<T, Q> const & v); GLM_FUNC_DECL tvec1(tvec1<T, Q> const & v);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec1(std::initializer_list<U> l);
# endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors

View File

@ -71,16 +71,6 @@ namespace detail
x(v.x) x(v.x)
{} {}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(std::initializer_list<U> l) :
x(static_cast<T>(l.begin()[0]))
{
assert(l.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors

View File

@ -38,9 +38,6 @@
# include "_swizzle_func.hpp" # include "_swizzle_func.hpp"
# endif # endif
#endif //GLM_SWIZZLE #endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef> #include <cstddef>
namespace glm{ namespace glm{
@ -107,11 +104,6 @@ namespace detail
template <precision Q> template <precision Q>
GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v); GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec2(std::initializer_list<U> l);
# endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -119,7 +111,7 @@ namespace detail
ctor); ctor);
GLM_FUNC_DECL explicit tvec2( GLM_FUNC_DECL explicit tvec2(
T const & s); T const & s);
GLM_FUNC_DECL explicit tvec2( GLM_FUNC_DECL tvec2(
T const & s1, T const & s1,
T const & s2); T const & s2);
@ -139,7 +131,7 @@ namespace detail
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tvec2( GLM_FUNC_DECL tvec2(
U const & x, U const & x,
V const & y); V const & y);
@ -148,7 +140,7 @@ namespace detail
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec2<U, Q> const & v); GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec3<U, Q> const & v); GLM_FUNC_DECL explicit tvec2(tvec3<U, Q> const & v);

View File

@ -74,17 +74,6 @@ namespace detail
y(v.y) y(v.y)
{} {}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(std::initializer_list<U> l) :
x(static_cast<T>(l.begin()[0])),
y(static_cast<T>(l.begin()[1]))
{
assert(l.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors

View File

@ -38,9 +38,6 @@
# include "_swizzle_func.hpp" # include "_swizzle_func.hpp"
# endif # endif
#endif //GLM_SWIZZLE #endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef> #include <cstddef>
namespace glm{ namespace glm{
@ -108,11 +105,6 @@ namespace detail
template <precision Q> template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v); GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec3(std::initializer_list<U> l);
# endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -120,7 +112,7 @@ namespace detail
ctor); ctor);
GLM_FUNC_DECL explicit tvec3( GLM_FUNC_DECL explicit tvec3(
T const & s); T const & s);
GLM_FUNC_DECL explicit tvec3( GLM_FUNC_DECL tvec3(
T const & s1, T const & s1,
T const & s2, T const & s2,
T const & s3); T const & s3);
@ -130,7 +122,7 @@ namespace detail
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V, typename W> template <typename U, typename V, typename W>
GLM_FUNC_DECL explicit tvec3( GLM_FUNC_DECL tvec3(
U const & x, U const & x,
V const & y, V const & y,
W const & z); W const & z);

View File

@ -77,18 +77,6 @@ namespace detail
z(v.z) z(v.z)
{} {}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(std::initializer_list<U> l) :
x(static_cast<T>(l.begin()[0])),
y(static_cast<T>(l.begin()[1])),
z(static_cast<T>(l.begin()[2]))
{
assert(l.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors

View File

@ -39,9 +39,6 @@
# include "_swizzle_func.hpp" # include "_swizzle_func.hpp"
# endif # endif
#endif //GLM_SWIZZLE #endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef> #include <cstddef>
namespace glm{ namespace glm{
@ -147,11 +144,6 @@ namespace detail
template <precision Q> template <precision Q>
GLM_FUNC_DECL tvec4(tvec4<T, Q> const & v); GLM_FUNC_DECL tvec4(tvec4<T, Q> const & v);
# if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec4(std::initializer_list<U> l);
# endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors
@ -159,7 +151,7 @@ namespace detail
ctor); ctor);
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL explicit tvec4(
T const & s); T const & s);
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL tvec4(
T const & s0, T const & s0,
T const & s1, T const & s1,
T const & s2, T const & s2,
@ -170,7 +162,7 @@ namespace detail
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL tvec4(
A const & x, A const & x,
B const & y, B const & y,
C const & z, C const & z,

View File

@ -104,33 +104,6 @@ namespace detail
w(v.w) w(v.w)
{} {}
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2))
template <>
template <precision Q>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(tvec4<float, Q> const & v) :
data(_mm_set_ps(v.w, v.z, v.y, v.x))
{}
template <>
template <precision Q>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(tvec4<float, Q> const & v) :
data(_mm_set_ps(v.w, v.z, v.y, v.x))
{}
#endif
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(std::initializer_list<U> l) :
x(static_cast<T>(l.begin()[0])),
y(static_cast<T>(l.begin()[1])),
z(static_cast<T>(l.begin()[2])),
w(static_cast<T>(l.begin()[3]))
{
assert(l.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////// //////////////////////////////////////
// Explicit basic constructors // Explicit basic constructors

View File

@ -31,7 +31,7 @@
/// @defgroup gtc_constants GLM_GTC_constants /// @defgroup gtc_constants GLM_GTC_constants
/// @ingroup gtc /// @ingroup gtc
/// ///
/// @brief Allow to perform bit operations on integer values /// @brief Provide a list of constants and precomputed useful values.
/// ///
/// <glm/gtc/constants.hpp> need to be included to use these features. /// <glm/gtc/constants.hpp> need to be included to use these features.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////

View File

@ -231,19 +231,21 @@ namespace detail
GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v) GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v)
{ {
u8vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f)); u8vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
return *reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p) GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p)
{ {
vec2 Unpack(*reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p))); u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p));
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255 return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255
} }
GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v) GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v)
{ {
int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f))); int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f)));
return *reinterpret_cast<uint8*>(&Topack); uint8* Packed = reinterpret_cast<uint8*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p) GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p)
@ -257,14 +259,15 @@ namespace detail
GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const & v) GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const & v)
{ {
i8vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f)); i8vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
return *reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p) GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p)
{ {
vec2 Unpack(*reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p))); i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p));
return clamp( return clamp(
Unpack * 0.00787401574803149606299212598425f, // 1.0f / 127.0f vec2(*Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
-1.0f, 1.0f); -1.0f, 1.0f);
} }
@ -282,19 +285,21 @@ namespace detail
GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const & v) GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const & v)
{ {
u16vec4 Topack(round(clamp(v , 0.0f, 1.0f) * 65535.0f)); u16vec4 Topack(round(clamp(v , 0.0f, 1.0f) * 65535.0f));
return *reinterpret_cast<uint64*>(&Topack); uint64* Packed = reinterpret_cast<uint64*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 const & p) GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 const & p)
{ {
vec4 Unpack(*reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p))); u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p));
return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
} }
GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v) GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v)
{ {
int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
return *reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p) GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p)
@ -308,27 +313,29 @@ namespace detail
GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const & v) GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const & v)
{ {
i16vec4 Topack = static_cast<i16vec4>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); i16vec4 Topack = static_cast<i16vec4>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
return *reinterpret_cast<uint64*>(&Topack); uint64* Packed = reinterpret_cast<uint64*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p) GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p)
{ {
vec4 Unpack(*reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p))); i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
return clamp( return clamp(
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f, vec4(*Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
-1.0f, 1.0f); -1.0f, 1.0f);
} }
GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & v) GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & v)
{ {
int16 Topack = detail::toFloat16(v); int16 Topack = detail::toFloat16(v);
return *reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v) GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v)
{ {
int16 Unpack(*reinterpret_cast<int16*>(const_cast<uint16*>(&v))); int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v));
return detail::toFloat32(Unpack); return detail::toFloat32(*Unpack);
} }
GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v) GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v)
@ -339,12 +346,14 @@ namespace detail
detail::toFloat16(v.z), detail::toFloat16(v.z),
detail::toFloat16(v.w)); detail::toFloat16(v.w));
return *reinterpret_cast<uint64*>(&Unpack); uint64* Packed = reinterpret_cast<uint64*>(&Unpack);
return *Packed;
} }
GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 const & v) GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 const & v)
{ {
i16vec4 Unpack = *reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v)); i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v));
i16vec4 Unpack(*p);
return vec4( return vec4(
detail::toFloat32(Unpack.x), detail::toFloat32(Unpack.x),

View File

@ -71,20 +71,15 @@ namespace detail
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_DECL explicit tquat( GLM_FUNC_DECL explicit tquat(
tquat<U, Q> const & q); tquat<U, Q> const & q);
GLM_FUNC_DECL explicit tquat( GLM_FUNC_DECL tquat(
T const & s, T const & s,
tvec3<T, P> const & v); tvec3<T, P> const & v);
GLM_FUNC_DECL explicit tquat( GLM_FUNC_DECL tquat(
T const & w, T const & w,
T const & x, T const & x,
T const & y, T const & y,
T const & z); T const & z);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tquat(std::initializer_list<U> l);
#endif//GLM_HAS_INITIALIZER_LISTS
// Convertions // Convertions
/// Create a quaternion from two normalized axis /// Create a quaternion from two normalized axis

View File

@ -86,19 +86,6 @@ namespace detail
w(w) w(w)
{} {}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(std::initializer_list<U> l) :
x(static_cast<T>(l.begin()[0])),
y(static_cast<T>(l.begin()[1])),
z(static_cast<T>(l.begin()[2])),
w(static_cast<T>(l.begin()[3]))
{
assert(l.size() >= this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// tquat conversions // tquat conversions
@ -661,7 +648,7 @@ namespace detail
) )
{ {
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
return T(atan2(T(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z)); return T(atan(T(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z));
#else #else
# pragma message("GLM: roll function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") # pragma message("GLM: roll function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.")
return glm::degrees(atan(T(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z)); return glm::degrees(atan(T(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z));
@ -675,7 +662,7 @@ namespace detail
) )
{ {
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
return T(atan2(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z)); return T(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z));
#else #else
# pragma message("GLM: pitch function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") # pragma message("GLM: pitch function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.")
return glm::degrees(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z)); return glm::degrees(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z));

View File

@ -55,27 +55,32 @@ namespace glm
//! Faster than the common sqrt function but less accurate. //! Faster than the common sqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension. //! From GLM_GTX_fast_square_root extension.
template <typename genType> template <typename genType>
genType fastSqrt(genType const & x); GLM_FUNC_DECL genType fastSqrt(genType const & x);
//! Faster than the common inversesqrt function but less accurate. //! Faster than the common inversesqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension. //! From GLM_GTX_fast_square_root extension.
template <typename genType> template <typename genType>
genType fastInverseSqrt(genType const & x); GLM_FUNC_DECL genType fastInverseSqrt(genType const & x);
//! Faster than the common inversesqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> fastInverseSqrt(vecType<T, P> const & x);
//! Faster than the common length function but less accurate. //! Faster than the common length function but less accurate.
//! From GLM_GTX_fast_square_root extension. //! From GLM_GTX_fast_square_root extension.
template <typename genType> template <typename genType>
typename genType::value_type fastLength(genType const & x); GLM_FUNC_DECL typename genType::value_type fastLength(genType const & x);
//! Faster than the common distance function but less accurate. //! Faster than the common distance function but less accurate.
//! From GLM_GTX_fast_square_root extension. //! From GLM_GTX_fast_square_root extension.
template <typename genType> template <typename genType>
typename genType::value_type fastDistance(genType const & x, genType const & y); GLM_FUNC_DECL typename genType::value_type fastDistance(genType const & x, genType const & y);
//! Faster than the common normalize function but less accurate. //! Faster than the common normalize function but less accurate.
//! From GLM_GTX_fast_square_root extension. //! From GLM_GTX_fast_square_root extension.
template <typename genType> template <typename genType>
genType fastNormalize(genType const & x); GLM_FUNC_DECL genType fastNormalize(genType const & x);
/// @} /// @}
}// namespace glm }// namespace glm

View File

@ -24,11 +24,18 @@ namespace glm
VECTORIZE_VEC(fastSqrt) VECTORIZE_VEC(fastSqrt)
// fastInversesqrt // fastInversesqrt
GLM_FUNC_QUALIFIER float fastInverseSqrt(float x) template <>
GLM_FUNC_QUALIFIER float fastInverseSqrt<float>(float const & x)
{ {
return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x; return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x;
} }
template <>
GLM_FUNC_QUALIFIER double fastInverseSqrt<double>(double const & x)
{
return detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x)).x;
}
template <template <class, precision> class vecType, typename T, precision P> template <template <class, precision> class vecType, typename T, precision P>
GLM_FUNC_QUALIFIER vecType<T, P> fastInverseSqrt GLM_FUNC_QUALIFIER vecType<T, P> fastInverseSqrt
( (

View File

@ -61,7 +61,7 @@ namespace glm
//! Returns the log2 of x. Can be reliably using to compute mipmap count from the texture size. //! Returns the log2 of x. Can be reliably using to compute mipmap count from the texture size.
//! From GLM_GTX_integer extension. //! From GLM_GTX_integer extension.
template <typename genIUType> template <typename genIUType>
genIUType log2(genIUType const & x); genIUType log2(genIUType x);
//! Returns the floor log2 of x. //! Returns the floor log2 of x.
//! From GLM_GTX_integer extension. //! From GLM_GTX_integer extension.

View File

@ -0,0 +1,105 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_matrix_transform_2d
/// @file glm/gtx/matrix_transform_2d.hpp
/// @date 2014-02-20
/// @author Miguel Ángel Pérez Martínez
///
/// @see core (dependence)
///
/// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d
/// @ingroup gtx
///
/// @brief Defines functions that generate common 2d transformation matrices.
///
/// <glm/gtx/matrix_transform_2d.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_matrix_transform_2d
#define GLM_GTX_matrix_transform_2d
// Dependency:
#include "../mat3x3.hpp"
#include "../vec2.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_matrix_transform_2d extension included")
#endif
namespace glm
{
/// @addtogroup gtx_matrix_transform_2d
/// @{
/// Builds a translation 3 * 3 matrix created from a vector of 2 components.
///
/// @param m Input matrix multiplied by this translation matrix.
/// @param v Coordinates of a translation vector.
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> translate(
detail::tmat3x3<T, P> const & m,
detail::tvec2<T, P> const & v);
/// Builds a rotation 3 * 3 matrix created from an angle.
///
/// @param m Input matrix multiplied by this translation matrix.
/// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rotate(
detail::tmat3x3<T, P> const & m,
T const & angle);
/// Builds a scale 3 * 3 matrix created from a vector of 2 components.
///
/// @param m Input matrix multiplied by this translation matrix.
/// @param v Coordinates of a scale vector.
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> scale(
detail::tmat3x3<T, P> const & m,
detail::tvec2<T, P> const & v);
/// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix.
///
/// @param m Input matrix multiplied by this translation matrix.
/// @param y Shear factor.
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearX(
detail::tmat3x3<T, P> const & m,
T const & y);
/// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix.
///
/// @param m Input matrix multiplied by this translation matrix.
/// @param x Shear factor.
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearY(
detail::tmat3x3<T, P> const & m,
T const & x);
/// @}
}//namespace glm
#include "matrix_transform_2d.inl"
#endif//GLM_GTX_matrix_transform_2d

View File

@ -0,0 +1,97 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_matrix_transform_2d
/// @file glm/gtc/matrix_transform_2d.inl
/// @date 2014-02-20
/// @author Miguel Ángel Pérez Martínez
///////////////////////////////////////////////////////////////////////////////////
#include "../trigonometric.hpp"
namespace glm
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> translate(
detail::tmat3x3<T, P> const & m,
detail::tvec2<T, P> const & v)
{
detail::tmat3x3<T, P> Result(m);
Result[2] = m[0] * v[0] + m[1] * v[1] + m[2];
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> rotate(
detail::tmat3x3<T, P> const & m,
T const & angle)
{
#ifdef GLM_FORCE_RADIANS
T a = angle;
#else
T a = radians(angle);
#endif
T c = cos(a);
T s = sin(a);
detail::tmat3x3<T, P> Result(detail::tmat3x3<T, P>::_null);
Result[0] = m[0] * c + m[1] * s;
Result[1] = m[0] * -s + m[1] * c;
Result[2] = m[2];
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> scale(
detail::tmat3x3<T, P> const & m,
detail::tvec2<T, P> const & v)
{
detail::tmat3x3<T, P> Result(detail::tmat3x3<T, P>::_null);
Result[0] = m[0] * v[0];
Result[1] = m[1] * v[1];
Result[2] = m[2];
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearX(
detail::tmat3x3<T, P> const & m,
T const & y)
{
detail::tmat3x3<T, P> Result();
Result[0][1] = y;
return m * Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> shearY(
detail::tmat3x3<T, P> const & m,
T const & x)
{
detail::tmat3x3<T, P> Result();
Result[1][0] = x;
return m * Result;
}
}//namespace glm

View File

@ -40,6 +40,7 @@
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
#include "../detail/type_int.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_raw_data extension included") # pragma message("GLM: GLM_GTX_raw_data extension included")

View File

@ -17,7 +17,7 @@ namespace glm
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
return acos(clamp(dot(x, y), genType(0), genType(1))); return acos(clamp(dot(x, y), genType(-1), genType(1)));
} }
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
@ -28,7 +28,7 @@ namespace glm
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
return acos(clamp(dot(x, y), T(0), T(1))); return acos(clamp(dot(x, y), T(-1), T(1)));
} }
//! \todo epsilon is hard coded to 0.01 //! \todo epsilon is hard coded to 0.01
@ -40,10 +40,9 @@ namespace glm
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
T const Angle(acos(clamp(dot(x, y), T(0), T(1)))); T const Angle(acos(clamp(dot(x, y), T(-1), T(1))));
detail::tvec2<T, P> const TransformedVector(glm::rotate(x, Angle)); if(all(epsilonEqual(y, glm::rotate(x, Angle), T(0.0001))))
if(all(epsilonEqual(y, TransformedVector, T(0.01))))
return Angle; return Angle;
else else
return -Angle; return -Angle;
@ -58,8 +57,8 @@ namespace glm
) )
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
T const Angle(acos(clamp(dot(x, y), T(0), T(1))));
T const Angle(acos(clamp(dot(x, y), T(-1), T(1))));
return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0)); return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0));
} }
}//namespace glm }//namespace glm

View File

@ -45,12 +45,27 @@ GLM 0.9.6.0: 2014-XX-XX
- Added move contructors and assignment operators (#141) - Added move contructors and assignment operators (#141)
================================================================================ ================================================================================
GLM 0.9.5.2: 2014-0X-XX GLM 0.9.5.3: 2014-0X-XX
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Added instruction set auto detection with Visual C++ using _M_IX86_FP - /arch
compiler argument
- Fixed GTX_raw_data code dependency
- Fixed GCC instruction set detection
- Added GLM_GTX_matrix_transform_2d extension (#178, #176)
================================================================================
GLM 0.9.5.2: 2014-02-08
--------------------------------------------------------------------------------
- Fixed initializer list ambiguity (#159, #160)
- Fixed warnings with the Android NDK 9c - Fixed warnings with the Android NDK 9c
- Fixed non power of two matrix products - Fixed non power of two matrix products
- Fixed mix function link error - Fixed mix function link error
- Fixed SSE code included in GLM tests on "pure" platforms - Fixed SSE code included in GLM tests on "pure" platforms
- Fixed undefined reference to fastInverseSqrt (#161)
- Fixed GLM_FORCE_RADIANS with <glm/ext.hpp> build error (#165)
- Fix dot product clamp range for vector angle functions. (#163)
- Tentative fix for strict aliasing warning in GCC 4.8.1 / Android NDK 9c (#152)
- Fixed GLM_GTC_constants description brief (#162)
================================================================================ ================================================================================
GLM 0.9.5.1: 2014-01-11 GLM 0.9.5.1: 2014-01-11

View File

@ -17,8 +17,6 @@ int test_compiler()
if(GLM_COMPILER & GLM_COMPILER_VC) if(GLM_COMPILER & GLM_COMPILER_VC)
{ {
std::cout << "GLM_COMPILER_VC" << std::endl;
switch(GLM_COMPILER) switch(GLM_COMPILER)
{ {
case GLM_COMPILER_VC8: case GLM_COMPILER_VC8:
@ -44,8 +42,6 @@ int test_compiler()
} }
else if(GLM_COMPILER & GLM_COMPILER_GCC) else if(GLM_COMPILER & GLM_COMPILER_GCC)
{ {
std::cout << "GLM_COMPILER_GCC" << std::endl;
switch(GLM_COMPILER) switch(GLM_COMPILER)
{ {
case GLM_COMPILER_GCC34: case GLM_COMPILER_GCC34:
@ -90,23 +86,12 @@ int test_compiler()
break; break;
} }
} }
else if(GLM_COMPILER & GLM_COMPILER_BC)
{
std::cout << "GLM_COMPILER_BC" << std::endl;
}
else if(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
{
std::cout << "GLM_COMPILER_CODEWARRIOR" << std::endl;
}
else if(GLM_COMPILER & GLM_COMPILER_CUDA) else if(GLM_COMPILER & GLM_COMPILER_CUDA)
{ {
std::cout << "GLM_COMPILER_CUDA" << std::endl; std::cout << "GLM_COMPILER_CUDA" << std::endl;
} }
else if(GLM_COMPILER & GLM_COMPILER_CLANG) else if(GLM_COMPILER & GLM_COMPILER_CLANG)
{ {
# ifdef __clang_major__
std::cout << "GLM_COMPILER_CLANG " << __clang_major__ << "." << __clang_minor__ << std::endl;
# endif
switch(GLM_COMPILER) switch(GLM_COMPILER)
{ {
case GLM_COMPILER_CLANG26: case GLM_COMPILER_CLANG26:
@ -145,6 +130,9 @@ int test_compiler()
case GLM_COMPILER_CLANG43: case GLM_COMPILER_CLANG43:
std::cout << "GLM_COMPILER_CLANG43" << std::endl; std::cout << "GLM_COMPILER_CLANG43" << std::endl;
break; break;
case GLM_COMPILER_CLANG50:
std::cout << "GLM_COMPILER_CLANG50" << std::endl;
break;
default: default:
std::cout << "Clang version not detected" << std::endl; std::cout << "Clang version not detected" << std::endl;
break; break;
@ -157,7 +145,6 @@ int test_compiler()
} }
else if(GLM_COMPILER & GLM_COMPILER_INTEL) else if(GLM_COMPILER & GLM_COMPILER_INTEL)
{ {
std::cout << "GLM_COMPILER_INTEL" << std::endl;
switch(GLM_COMPILER) switch(GLM_COMPILER)
{ {
case GLM_COMPILER_INTEL9: case GLM_COMPILER_INTEL9:
@ -210,6 +197,30 @@ int test_model()
return Error; return Error;
} }
int test_instruction_set()
{
int Error = 0;
std::cout << "GLM_ARCH: ";
if(GLM_ARCH == GLM_ARCH_PURE)
std::cout << "GLM_ARCH_PURE ";
if(GLM_ARCH & GLM_ARCH_AVX2)
std::cout << "GLM_ARCH_AVX2 ";
if(GLM_ARCH & GLM_ARCH_AVX)
std::cout << "GLM_ARCH_AVX ";
if(GLM_ARCH & GLM_ARCH_AVX)
std::cout << "GLM_ARCH_SSE4 ";
if(GLM_ARCH & GLM_ARCH_SSE3)
std::cout << "GLM_ARCH_SSE3 ";
if(GLM_ARCH & GLM_ARCH_SSE2)
std::cout << "GLM_ARCH_SSE2 ";
std::cout << std::endl;
return Error;
}
int test_cpp_version() int test_cpp_version()
{ {
std::cout << "__cplusplus: " << __cplusplus << std::endl; std::cout << "__cplusplus: " << __cplusplus << std::endl;
@ -254,6 +265,7 @@ int main()
Error += test_cpp_version(); Error += test_cpp_version();
Error += test_compiler(); Error += test_compiler();
Error += test_model(); Error += test_model();
Error += test_instruction_set();
Error += test_operators(); Error += test_operators();
return Error; return Error;

View File

@ -198,6 +198,8 @@ int test_ctr()
assert(sizeof(m0) == 4 * 4 * 4); assert(sizeof(m0) == 4 * 4 * 4);
glm::vec4 V{0, 1, 2, 3};
glm::mat4 m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; glm::mat4 m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
glm::mat4 m2{ glm::mat4 m2{
@ -218,19 +220,9 @@ int test_ctr()
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}}; {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
/*
std::initializer_list<glm::mat4> m3{
{0, 1, 2, 3},
{4, 5, 6, 7},
{8, 9, 10, 11},
{12, 13, 14, 15}};
*/
//glm::mat4 m4{m3};
std::vector<glm::mat4> v1{ std::vector<glm::mat4> v1{
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
};
std::vector<glm::mat4> v2{ std::vector<glm::mat4> v2{
{ {
@ -244,8 +236,7 @@ int test_ctr()
{ 4, 5, 6, 7 }, { 4, 5, 6, 7 },
{ 8, 9, 10, 11 }, { 8, 9, 10, 11 },
{ 12, 13, 14, 15 } { 12, 13, 14, 15 }
} }};
};
#endif//GLM_HAS_INITIALIZER_LISTS #endif//GLM_HAS_INITIALIZER_LISTS

View File

@ -277,6 +277,9 @@ int main()
{ {
int Error = 0; int Error = 0;
glm::vec2 v;
assert(v.length() == 2);
Error += test_vec2_size(); Error += test_vec2_size();
Error += test_vec2_ctor(); Error += test_vec2_ctor();
Error += test_vec2_operators(); Error += test_vec2_operators();

View File

@ -11,6 +11,7 @@
#include <glm/gtc/quaternion.hpp> #include <glm/gtc/quaternion.hpp>
#include <glm/gtc/epsilon.hpp> #include <glm/gtc/epsilon.hpp>
#include <glm/vector_relational.hpp> #include <glm/vector_relational.hpp>
#include <vector>
int test_quat_angle() int test_quat_angle()
{ {
@ -246,10 +247,28 @@ int test_quat_type()
return 0; return 0;
} }
int test_quat_ctr()
{
int Error(0);
# if(GLM_HAS_INITIALIZER_LISTS)
{
glm::quat A{0, 1, 2, 3};
std::vector<glm::quat> B{
{0, 1, 2, 3},
{0, 1, 2, 3}};
}
# endif//GLM_HAS_INITIALIZER_LISTS
return Error;
}
int main() int main()
{ {
int Error(0); int Error(0);
Error += test_quat_ctr();
Error += test_quat_two_axis_ctr(); Error += test_quat_two_axis_ctr();
Error += test_quat_mul(); Error += test_quat_mul();
Error += test_quat_precision(); Error += test_quat_precision();

View File

@ -23,6 +23,7 @@ glmCreateTestGTC(gtx_matrix_interpolation)
glmCreateTestGTC(gtx_matrix_major_storage) glmCreateTestGTC(gtx_matrix_major_storage)
glmCreateTestGTC(gtx_matrix_operation) glmCreateTestGTC(gtx_matrix_operation)
glmCreateTestGTC(gtx_matrix_query) glmCreateTestGTC(gtx_matrix_query)
glmCreateTestGTC(gtx_matrix_transform_2d)
glmCreateTestGTC(gtx_multiple) glmCreateTestGTC(gtx_multiple)
glmCreateTestGTC(gtx_norm) glmCreateTestGTC(gtx_norm)
glmCreateTestGTC(gtx_normal) glmCreateTestGTC(gtx_normal)

View File

@ -8,12 +8,30 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS #define GLM_FORCE_RADIANS
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/fast_square_root.hpp> #include <glm/gtx/fast_square_root.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/vector_relational.hpp>
int test_fastInverseSqrt()
{
int Error(0);
Error += glm::epsilonEqual(glm::fastInverseSqrt(1.0f), 1.0f, 0.01f) ? 0 : 1;
Error += glm::epsilonEqual(glm::fastInverseSqrt(1.0), 1.0, 0.01) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(glm::fastInverseSqrt(glm::vec2(1.0f)), glm::vec2(1.0f), 0.01f)) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(glm::fastInverseSqrt(glm::dvec3(1.0)), glm::dvec3(1.0), 0.01)) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(glm::fastInverseSqrt(glm::dvec4(1.0)), glm::dvec4(1.0), 0.01)) ? 0 : 1;
return 0;
}
int main() int main()
{ {
int Error(0); int Error(0);
Error += test_fastInverseSqrt();
return Error; return Error;
} }

View File

@ -0,0 +1,18 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2014-02-21
// Updated : 2014-02-21
// Licence : This source is under MIT licence
// File : test/gtx/matrix_transform_2d.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/gtx/matrix_transform_2d.hpp>
int main()
{
int Error(0);
return Error;
}

View File

@ -8,9 +8,12 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS #define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/epsilon.hpp> #include <glm/gtc/epsilon.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtx/quaternion.hpp> #include <glm/gtx/quaternion.hpp>
#include <glm/ext.hpp>
int test_quat_fastMix() int test_quat_fastMix()
{ {