mirror of
https://github.com/g-truc/glm.git
synced 2024-11-23 01:14:34 +00:00
Fix merge
This commit is contained in:
commit
ce431012c9
@ -29,10 +29,20 @@
|
||||
#ifndef GLM_CORE_DETAIL_INCLUDED
|
||||
#define GLM_CORE_DETAIL_INCLUDED
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.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) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \
|
||||
@ -67,10 +77,23 @@
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC(func) \
|
||||
VECTORIZE1_VEC(func) \
|
||||
VECTORIZE2_VEC(func) \
|
||||
VECTORIZE3_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) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
@ -114,6 +137,7 @@
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_SCA(func) \
|
||||
VECTORIZE1_VEC_SCA(func) \
|
||||
VECTORIZE2_VEC_SCA(func) \
|
||||
VECTORIZE3_VEC_SCA(func) \
|
||||
VECTORIZE4_VEC_SCA(func)
|
||||
|
@ -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_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));
|
||||
}
|
||||
};
|
||||
@ -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_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));
|
||||
}
|
||||
};
|
||||
@ -109,6 +113,8 @@ namespace detail
|
||||
{
|
||||
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));
|
||||
}
|
||||
};
|
||||
|
@ -98,8 +98,8 @@ 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType log2(genType const & x);
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType log2(genType x);
|
||||
|
||||
/// Returns the positive square root of x.
|
||||
///
|
||||
@ -108,9 +108,12 @@ 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/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType sqrt(genType const & x);
|
||||
//template <typename genType>
|
||||
//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.
|
||||
///
|
||||
/// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||
|
@ -31,8 +31,52 @@
|
||||
#include <limits>
|
||||
#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
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType pow
|
||||
@ -84,10 +128,7 @@ namespace glm
|
||||
|
||||
//exp2, ln2 = 0.69314718055994530941723212145818f
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType exp2
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType exp2(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
@ -98,33 +139,9 @@ namespace glm
|
||||
|
||||
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
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType log2
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType log2(genType x)
|
||||
{
|
||||
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.");
|
||||
@ -135,51 +152,66 @@ namespace detail
|
||||
|
||||
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
|
||||
{
|
||||
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>
|
||||
struct compute_inversesqrt<vecType, float, lowp>
|
||||
template <typename T, precision P>
|
||||
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);
|
||||
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);
|
||||
tmp = tmp * (1.5f - xhalf * tmp * tmp);
|
||||
return tmp;
|
||||
return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec3, T, P>
|
||||
{
|
||||
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
|
||||
|
||||
// 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
|
||||
GLM_FUNC_QUALIFIER float inversesqrt(float const & x)
|
||||
{
|
||||
|
@ -100,7 +100,8 @@ namespace glm
|
||||
detail::toFloat16(v.x),
|
||||
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)
|
||||
|
@ -48,7 +48,11 @@ GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
|
||||
//dot
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
# 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);
|
||||
# else
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
|
@ -576,8 +576,8 @@
|
||||
#define GLM_ARCH_PURE 0x0000
|
||||
#define GLM_ARCH_SSE2 0x0001
|
||||
#define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2
|
||||
#define GLM_ARCH_AVX 0x0004// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
|
||||
#define GLM_ARCH_AVX2 0x0008// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
|
||||
#define GLM_ARCH_AVX 0x0008// | 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))
|
||||
# define GLM_ARCH GLM_ARCH_PURE
|
||||
@ -601,36 +601,16 @@
|
||||
# else
|
||||
# define GLM_ARCH GLM_ARCH_PURE
|
||||
# endif
|
||||
#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
|
||||
# if(GLM_PLATFORM == GLM_PLATFORM_WINCE)
|
||||
# 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)
|
||||
#elif(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# if _M_IX86_FP == 2 && defined(__AVX__)
|
||||
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
|
||||
# elif(GLM_COMPILER >= GLM_COMPILER_VC10)
|
||||
# if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
|
||||
# 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
|
||||
# elif _M_IX86_FP == 2
|
||||
# define GLM_ARCH (GLM_ARCH_SSE2)
|
||||
# else
|
||||
# define GLM_ARCH GLM_ARCH_PURE
|
||||
# define GLM_ARCH (GLM_ARCH_PURE)
|
||||
# endif
|
||||
#elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC))
|
||||
# define GLM_ARCH GLM_ARCH_PURE
|
||||
#else
|
||||
# define GLM_ARCH GLM_ARCH_PURE
|
||||
#endif
|
||||
|
@ -80,37 +80,22 @@ namespace detail
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
GLM_FUNC_DECL tmat2x2(
|
||||
T const & x1, T const & y1,
|
||||
T const & x2, T const & y2);
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
GLM_FUNC_DECL tmat2x2(
|
||||
col_type const & v1,
|
||||
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
|
||||
template <typename U, typename V, typename M, typename N>
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
GLM_FUNC_DECL tmat2x2(
|
||||
U const & x1, V const & y1,
|
||||
M const & x2, N const & y2);
|
||||
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
GLM_FUNC_DECL tmat2x2(
|
||||
tvec2<U, P> const & v1,
|
||||
tvec2<V, P> const & v2);
|
||||
|
||||
|
@ -118,29 +118,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -73,37 +73,22 @@ namespace detail
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x3(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat2x3(
|
||||
GLM_FUNC_DECL tmat2x3(
|
||||
T const & x0, T const & y0, T const & z0,
|
||||
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 & 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
|
||||
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,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2);
|
||||
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_DECL explicit tmat2x3(
|
||||
GLM_FUNC_DECL tmat2x3(
|
||||
tvec3<U, P> const & v1,
|
||||
tvec3<V, P> const & v2);
|
||||
|
||||
|
@ -128,29 +128,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -73,39 +73,24 @@ namespace detail
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x4(
|
||||
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 & 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 & 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
|
||||
template <
|
||||
typename X1, typename Y1, typename Z1, typename W1,
|
||||
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,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
|
||||
|
||||
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_DECL explicit tmat2x4(
|
||||
GLM_FUNC_DECL tmat2x4(
|
||||
tvec4<U, P> const & v1,
|
||||
tvec4<V, P> const & v2);
|
||||
|
||||
|
@ -131,29 +131,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -73,44 +73,28 @@ namespace detail
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
GLM_FUNC_DECL tmat3x2(
|
||||
T const & x0, T const & y0,
|
||||
T const & x1, T const & y1,
|
||||
T const & x2, T const & y2);
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
GLM_FUNC_DECL tmat3x2(
|
||||
col_type const & v0,
|
||||
col_type const & v1,
|
||||
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
|
||||
template<
|
||||
typename X1, typename Y1,
|
||||
typename X2, typename Y2,
|
||||
typename X3, typename Y3>
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
GLM_FUNC_DECL tmat3x2(
|
||||
X1 const & x1, Y1 const & y1,
|
||||
X2 const & x2, Y2 const & y2,
|
||||
X3 const & x3, Y3 const & y3);
|
||||
|
||||
template <typename V1, typename V2, typename V3>
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
GLM_FUNC_DECL tmat3x2(
|
||||
tvec2<V1, P> const & v1,
|
||||
tvec2<V2, P> const & v2,
|
||||
tvec2<V3, P> const & v3);
|
||||
|
@ -136,31 +136,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -78,44 +78,28 @@ namespace detail
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat3x3(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat3x3(
|
||||
GLM_FUNC_DECL tmat3x3(
|
||||
T const & x0, T const & y0, T const & z0,
|
||||
T const & x1, T const & y1, T const & z1,
|
||||
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 & v1,
|
||||
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
|
||||
template<
|
||||
typename X1, typename Y1, typename Z1,
|
||||
typename X2, typename Y2, typename Z2,
|
||||
typename X3, typename Y3, typename Z3>
|
||||
GLM_FUNC_DECL explicit tmat3x3(
|
||||
GLM_FUNC_DECL tmat3x3(
|
||||
X1 const & x1, Y1 const & y1, Z1 const & z1,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2,
|
||||
X3 const & x3, Y3 const & y3, Z3 const & z3);
|
||||
|
||||
template <typename V1, typename V2, typename V3>
|
||||
GLM_FUNC_DECL explicit tmat3x3(
|
||||
GLM_FUNC_DECL tmat3x3(
|
||||
tvec3<V1, P> const & v1,
|
||||
tvec3<V2, P> const & v2,
|
||||
tvec3<V3, P> const & v3);
|
||||
|
@ -139,31 +139,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -73,44 +73,28 @@ namespace detail
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat3x4(
|
||||
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 & x1, T const & y1, T const & z1, T const & w1,
|
||||
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 & v1,
|
||||
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
|
||||
template<
|
||||
typename X1, typename Y1, typename Z1, typename W1,
|
||||
typename X2, typename Y2, typename Z2, typename W2,
|
||||
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,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
|
||||
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3);
|
||||
|
||||
template <typename V1, typename V2, typename V3>
|
||||
GLM_FUNC_DECL explicit tmat3x4(
|
||||
GLM_FUNC_DECL tmat3x4(
|
||||
tvec4<V1, P> const & v1,
|
||||
tvec4<V2, P> const & v2,
|
||||
tvec4<V3, P> const & v3);
|
||||
|
@ -169,31 +169,6 @@ namespace detail
|
||||
this->value[1] = col_type(v2);
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -73,34 +73,17 @@ namespace detail
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
GLM_FUNC_DECL tmat4x2(
|
||||
T const & x0, T const & y0,
|
||||
T const & x1, T const & y1,
|
||||
T const & x2, T const & y2,
|
||||
T const & x3, T const & y3);
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
GLM_FUNC_DECL tmat4x2(
|
||||
col_type const & v0,
|
||||
col_type const & v1,
|
||||
col_type const & v2,
|
||||
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
|
||||
|
||||
@ -109,14 +92,14 @@ namespace detail
|
||||
typename X2, typename Y2,
|
||||
typename X3, typename Y3,
|
||||
typename X4, typename Y4>
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
GLM_FUNC_DECL tmat4x2(
|
||||
X1 const & x1, Y1 const & y1,
|
||||
X2 const & x2, Y2 const & y2,
|
||||
X3 const & x3, Y3 const & y3,
|
||||
X4 const & x4, Y4 const & y4);
|
||||
|
||||
template <typename V1, typename V2, typename V3, typename V4>
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
GLM_FUNC_DECL tmat4x2(
|
||||
tvec2<V1, P> const & v1,
|
||||
tvec2<V2, P> const & v2,
|
||||
tvec2<V3, P> const & v3,
|
||||
|
@ -181,33 +181,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -73,34 +73,17 @@ namespace detail
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat4x3(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x3(
|
||||
GLM_FUNC_DECL tmat4x3(
|
||||
T const & x0, T const & y0, T const & z0,
|
||||
T const & x1, T const & y1, T const & z1,
|
||||
T const & x2, T const & y2, T const & z2,
|
||||
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 & v1,
|
||||
col_type const & v2,
|
||||
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
|
||||
|
||||
@ -109,14 +92,14 @@ namespace detail
|
||||
typename X2, typename Y2, typename Z2,
|
||||
typename X3, typename Y3, typename Z3,
|
||||
typename X4, typename Y4, typename Z4>
|
||||
GLM_FUNC_DECL explicit tmat4x3(
|
||||
GLM_FUNC_DECL tmat4x3(
|
||||
X1 const & x1, Y1 const & y1, Z1 const & z1,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2,
|
||||
X3 const & x3, Y3 const & y3, Z3 const & z3,
|
||||
X4 const & x4, Y4 const & y4, Z4 const & z4);
|
||||
|
||||
template <typename V1, typename V2, typename V3, typename V4>
|
||||
GLM_FUNC_DECL explicit tmat4x3(
|
||||
GLM_FUNC_DECL tmat4x3(
|
||||
tvec3<V1, P> const & v1,
|
||||
tvec3<V2, P> const & v2,
|
||||
tvec3<V3, P> const & v3,
|
||||
|
@ -140,33 +140,6 @@ namespace detail
|
||||
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
|
||||
|
||||
|
@ -32,12 +32,6 @@
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec4.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 <cstddef>
|
||||
|
||||
@ -77,34 +71,17 @@ namespace detail
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat4x4(
|
||||
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 & x1, T const & y1, T const & z1, T const & w1,
|
||||
T const & x2, T const & y2, T const & z2, T const & w2,
|
||||
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 & v1,
|
||||
col_type const & v2,
|
||||
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
|
||||
|
||||
@ -113,14 +90,14 @@ namespace detail
|
||||
typename X2, typename Y2, typename Z2, typename W2,
|
||||
typename X3, typename Y3, typename Z3, typename W3,
|
||||
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,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
|
||||
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
|
||||
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
|
||||
|
||||
template <typename V1, typename V2, typename V3, typename V4>
|
||||
GLM_FUNC_DECL explicit tmat4x4(
|
||||
GLM_FUNC_DECL tmat4x4(
|
||||
tvec4<V1, P> const & v1,
|
||||
tvec4<V2, P> const & v2,
|
||||
tvec4<V3, P> const & v3,
|
||||
|
@ -162,33 +162,6 @@ namespace detail
|
||||
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
|
||||
template <typename T, precision P>
|
||||
|
@ -38,9 +38,6 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||
# include <initializer_list>
|
||||
#endif //GLM_HAS_INITIALIZER_LISTS
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
@ -82,11 +79,6 @@ namespace detail
|
||||
template <precision Q>
|
||||
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
|
||||
|
||||
|
@ -71,16 +71,6 @@ namespace detail
|
||||
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
|
||||
|
||||
|
@ -38,9 +38,6 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||
# include <initializer_list>
|
||||
#endif //GLM_HAS_INITIALIZER_LISTS
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
@ -107,11 +104,6 @@ namespace detail
|
||||
template <precision Q>
|
||||
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
|
||||
|
||||
@ -119,7 +111,7 @@ namespace detail
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tvec2(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tvec2(
|
||||
GLM_FUNC_DECL tvec2(
|
||||
T const & s1,
|
||||
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)
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_DECL explicit tvec2(
|
||||
GLM_FUNC_DECL tvec2(
|
||||
U const & x,
|
||||
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)
|
||||
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)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec2(tvec3<U, Q> const & v);
|
||||
|
@ -74,17 +74,6 @@ namespace detail
|
||||
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
|
||||
|
||||
|
@ -38,9 +38,6 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||
# include <initializer_list>
|
||||
#endif //GLM_HAS_INITIALIZER_LISTS
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
@ -108,11 +105,6 @@ namespace detail
|
||||
template <precision Q>
|
||||
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
|
||||
|
||||
@ -120,7 +112,7 @@ namespace detail
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tvec3(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tvec3(
|
||||
GLM_FUNC_DECL tvec3(
|
||||
T const & s1,
|
||||
T const & s2,
|
||||
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)
|
||||
template <typename U, typename V, typename W>
|
||||
GLM_FUNC_DECL explicit tvec3(
|
||||
GLM_FUNC_DECL tvec3(
|
||||
U const & x,
|
||||
V const & y,
|
||||
W const & z);
|
||||
|
@ -77,18 +77,6 @@ namespace detail
|
||||
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
|
||||
|
||||
|
@ -39,9 +39,6 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||
# include <initializer_list>
|
||||
#endif //GLM_HAS_INITIALIZER_LISTS
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
@ -147,11 +144,6 @@ namespace detail
|
||||
template <precision Q>
|
||||
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
|
||||
|
||||
@ -159,7 +151,7 @@ namespace detail
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tvec4(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tvec4(
|
||||
GLM_FUNC_DECL tvec4(
|
||||
T const & s0,
|
||||
T const & s1,
|
||||
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)
|
||||
template <typename A, typename B, typename C, typename D>
|
||||
GLM_FUNC_DECL explicit tvec4(
|
||||
GLM_FUNC_DECL tvec4(
|
||||
A const & x,
|
||||
B const & y,
|
||||
C const & z,
|
||||
|
@ -104,33 +104,6 @@ namespace detail
|
||||
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
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
/// @defgroup gtc_constants GLM_GTC_constants
|
||||
/// @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.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -231,19 +231,21 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v)
|
||||
{
|
||||
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)
|
||||
{
|
||||
vec2 Unpack(*reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p)));
|
||||
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
|
||||
u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p));
|
||||
return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v)
|
||||
{
|
||||
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)
|
||||
@ -257,14 +259,15 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const & v)
|
||||
{
|
||||
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)
|
||||
{
|
||||
vec2 Unpack(*reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p)));
|
||||
i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p));
|
||||
return clamp(
|
||||
Unpack * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
|
||||
vec2(*Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
|
||||
-1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@ -282,19 +285,21 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const & v)
|
||||
{
|
||||
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)
|
||||
{
|
||||
vec4 Unpack(*reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p)));
|
||||
return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
|
||||
u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p));
|
||||
return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v)
|
||||
{
|
||||
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)
|
||||
@ -308,27 +313,29 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const & v)
|
||||
{
|
||||
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)
|
||||
{
|
||||
vec4 Unpack(*reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
|
||||
i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
|
||||
return clamp(
|
||||
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
||||
vec4(*Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
||||
-1.0f, 1.0f);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & 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)
|
||||
{
|
||||
int16 Unpack(*reinterpret_cast<int16*>(const_cast<uint16*>(&v)));
|
||||
return detail::toFloat32(Unpack);
|
||||
int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v));
|
||||
return detail::toFloat32(*Unpack);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v)
|
||||
@ -339,12 +346,14 @@ namespace detail
|
||||
detail::toFloat16(v.z),
|
||||
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)
|
||||
{
|
||||
i16vec4 Unpack = *reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v));
|
||||
i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v));
|
||||
i16vec4 Unpack(*p);
|
||||
|
||||
return vec4(
|
||||
detail::toFloat32(Unpack.x),
|
||||
|
@ -71,20 +71,15 @@ namespace detail
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tquat(
|
||||
tquat<U, Q> const & q);
|
||||
GLM_FUNC_DECL explicit tquat(
|
||||
GLM_FUNC_DECL tquat(
|
||||
T const & s,
|
||||
tvec3<T, P> const & v);
|
||||
GLM_FUNC_DECL explicit tquat(
|
||||
GLM_FUNC_DECL tquat(
|
||||
T const & w,
|
||||
T const & x,
|
||||
T const & y,
|
||||
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
|
||||
|
||||
/// Create a quaternion from two normalized axis
|
||||
|
@ -86,19 +86,6 @@ namespace detail
|
||||
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
|
||||
|
||||
@ -661,7 +648,7 @@ namespace detail
|
||||
)
|
||||
{
|
||||
#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
|
||||
# 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));
|
||||
@ -675,7 +662,7 @@ namespace detail
|
||||
)
|
||||
{
|
||||
#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
|
||||
# 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));
|
||||
|
@ -55,27 +55,32 @@ namespace glm
|
||||
//! Faster than the common sqrt function but less accurate.
|
||||
//! From GLM_GTX_fast_square_root extension.
|
||||
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.
|
||||
//! From GLM_GTX_fast_square_root extension.
|
||||
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.
|
||||
//! From GLM_GTX_fast_square_root extension.
|
||||
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.
|
||||
//! From GLM_GTX_fast_square_root extension.
|
||||
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.
|
||||
//! From GLM_GTX_fast_square_root extension.
|
||||
template <typename genType>
|
||||
genType fastNormalize(genType const & x);
|
||||
GLM_FUNC_DECL genType fastNormalize(genType const & x);
|
||||
|
||||
/// @}
|
||||
}// namespace glm
|
||||
|
@ -24,11 +24,18 @@ namespace glm
|
||||
VECTORIZE_VEC(fastSqrt)
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
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>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> fastInverseSqrt
|
||||
(
|
||||
|
@ -61,7 +61,7 @@ namespace glm
|
||||
//! Returns the log2 of x. Can be reliably using to compute mipmap count from the texture size.
|
||||
//! From GLM_GTX_integer extension.
|
||||
template <typename genIUType>
|
||||
genIUType log2(genIUType const & x);
|
||||
genIUType log2(genIUType x);
|
||||
|
||||
//! Returns the floor log2 of x.
|
||||
//! From GLM_GTX_integer extension.
|
||||
|
105
glm/gtx/matrix_transform_2d.hpp
Normal file
105
glm/gtx/matrix_transform_2d.hpp
Normal 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
|
97
glm/gtx/matrix_transform_2d.inl
Normal file
97
glm/gtx/matrix_transform_2d.inl
Normal 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
|
@ -40,6 +40,7 @@
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/type_int.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
|
||||
# pragma message("GLM: GLM_GTX_raw_data extension included")
|
||||
|
@ -17,7 +17,7 @@ namespace glm
|
||||
)
|
||||
{
|
||||
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>
|
||||
@ -28,7 +28,7 @@ namespace glm
|
||||
)
|
||||
{
|
||||
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
|
||||
@ -40,10 +40,9 @@ namespace glm
|
||||
)
|
||||
{
|
||||
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, TransformedVector, T(0.01))))
|
||||
if(all(epsilonEqual(y, glm::rotate(x, Angle), T(0.0001))))
|
||||
return Angle;
|
||||
else
|
||||
return -Angle;
|
||||
@ -58,8 +57,8 @@ namespace glm
|
||||
)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}//namespace glm
|
||||
|
17
readme.txt
17
readme.txt
@ -45,12 +45,27 @@ GLM 0.9.6.0: 2014-XX-XX
|
||||
- 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 non power of two matrix products
|
||||
- Fixed mix function link error
|
||||
- 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
|
||||
|
@ -17,8 +17,6 @@ int test_compiler()
|
||||
|
||||
if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
{
|
||||
std::cout << "GLM_COMPILER_VC" << std::endl;
|
||||
|
||||
switch(GLM_COMPILER)
|
||||
{
|
||||
case GLM_COMPILER_VC8:
|
||||
@ -44,8 +42,6 @@ int test_compiler()
|
||||
}
|
||||
else if(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
{
|
||||
std::cout << "GLM_COMPILER_GCC" << std::endl;
|
||||
|
||||
switch(GLM_COMPILER)
|
||||
{
|
||||
case GLM_COMPILER_GCC34:
|
||||
@ -90,23 +86,12 @@ int test_compiler()
|
||||
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)
|
||||
{
|
||||
std::cout << "GLM_COMPILER_CUDA" << std::endl;
|
||||
}
|
||||
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)
|
||||
{
|
||||
case GLM_COMPILER_CLANG26:
|
||||
@ -145,6 +130,9 @@ int test_compiler()
|
||||
case GLM_COMPILER_CLANG43:
|
||||
std::cout << "GLM_COMPILER_CLANG43" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_CLANG50:
|
||||
std::cout << "GLM_COMPILER_CLANG50" << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Clang version not detected" << std::endl;
|
||||
break;
|
||||
@ -157,29 +145,28 @@ int test_compiler()
|
||||
}
|
||||
else if(GLM_COMPILER & GLM_COMPILER_INTEL)
|
||||
{
|
||||
std::cout << "GLM_COMPILER_INTEL" << std::endl;
|
||||
switch(GLM_COMPILER)
|
||||
{
|
||||
case GLM_COMPILER_INTEL9:
|
||||
std::cout << "GLM_COMPILER_INTEL9" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL9" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_INTEL10_0:
|
||||
std::cout << "GLM_COMPILER_INTEL10_0" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL10_0" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_INTEL10_1:
|
||||
std::cout << "GLM_COMPILER_INTEL10_1" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL10_1" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_INTEL11_0:
|
||||
std::cout << "GLM_COMPILER_INTEL11_0" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL11_0" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_INTEL11_1:
|
||||
std::cout << "GLM_COMPILER_INTEL11_1" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL11_1" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_INTEL12_1:
|
||||
std::cout << "GLM_COMPILER_INTEL12_1" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL12_1" << std::endl;
|
||||
break;
|
||||
case GLM_COMPILER_INTEL13_0:
|
||||
std::cout << "GLM_COMPILER_INTEL13_0" << std::endl;
|
||||
std::cout << "GLM_COMPILER_INTEL13_0" << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Intel compiler version not detected" << std::endl;
|
||||
@ -203,13 +190,37 @@ int test_model()
|
||||
Error += ((sizeof(void*) == 4) && (GLM_MODEL == GLM_MODEL_32)) || ((sizeof(void*) == 8) && (GLM_MODEL == GLM_MODEL_64)) ? 0 : 1;
|
||||
|
||||
if(GLM_MODEL == GLM_MODEL_32)
|
||||
std::cout << "GLM_MODEL_32" << std::endl;
|
||||
std::cout << "GLM_MODEL_32" << std::endl;
|
||||
else if(GLM_MODEL == GLM_MODEL_64)
|
||||
std::cout << "GLM_MODEL_64" << std::endl;
|
||||
std::cout << "GLM_MODEL_64" << std::endl;
|
||||
|
||||
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()
|
||||
{
|
||||
std::cout << "__cplusplus: " << __cplusplus << std::endl;
|
||||
@ -254,6 +265,7 @@ int main()
|
||||
Error += test_cpp_version();
|
||||
Error += test_compiler();
|
||||
Error += test_model();
|
||||
Error += test_instruction_set();
|
||||
Error += test_operators();
|
||||
|
||||
return Error;
|
||||
|
@ -198,6 +198,8 @@ int test_ctr()
|
||||
|
||||
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 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}};
|
||||
|
||||
/*
|
||||
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{
|
||||
{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{
|
||||
{
|
||||
@ -244,8 +236,7 @@ int test_ctr()
|
||||
{ 4, 5, 6, 7 },
|
||||
{ 8, 9, 10, 11 },
|
||||
{ 12, 13, 14, 15 }
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
#endif//GLM_HAS_INITIALIZER_LISTS
|
||||
|
||||
|
@ -277,6 +277,9 @@ int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::vec2 v;
|
||||
assert(v.length() == 2);
|
||||
|
||||
Error += test_vec2_size();
|
||||
Error += test_vec2_ctor();
|
||||
Error += test_vec2_operators();
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <vector>
|
||||
|
||||
int test_quat_angle()
|
||||
{
|
||||
@ -246,10 +247,28 @@ int test_quat_type()
|
||||
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 Error(0);
|
||||
|
||||
Error += test_quat_ctr();
|
||||
Error += test_quat_two_axis_ctr();
|
||||
Error += test_quat_mul();
|
||||
Error += test_quat_precision();
|
||||
|
@ -23,6 +23,7 @@ glmCreateTestGTC(gtx_matrix_interpolation)
|
||||
glmCreateTestGTC(gtx_matrix_major_storage)
|
||||
glmCreateTestGTC(gtx_matrix_operation)
|
||||
glmCreateTestGTC(gtx_matrix_query)
|
||||
glmCreateTestGTC(gtx_matrix_transform_2d)
|
||||
glmCreateTestGTC(gtx_multiple)
|
||||
glmCreateTestGTC(gtx_norm)
|
||||
glmCreateTestGTC(gtx_normal)
|
||||
|
@ -8,12 +8,30 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <glm/gtc/type_precision.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 Error(0);
|
||||
|
||||
Error += test_fastInverseSqrt();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
18
test/gtx/gtx_matrix_transform_2d.cpp
Normal file
18
test/gtx/gtx_matrix_transform_2d.cpp
Normal 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;
|
||||
}
|
@ -8,9 +8,12 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#include <glm/glm.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/ext.hpp>
|
||||
|
||||
int test_quat_fastMix()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user