Merge branch '0.9.5' into packing

This commit is contained in:
Christophe Riccio 2013-08-18 19:27:15 +02:00
commit 8f3907400d
7 changed files with 151 additions and 107 deletions

View File

@ -60,8 +60,8 @@ namespace detail
typedef T value_type; typedef T value_type;
protected: protected:
value_type& elem (size_t i) { return (reinterpret_cast<value_type*>(_buffer))[i]; } GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast<value_type*>(_buffer))[i]; }
const value_type& elem (size_t i) const { return (reinterpret_cast<const value_type*>(_buffer))[i]; } GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast<const value_type*>(_buffer))[i]; }
// Use an opaque buffer to *ensure* the compiler doesn't call a constructor. // Use an opaque buffer to *ensure* the compiler doesn't call a constructor.
// The size 1 buffer is assumed to aligned to the actual members so that the // The size 1 buffer is assumed to aligned to the actual members so that the
@ -77,19 +77,19 @@ namespace detail
template <typename T, precision P, typename V, int E0, int E1> template <typename T, precision P, typename V, int E0, int E1>
struct _swizzle_base1<T, P, V,E0,E1,-1,-2,2> : public _swizzle_base0<T, 2> struct _swizzle_base1<T, P, V,E0,E1,-1,-2,2> : public _swizzle_base0<T, 2>
{ {
V operator ()() const { return V(this->elem(E0), this->elem(E1)); } GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); }
}; };
template <typename T, precision P, typename V, int E0, int E1, int E2> template <typename T, precision P, typename V, int E0, int E1, int E2>
struct _swizzle_base1<T, P, V,E0,E1,E2,-1,3> : public _swizzle_base0<T, 3> struct _swizzle_base1<T, P, V,E0,E1,E2,-1,3> : public _swizzle_base0<T, 3>
{ {
V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); }
}; };
template <typename T, precision P, typename V, int E0, int E1, int E2, int E3> template <typename T, precision P, typename V, int E0, int E1, int E2, int E3>
struct _swizzle_base1<T, P, V,E0,E1,E2,E3,4> : public _swizzle_base0<T, 4> struct _swizzle_base1<T, P, V,E0,E1,E2,E3,4> : public _swizzle_base0<T, 4>
{ {
V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }
}; };
// Internal class for implementing swizzle operators // Internal class for implementing swizzle operators
@ -110,67 +110,73 @@ namespace detail
typedef VecType vec_type; typedef VecType vec_type;
typedef ValueType value_type; typedef ValueType value_type;
_swizzle_base2& operator= (const ValueType& t) GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t)
{ {
for (int i = 0; i < N; ++i) for (int i = 0; i < N; ++i)
(*this)[i] = t; (*this)[i] = t;
return *this; return *this;
} }
_swizzle_base2& operator= (const VecType& that) GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that)
{ {
struct op { struct op {
void operator() (value_type& e, value_type& t) { e = t; } GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; }
}; };
_apply_op(that, op()); _apply_op(that, op());
return *this; return *this;
} }
void operator -= (const VecType& that) GLM_FUNC_QUALIFIER void operator -= (const VecType& that)
{ {
struct op { struct op {
void operator() (value_type& e, value_type& t) { e -= t; } GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; }
}; };
_apply_op(that, op()); _apply_op(that, op());
} }
void operator += (const VecType& that) GLM_FUNC_QUALIFIER void operator += (const VecType& that)
{ {
struct op { struct op {
void operator() (value_type& e, value_type& t) { e += t; } GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; }
}; };
_apply_op(that, op()); _apply_op(that, op());
} }
void operator *= (const VecType& that) GLM_FUNC_QUALIFIER void operator *= (const VecType& that)
{ {
struct op { struct op {
void operator() (value_type& e, value_type& t) { e *= t; } GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; }
}; };
_apply_op(that, op()); _apply_op(that, op());
} }
void operator /= (const VecType& that) GLM_FUNC_QUALIFIER void operator /= (const VecType& that)
{ {
struct op { struct op {
void operator() (value_type& e, value_type& t) { e /= t; } GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; }
}; };
_apply_op(that, op()); _apply_op(that, op());
} }
value_type& operator[] (size_t i) GLM_FUNC_QUALIFIER value_type& operator[] (size_t i)
{ {
static const int offset_dst[4] = { E0, E1, E2, E3 }; #ifndef __CUDA_ARCH__
static
#endif
const int offset_dst[4] = { E0, E1, E2, E3 };
return this->elem(offset_dst[i]); return this->elem(offset_dst[i]);
} }
value_type operator[] (size_t i) const GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const
{ {
static const int offset_dst[4] = { E0, E1, E2, E3 }; #ifndef __CUDA_ARCH__
static
#endif
const int offset_dst[4] = { E0, E1, E2, E3 };
return this->elem(offset_dst[i]); return this->elem(offset_dst[i]);
} }
protected: protected:
template <typename T> template <typename T>
void _apply_op(const VecType& that, T op) GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op)
{ {
// Make a copy of the data in this == &that. // Make a copy of the data in this == &that.
// The copier should optimize out the copy in cases where the function is // The copier should optimize out the copy in cases where the function is
@ -191,11 +197,14 @@ namespace detail
typedef ValueType value_type; typedef ValueType value_type;
struct Stub {}; struct Stub {};
_swizzle_base2& operator= (Stub const &) { return *this; } GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; }
value_type operator[] (size_t i) const GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const
{ {
static const int offset_dst[4] = { E0, E1, E2, E3 }; #ifndef __CUDA_ARCH__
static
#endif
const int offset_dst[4] = { E0, E1, E2, E3 };
return this->elem(offset_dst[i]); return this->elem(offset_dst[i]);
} }
}; };
@ -207,7 +216,7 @@ namespace detail
using base_type::operator=; using base_type::operator=;
operator VecType () const { return (*this)(); } GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); }
}; };
// //
@ -223,17 +232,17 @@ namespace detail
// //
#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ #define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
_GLM_SWIZZLE_TEMPLATE2 \ _GLM_SWIZZLE_TEMPLATE2 \
V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \
{ \ { \
return a() OPERAND b(); \ return a() OPERAND b(); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \
{ \ { \
return a() OPERAND b; \ return a() OPERAND b; \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \
{ \ { \
return a OPERAND b(); \ return a OPERAND b(); \
} }
@ -243,12 +252,12 @@ namespace detail
// //
#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ #define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \
{ \ { \
return a() OPERAND b; \ return a() OPERAND b; \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \
{ \ { \
return a OPERAND b(); \ return a OPERAND b(); \
} }
@ -258,7 +267,7 @@ namespace detail
// //
#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ #define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \
{ \ { \
return FUNCTION(a()); \ return FUNCTION(a()); \
} }
@ -268,22 +277,22 @@ namespace detail
// //
#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ #define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \
_GLM_SWIZZLE_TEMPLATE2 \ _GLM_SWIZZLE_TEMPLATE2 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \
{ \ { \
return FUNCTION(a(), b()); \ return FUNCTION(a(), b()); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \
{ \ { \
return FUNCTION(a(), b()); \ return FUNCTION(a(), b()); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \
{ \ { \
return FUNCTION(a(), b); \ return FUNCTION(a(), b); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \
{ \ { \
return FUNCTION(a, b()); \ return FUNCTION(a, b()); \
} }
@ -293,22 +302,22 @@ namespace detail
// //
#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ #define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \
_GLM_SWIZZLE_TEMPLATE2 \ _GLM_SWIZZLE_TEMPLATE2 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \
{ \ { \
return FUNCTION(a(), b(), c); \ return FUNCTION(a(), b(), c); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \
{ \ { \
return FUNCTION(a(), b(), c); \ return FUNCTION(a(), b(), c); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\
{ \ { \
return FUNCTION(a(), b, c); \ return FUNCTION(a(), b, c); \
} \ } \
_GLM_SWIZZLE_TEMPLATE1 \ _GLM_SWIZZLE_TEMPLATE1 \
typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \
{ \ { \
return FUNCTION(a, b(), c); \ return FUNCTION(a, b(), c); \
} }

View File

@ -52,6 +52,7 @@
#define GLM_PLATFORM_CHROME_NACL 0x00200000 #define GLM_PLATFORM_CHROME_NACL 0x00200000
#define GLM_PLATFORM_UNIX 0x00400000 #define GLM_PLATFORM_UNIX 0x00400000
#define GLM_PLATFORM_QNXNTO 0x00800000 #define GLM_PLATFORM_QNXNTO 0x00800000
#define GLM_PLATFORM_WINCE 0x01000000
#ifdef GLM_FORCE_PLATFORM_UNKNOWN #ifdef GLM_FORCE_PLATFORM_UNKNOWN
# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
@ -59,6 +60,8 @@
# define GLM_PLATFORM GLM_PLATFORM_QNXNTO # define GLM_PLATFORM GLM_PLATFORM_QNXNTO
#elif defined(__APPLE__) #elif defined(__APPLE__)
# define GLM_PLATFORM GLM_PLATFORM_APPLE # define GLM_PLATFORM GLM_PLATFORM_APPLE
#elif defined(WINCE)
# define GLM_PLATFORM GLM_PLATFORM_WINCE
#elif defined(_WIN32) #elif defined(_WIN32)
# define GLM_PLATFORM GLM_PLATFORM_WINDOWS # define GLM_PLATFORM GLM_PLATFORM_WINDOWS
#elif defined(__native_client__) #elif defined(__native_client__)
@ -76,20 +79,24 @@
// Report platform detection // Report platform detection
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED)) #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
# define GLM_MESSAGE_PLATFORM_DISPLAYED # define GLM_MESSAGE_PLATFORM_DISPLAYED
# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) # if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
# pragma message("GLM: Windows platform detected") # pragma message("GLM: QNX platform detected")
//# elif(GLM_PLATFORM & GLM_PLATFORM_IOS) //# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
//# pragma message("GLM: iOS platform detected") //# pragma message("GLM: iOS platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_APPLE) # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
# pragma message("GLM: Apple platform detected") # pragma message("GLM: Apple platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
# pragma message("GLM: WinCE platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
# pragma message("GLM: Windows platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
# pragma message("GLM: Native Client detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# pragma message("GLM: Android platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_LINUX) # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
# pragma message("GLM: Linux platform detected") # pragma message("GLM: Linux platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNIX) # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
# pragma message("GLM: UNIX platform detected") # pragma message("GLM: UNIX platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# pragma message("GLM: Android platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
# pragma message("GLM: Chrone Native Client detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN) # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
# pragma message("GLM: platform unknown") # pragma message("GLM: platform unknown")
# else # else
@ -117,6 +124,7 @@
#define GLM_COMPILER_VC2008 0x01000080 #define GLM_COMPILER_VC2008 0x01000080
#define GLM_COMPILER_VC2010 0x01000090 #define GLM_COMPILER_VC2010 0x01000090
#define GLM_COMPILER_VC2012 0x010000A0 #define GLM_COMPILER_VC2012 0x010000A0
#define GLM_COMPILER_VC2013 0x010000B0
// GCC defines // GCC defines
#define GLM_COMPILER_GCC 0x02000000 #define GLM_COMPILER_GCC 0x02000000
@ -266,6 +274,8 @@
# define GLM_COMPILER GLM_COMPILER_VC2010 # define GLM_COMPILER GLM_COMPILER_VC2010
# elif _MSC_VER == 1700 # elif _MSC_VER == 1700
# define GLM_COMPILER GLM_COMPILER_VC2012 # define GLM_COMPILER GLM_COMPILER_VC2012
# elif _MSC_VER == 1800
# define GLM_COMPILER GLM_COMPILER_VC2013
# else//_MSC_VER # else//_MSC_VER
# define GLM_COMPILER GLM_COMPILER_VC # define GLM_COMPILER GLM_COMPILER_VC
# endif//_MSC_VER # endif//_MSC_VER

View File

@ -54,21 +54,21 @@ namespace detail
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS) # if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
union union
{ {
# if(defined(GLM_SWIZZLE)) struct{value_type x, y;};
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y) struct{value_type r, g;};
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g) struct{value_type s, t;};
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
# endif//(defined(GLM_SWIZZLE))
struct {value_type r, g;}; # if(defined(GLM_SWIZZLE))
struct {value_type s, t;}; _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
struct {value_type x, y;}; _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
# endif//(defined(GLM_SWIZZLE))
}; };
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) # elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;}; union {value_type x, r, s;};

View File

@ -54,21 +54,21 @@ namespace detail
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS) # if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
union union
{ {
# if(defined(GLM_SWIZZLE)) struct{value_type x, y, z;};
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z) struct{value_type r, g, b;};
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b) struct{value_type s, t, p;};
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
# endif//(defined(GLM_SWIZZLE))
struct {value_type r, g, b;}; # if(defined(GLM_SWIZZLE))
struct {value_type s, t, p;}; _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
struct {value_type x, y, z;}; _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
# endif//(defined(GLM_SWIZZLE))
}; };
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) # elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;}; union {value_type x, r, s;};

View File

@ -54,6 +54,10 @@ namespace detail
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS) # if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
union union
{ {
struct {value_type r, g, b, a;};
struct {value_type s, t, p, q;};
struct {value_type x, y, z, w;};
# if(defined(GLM_SWIZZLE)) # if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w) _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a) _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
@ -65,10 +69,6 @@ namespace detail
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a) _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q) _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
# endif//(defined(GLM_SWIZZLE)) # endif//(defined(GLM_SWIZZLE))
struct {value_type r, g, b, a;};
struct {value_type s, t, p, q;};
struct {value_type x, y, z, w;};
}; };
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) # elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;}; union {value_type x, r, s;};

View File

@ -31,7 +31,7 @@ namespace glm
/// @addtogroup gtc_type_ptr /// @addtogroup gtc_type_ptr
/// @{ /// @{
/// Return the constant address to the data of the input parameter. /// Return the constant address to the data of the vector input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -42,7 +42,7 @@ namespace glm
return &(vec.x); return &(vec.x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the vector input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -53,7 +53,7 @@ namespace glm
return &(vec.x); return &(vec.x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the vector input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -64,7 +64,7 @@ namespace glm
return &(vec.x); return &(vec.x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the vector input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -75,7 +75,7 @@ namespace glm
return &(vec.x); return &(vec.x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the vector input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -86,7 +86,7 @@ namespace glm
return &(vec.x); return &(vec.x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the vector input.
//! From GLM_GTC_type_ptr extension. //! From GLM_GTC_type_ptr extension.
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -97,7 +97,7 @@ namespace glm
return &(vec.x); return &(vec.x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -108,7 +108,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -119,7 +119,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -130,7 +130,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -141,7 +141,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -152,7 +152,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
//! From GLM_GTC_type_ptr extension. //! From GLM_GTC_type_ptr extension.
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -163,7 +163,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -174,7 +174,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -185,7 +185,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -196,7 +196,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -207,7 +207,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -218,7 +218,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -229,7 +229,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -240,7 +240,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -251,7 +251,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -262,7 +262,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. //! Return the address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr GLM_FUNC_QUALIFIER T * value_ptr
@ -273,7 +273,7 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the constant address to the data of the input parameter. /// Return the constant address to the data of the matrix input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
@ -284,6 +284,25 @@ namespace glm
return &(mat[0].x); return &(mat[0].x);
} }
//! Return the address to the data of the matrix input.
/// @see gtc_type_ptr
template<typename T>
GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3<T> & mat)
{
return &(mat[0].x);
}
/// Return the constant address to the data of the quaternion input.
/// @see gtc_type_ptr
template<typename T, precision P>
GLM_FUNC_QUALIFIER T * value_ptr
(
detail::tquat<T, P> & q
)
{
return &(q[0]);
}
//! Return the constant address to the data of the input parameter. //! Return the constant address to the data of the input parameter.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T, precision P>
@ -295,12 +314,15 @@ namespace glm
return &(q[0]); return &(q[0]);
} }
//! Get the address of the matrix content. //! Return the address to the data of the quaternion input.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T, precision P> template<typename T>
GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3<T, P> & mat) GLM_FUNC_QUALIFIER T * value_ptr
(
detail::tquat<T> & q
)
{ {
return &(mat[0].x); return &(q[0]);
} }
//! Build a vector from a pointer. //! Build a vector from a pointer.

View File

@ -53,10 +53,13 @@ GLM 0.9.5.0: 2013-XX-XX
- Fixed perspective with zNear == 0 (#71) - Fixed perspective with zNear == 0 (#71)
================================================================================ ================================================================================
GLM 0.9.4.5: 2013-06-XX GLM 0.9.4.5: 2013-08-12
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed CUDA support
- Fixed inclusion of intrinsics in "pure" mode #92 - Fixed inclusion of intrinsics in "pure" mode #92
- Fixed language detection on GCC when the C++0x mode isn't enabled #95 - Fixed language detection on GCC when the C++0x mode isn't enabled #95
- Added missing value_ptr for quaternions #99
- Added WINCE detection #92
================================================================================ ================================================================================
GLM 0.9.4.4: 2013-05-29 GLM 0.9.4.4: 2013-05-29