Fixed merge

This commit is contained in:
Christophe Riccio 2013-08-18 14:06:38 +02:00
commit 4570daf7d2
7 changed files with 92 additions and 63 deletions

View File

@ -60,8 +60,8 @@ namespace detail
typedef T value_type;
protected:
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 value_type& elem (size_t i) { return (reinterpret_cast<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.
// The size 1 buffer is assumed to aligned to the actual members so that the
@ -77,19 +77,19 @@ namespace detail
template <typename T, typename V, int E0, int E1>
struct _swizzle_base1<T,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, typename V, int E0, int E1, int E2>
struct _swizzle_base1<T,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, typename V, int E0, int E1, int E2, int E3>
struct _swizzle_base1<T,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
@ -110,67 +110,73 @@ namespace detail
typedef VecType vec_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)
(*this)[i] = t;
return *this;
}
_swizzle_base2& operator= (const VecType& that)
GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that)
{
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());
return *this;
}
void operator -= (const VecType& that)
GLM_FUNC_QUALIFIER void operator -= (const VecType& that)
{
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());
}
void operator += (const VecType& that)
GLM_FUNC_QUALIFIER void operator += (const VecType& that)
{
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());
}
void operator *= (const VecType& that)
GLM_FUNC_QUALIFIER void operator *= (const VecType& that)
{
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());
}
void operator /= (const VecType& that)
GLM_FUNC_QUALIFIER void operator /= (const VecType& that)
{
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());
}
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]);
}
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]);
}
protected:
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.
// The copier should optimize out the copy in cases where the function is
@ -191,11 +197,14 @@ namespace detail
typedef ValueType value_type;
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]);
}
};
@ -207,7 +216,7 @@ namespace detail
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) \
_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(); \
} \
_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; \
} \
_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(); \
}
@ -243,12 +252,12 @@ namespace detail
//
#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
_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; \
} \
_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(); \
}
@ -258,7 +267,7 @@ namespace detail
//
#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \
_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()); \
}
@ -268,22 +277,22 @@ namespace detail
//
#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \
_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()); \
} \
_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()); \
} \
_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); \
} \
_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()); \
}
@ -293,22 +302,22 @@ namespace detail
//
#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \
_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); \
} \
_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); \
} \
_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); \
} \
_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); \
}

View File

@ -36,7 +36,7 @@
#define GLM_VERSION_MAJOR 0
#define GLM_VERSION_MINOR 9
#define GLM_VERSION_PATCH 4
#define GLM_VERSION_REVISION 5
#define GLM_VERSION_REVISION 6
///////////////////////////////////////////////////////////////////////////////////////////////////
// Platform
@ -77,20 +77,24 @@
// Report platform detection
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
# define GLM_MESSAGE_PLATFORM_DISPLAYED
# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
# pragma message("GLM: Windows platform detected")
# if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
# pragma message("GLM: QNX platform detected")
//# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
//# pragma message("GLM: iOS platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
# 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)
# pragma message("GLM: Linux platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
# 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)
# pragma message("GLM: platform unknown")
# else
@ -118,6 +122,7 @@
#define GLM_COMPILER_VC2008 0x01000080
#define GLM_COMPILER_VC2010 0x01000090
#define GLM_COMPILER_VC2012 0x010000A0
#define GLM_COMPILER_VC2013 0x010000B0
// GCC defines
#define GLM_COMPILER_GCC 0x02000000
@ -267,6 +272,8 @@
# define GLM_COMPILER GLM_COMPILER_VC2010
# elif _MSC_VER == 1700
# define GLM_COMPILER GLM_COMPILER_VC2012
# elif _MSC_VER == 1800
# define GLM_COMPILER GLM_COMPILER_VC2013
# else//_MSC_VER
# define GLM_COMPILER GLM_COMPILER_VC
# endif//_MSC_VER

View File

@ -62,6 +62,10 @@ namespace detail
# if(GLM_COMPONENT == GLM_COMPONENT_CXX11)
union
{
struct{value_type x, y;};
struct{value_type r, g;};
struct{value_type s, t;};
# if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE2_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, x, y)
_GLM_SWIZZLE2_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, r, g)
@ -73,10 +77,6 @@ namespace detail
_GLM_SWIZZLE2_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, r, g)
_GLM_SWIZZLE2_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, s, t)
# endif//(defined(GLM_SWIZZLE))
struct{value_type r, g;};
struct{value_type s, t;};
struct{value_type x, y;};
};
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;};

View File

@ -62,6 +62,10 @@ namespace detail
# if(GLM_COMPONENT == GLM_COMPONENT_CXX11)
union
{
struct{value_type x, y, z;};
struct{value_type r, g, b;};
struct{value_type s, t, p;};
# if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, r, g, b)
@ -73,10 +77,6 @@ namespace detail
_GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, s, t, p)
# endif//(defined(GLM_SWIZZLE))
struct{value_type r, g, b;};
struct{value_type s, t, p;};
struct{value_type x, y, z;};
};
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;};

View File

@ -62,6 +62,10 @@ namespace detail
# if(GLM_COMPONENT == GLM_COMPONENT_CXX11)
union
{
struct{value_type x, y, z, w;};
struct{value_type r, g, b, a;};
struct{value_type s, t, p, q;};
# if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE4_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, x, y, z, w)
_GLM_SWIZZLE4_2_MEMBERS(value_type, glm::detail::tvec2<value_type>, r, g, b, a)
@ -73,10 +77,6 @@ namespace detail
_GLM_SWIZZLE4_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, r, g, b, a)
_GLM_SWIZZLE4_4_MEMBERS(value_type, glm::detail::tvec4<value_type>, s, t, p, q)
# 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)
union {value_type x, r, s;};

View File

@ -284,6 +284,14 @@ namespace glm
return &(mat[0].x);
}
//! Get the address of the matrix content.
/// @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 input parameter.
/// @see gtc_type_ptr
template<typename T>
@ -295,12 +303,15 @@ namespace glm
return &(q[0]);
}
//! Get the address of the matrix content.
//! Return the constant address to the data of the input parameter.
/// @see gtc_type_ptr
template<typename T>
GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3<T> & mat)
GLM_FUNC_QUALIFIER T * value_ptr
(
detail::tquat<T> & q
)
{
return &(mat[0].x);
return &(q[0]);
}
//! Build a vector from a pointer.

View File

@ -37,13 +37,15 @@ More informations in GLM manual:
http://glm.g-truc.net/glm.pdf
================================================================================
GLM 0.9.4.5: 2013-07-15
GLM 0.9.4.5: 2013-08-12
--------------------------------------------------------------------------------
- Fixed inclusion of intrinsics in "pure" mode #92
- Fixed CUDA support
- Fixed inclusion of intrinsics in "pure" mode #92
- Fixed language detection on GCC when the C++0x mode isn't enabled #95
- Fixed issue #97: register is deprecated in C++11
- Fixed issue #96: CUDA issues
- Added Windows CE detection #92
- Added missing value_ptr for quaternions #99
================================================================================
GLM 0.9.4.4: 2013-05-29