Merge branch '0.9.5' into packing

This commit is contained in:
Christophe Riccio 2013-08-27 10:16:55 +02:00
commit 0330485171
12 changed files with 249 additions and 233 deletions

View File

@ -11,47 +11,32 @@ if(NOT GLM_TEST_ENABLE)
message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench") message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
endif() endif()
option(GLM_USE_INTEL "Use Intel Compiler" OFF) if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX))
option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF)
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
option(GLM_TEST_ENABLE_CXX_1Y "Enable C++ 1y" OFF)
option(GLM_TEST_ENABLE_CXX_PEDANTIC "Pedantic" ON)
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF) if(GLM_TEST_ENABLE_CXX_PEDANTIC)
if(GLM_TEST_ENABLE_CXX_11) add_definitions(-pedantic)
if(GLM_USE_INTEL)
add_definitions(/Qstd=c++0x)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(GLM_TEST_ENABLE_CXX_1Y)
add_definitions(-std=c++1y)
elseif(GLM_TEST_ENABLE_CXX_11)
add_definitions(-std=c++11)
elseif(GLM_TEST_ENABLE_CXX_0X)
add_definitions(-std=c++0x) add_definitions(-std=c++0x)
endif() elseif(GLM_TEST_ENABLE_CXX_98)
elseif(NOT GLM_TEST_ENABLE_CXX_11)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=c++98) add_definitions(-std=c++98)
endif() endif()
endif() endif()
option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF) if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32))
if(GLM_TEST_ENABLE_LANG_EXTENSIONS) option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF)
if(GLM_USE_INTEL)
add_definitions(/Qintel-extensions)
add_definitions(-intel-extensions)
endif()
if(CMAKE_COMPILER_IS_GNUCXX) if(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
#Doesn't seem to work...
#add_definitions(-fms-extensions)
#add_definitions(-D_MSC_EXTENSIONS)
endif()
elseif(NOT GLM_TEST_ENABLE_LANG_EXTENSIONS)
if(GLM_USE_INTEL)
add_definitions(/Qintel-extensions-)
add_definitions(-no-intel-extensions)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-pedantic)
endif()
if(MSVC)
add_definitions(/Za) add_definitions(/Za)
endif() endif()
endif() endif()

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
@ -105,6 +112,17 @@
#define GLM_COMPILER_UNKNOWN 0x00000000 #define GLM_COMPILER_UNKNOWN 0x00000000
// Intel
#define GLM_COMPILER_INTEL 0x00100000
#define GLM_COMPILER_INTEL9 0x00100010
#define GLM_COMPILER_INTEL10_0 0x00100020
#define GLM_COMPILER_INTEL10_1 0x00100030
#define GLM_COMPILER_INTEL11_0 0x00100040
#define GLM_COMPILER_INTEL11_1 0x00100050
#define GLM_COMPILER_INTEL12_0 0x00100060
#define GLM_COMPILER_INTEL12_1 0x00100070
#define GLM_COMPILER_INTEL13_0 0x00100080
// Visual C++ defines // Visual C++ defines
#define GLM_COMPILER_VC 0x01000000 #define GLM_COMPILER_VC 0x01000000
#define GLM_COMPILER_VC2 0x01000010 #define GLM_COMPILER_VC2 0x01000010
@ -117,6 +135,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
@ -137,8 +156,6 @@
#define GLM_COMPILER_GCC46 0x020000D0 #define GLM_COMPILER_GCC46 0x020000D0
#define GLM_COMPILER_GCC47 0x020000E0 #define GLM_COMPILER_GCC47 0x020000E0
#define GLM_COMPILER_GCC48 0x020000F0 #define GLM_COMPILER_GCC48 0x020000F0
#define GLM_COMPILER_GCC49 0x02000100
#define GLM_COMPILER_GCC50 0x02000200
// G++ command line to display defined // G++ command line to display defined
// echo "" | g++ -E -dM -x c++ - | sort // echo "" | g++ -E -dM -x c++ - | sort
@ -181,17 +198,6 @@
// LLVM GCC // LLVM GCC
#define GLM_COMPILER_LLVM_GCC 0x40000000 #define GLM_COMPILER_LLVM_GCC 0x40000000
// Intel
#define GLM_COMPILER_INTEL 0x80000000
#define GLM_COMPILER_INTEL9 0x80000010
#define GLM_COMPILER_INTEL10_0 0x80000020
#define GLM_COMPILER_INTEL10_1 0x80000030
#define GLM_COMPILER_INTEL11_0 0x80000040
#define GLM_COMPILER_INTEL11_1 0x80000050
#define GLM_COMPILER_INTEL12_0 0x80000060
#define GLM_COMPILER_INTEL12_1 0x80000070
#define GLM_COMPILER_INTEL13_0 0x80000080
// Build model // Build model
#define GLM_MODEL_32 0x00000010 #define GLM_MODEL_32 0x00000010
#define GLM_MODEL_64 0x00000020 #define GLM_MODEL_64 0x00000020
@ -215,7 +221,7 @@
# define GLM_COMPILER GLM_COMPILER_INTEL12_0 # define GLM_COMPILER GLM_COMPILER_INTEL12_0
# elif __INTEL_COMPILER == 1210 # elif __INTEL_COMPILER == 1210
# define GLM_COMPILER GLM_COMPILER_INTEL12_1 # define GLM_COMPILER GLM_COMPILER_INTEL12_1
# elif __INTEL_COMPILER == 1300 # elif __INTEL_COMPILER >= 1300
# define GLM_COMPILER GLM_COMPILER_INTEL13_0 # define GLM_COMPILER GLM_COMPILER_INTEL13_0
# else # else
# define GLM_COMPILER GLM_COMPILER_INTEL # define GLM_COMPILER GLM_COMPILER_INTEL
@ -223,41 +229,16 @@
// CUDA // CUDA
#elif defined(__CUDACC__) #elif defined(__CUDACC__)
# define GLM_COMPILER GLM_COMPILER_CUDA
/*
# if CUDA_VERSION < 3000 # if CUDA_VERSION < 3000
# error "GLM requires CUDA 3.0 or higher" # error "GLM requires CUDA 3.0 or higher"
# elif CUDA_VERSION == 3000
# define GLM_COMPILER GLM_COMPILER_CUDA30
# elif CUDA_VERSION == 3010
# define GLM_COMPILER GLM_COMPILER_CUDA31
# elif CUDA_VERSION == 3020
# define GLM_COMPILER GLM_COMPILER_CUDA32
# elif CUDA_VERSION == 4000
# define GLM_COMPILER GLM_COMPILER_CUDA40
# elif CUDA_VERSION == 4010
# define GLM_COMPILER GLM_COMPILER_CUDA41
# elif CUDA_VERSION == 4020
# define GLM_COMPILER GLM_COMPILER_CUDA42
# else # else
# define GLM_COMPILER GLM_COMPILER_CUDA # define GLM_COMPILER GLM_COMPILER_CUDA
# endif # endif
*/
// Visual C++ // Visual C++
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# if _MSC_VER == 900 # if _MSC_VER < 1400
# define GLM_COMPILER GLM_COMPILER_VC2 # error "GLM requires Visual C++ 2005 or higher"
# elif _MSC_VER == 1000
# define GLM_COMPILER GLM_COMPILER_VC4
# elif _MSC_VER == 1100
# define GLM_COMPILER GLM_COMPILER_VC5
# elif _MSC_VER == 1200
# define GLM_COMPILER GLM_COMPILER_VC6
# elif _MSC_VER == 1300
# define GLM_COMPILER GLM_COMPILER_VC2002
# elif _MSC_VER == 1310
# define GLM_COMPILER GLM_COMPILER_VC2003
# elif _MSC_VER == 1400 # elif _MSC_VER == 1400
# define GLM_COMPILER GLM_COMPILER_VC2005 # define GLM_COMPILER GLM_COMPILER_VC2005
# elif _MSC_VER == 1500 # elif _MSC_VER == 1500
@ -266,13 +247,17 @@
# 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
// Clang // Clang
#elif defined(__clang__) #elif defined(__clang__)
# if(__clang_major__ == 2) && (__clang_minor__ == 6) # if (__clang_major__ <= 1) || ((__clang_major__ == 2) && (__clang_minor__ < 6))
# error "GLM requires Clang 2.6 or higher"
# elif(__clang_major__ == 2) && (__clang_minor__ == 6)
# define GLM_COMPILER GLM_COMPILER_CLANG26 # define GLM_COMPILER GLM_COMPILER_CLANG26
# elif(__clang_major__ == 2) && (__clang_minor__ == 7) # elif(__clang_major__ == 2) && (__clang_minor__ == 7)
# define GLM_COMPILER GLM_COMPILER_CLANG27 # define GLM_COMPILER GLM_COMPILER_CLANG27
@ -294,7 +279,9 @@
# define GLM_COMPILER GLM_COMPILER_CLANG41 # define GLM_COMPILER GLM_COMPILER_CLANG41
# elif(__clang_major__ == 4) && (__clang_minor__ == 2) # elif(__clang_major__ == 4) && (__clang_minor__ == 2)
# define GLM_COMPILER GLM_COMPILER_CLANG42 # define GLM_COMPILER GLM_COMPILER_CLANG42
# elif(__clang_major__ == 4) && (__clang_minor__ == 3) # elif(__clang_major__ == 4) && (__clang_minor__ >= 3)
# define GLM_COMPILER GLM_COMPILER_CLANG43
# elif(__clang_major__ > 4)
# define GLM_COMPILER GLM_COMPILER_CLANG43 # define GLM_COMPILER GLM_COMPILER_CLANG43
# else # else
# define GLM_COMPILER GLM_COMPILER_CLANG # define GLM_COMPILER GLM_COMPILER_CLANG
@ -328,27 +315,17 @@
# define GLM_COMPILER (GLM_COMPILER_GCC47) # define GLM_COMPILER (GLM_COMPILER_GCC47)
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
# define GLM_COMPILER (GLM_COMPILER_GCC48) # define GLM_COMPILER (GLM_COMPILER_GCC48)
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9) # elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
# define GLM_COMPILER (GLM_COMPILER_GCC49)
# elif (__GNUC__ > 4 )
# define GLM_COMPILER (GLM_COMPILER_GCC49) # define GLM_COMPILER (GLM_COMPILER_GCC49)
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
# define GLM_COMPILER (GLM_COMPILER_GCC50)
# else # else
# define GLM_COMPILER (GLM_COMPILER_GCC) # define GLM_COMPILER (GLM_COMPILER_GCC)
# endif # endif
// Borland C++ // Borland C++
#elif defined(_BORLANDC_) #elif defined(_BORLANDC_)
# if defined(VER125)
# define GLM_COMPILER GLM_COMPILER_BCB4
# elif defined(VER130)
# define GLM_COMPILER GLM_COMPILER_BCB5
# elif defined(VER140)
# define GLM_COMPILER GLM_COMPILER_BCB6
# elif defined(VER200)
# define GLM_COMPILER GLM_COMPILER_BCB2009
# else
# define GLM_COMPILER GLM_COMPILER_BC # define GLM_COMPILER GLM_COMPILER_BC
# endif
// Codewarrior // Codewarrior
#elif defined(__MWERKS__) #elif defined(__MWERKS__)
@ -446,7 +423,19 @@
#else #else
# if(__cplusplus >= 201103L) # if(__cplusplus >= 201103L)
# define GLM_LANG GLM_LANG_CXX11 # define GLM_LANG GLM_LANG_CXX11
// -std=c++0x or -std=gnu++0x # elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG)
# if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
# define GLM_DETAIL_MAJOR 1
# else
# define GLM_DETAIL_MAJOR 0
# endif
# if(__clang_major__ < (2 + GLM_DETAIL_MAJOR))
# define GLM_LANG GLM_LANG_CXX
# elif(__has_feature(cxx_auto_type))
# define GLM_LANG GLM_LANG_CXX0X
# else
# define GLM_LANG GLM_LANG_CXX98
# endif
# elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) # elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC)
# if defined(__GXX_EXPERIMENTAL_CXX0X__) # if defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GLM_LANG GLM_LANG_CXX0X # define GLM_LANG GLM_LANG_CXX0X
@ -455,17 +444,13 @@
# endif # endif
# elif(GLM_COMPILER & GLM_COMPILER_VC) # elif(GLM_COMPILER & GLM_COMPILER_VC)
# if(defined(_MSC_EXTENSIONS)) # if(defined(_MSC_EXTENSIONS))
# if(GLM_COMPILER >= GLM_COMPILER_VC2012) # if(GLM_COMPILER >= GLM_COMPILER_VC2010)
# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
# else # else
# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
# endif # endif
# else # else
# if(GLM_COMPILER >= GLM_COMPILER_VC2012) # if(GLM_COMPILER >= GLM_COMPILER_VC2010)
# define GLM_LANG GLM_LANG_CXX11
# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
# define GLM_LANG GLM_LANG_CXX0X # define GLM_LANG GLM_LANG_CXX0X
# else # else
# define GLM_LANG GLM_LANG_CXX98 # define GLM_LANG GLM_LANG_CXX98
@ -536,7 +521,9 @@
#elif(defined(GLM_FORCE_SSE2)) #elif(defined(GLM_FORCE_SSE2))
# define GLM_ARCH (GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2)
#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64))) #elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
# if(defined(_M_CEE_PURE)) # if(GLM_PLATFORM == GLM_PLATFORM_WINCE)
# define GLM_ARCH GLM_ARCH_PURE
# elif(defined(_M_CEE_PURE))
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
/* TODO: Explore auto detection of instruction set support /* TODO: Explore auto detection of instruction set support
# elif(defined(_M_IX86_FP)) # elif(defined(_M_IX86_FP))

View File

@ -32,8 +32,7 @@
#include "setup.hpp" #include "setup.hpp"
#if(((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) #if(((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
//#if((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) # include <cstdint>
#include <cstdint>
#endif #endif
namespace glm{ namespace glm{
@ -78,13 +77,13 @@ namespace detail
typedef uint64 uint64; typedef uint64 uint64;
#endif// #endif//
typedef signed short lowp_int_t; typedef signed int lowp_int_t;
typedef signed int mediump_int_t; typedef signed int mediump_int_t;
typedef int64 highp_int_t; typedef signed int highp_int_t;
typedef unsigned short lowp_uint_t; typedef unsigned int lowp_uint_t;
typedef unsigned int mediump_uint_t; typedef unsigned int mediump_uint_t;
typedef uint64 highp_uint_t; typedef unsigned int highp_uint_t;
}//namespace detail }//namespace detail
typedef detail::int8 int8; typedef detail::int8 int8;
@ -217,7 +216,11 @@ namespace detail
GLM_DETAIL_IS_INT(signed short); GLM_DETAIL_IS_INT(signed short);
GLM_DETAIL_IS_INT(signed int); GLM_DETAIL_IS_INT(signed int);
GLM_DETAIL_IS_INT(signed long); GLM_DETAIL_IS_INT(signed long);
GLM_DETAIL_IS_INT(highp_int_t); # if(GLM_LANG >= GLM_LANG_CXX0X)
GLM_DETAIL_IS_INT(signed long long);
# else
GLM_DETAIL_IS_INT(glm::int64);
# endif
////////////////// //////////////////
// uint // uint
@ -247,7 +250,11 @@ namespace detail
GLM_DETAIL_IS_UINT(unsigned short); GLM_DETAIL_IS_UINT(unsigned short);
GLM_DETAIL_IS_UINT(unsigned int); GLM_DETAIL_IS_UINT(unsigned int);
GLM_DETAIL_IS_UINT(unsigned long); GLM_DETAIL_IS_UINT(unsigned long);
GLM_DETAIL_IS_UINT(highp_uint_t); # if(GLM_LANG >= GLM_LANG_CXX0X)
GLM_DETAIL_IS_INT(unsigned long long);
# else
GLM_DETAIL_IS_INT(glm::uint64);
# endif
////////////////// //////////////////
// bool // bool

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 x, y;};
struct{value_type r, g;};
struct{value_type s, t;};
# if(defined(GLM_SWIZZLE)) # if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y) _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g) _GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
@ -65,10 +69,6 @@ namespace detail
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g) _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t) _GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
# endif//(defined(GLM_SWIZZLE)) # 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) # 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 x, y, z;};
struct{value_type r, g, b;};
struct{value_type s, t, p;};
# if(defined(GLM_SWIZZLE)) # if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z) _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b) _GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
@ -65,10 +69,6 @@ namespace detail
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b) _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p) _GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
# endif//(defined(GLM_SWIZZLE)) # 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) # 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,28 @@ 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.6: 2013-08-XX
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed detection to select the last known compiler if newer version #106
- Fixed is_int and is_uint code duplication with GCC and C++11 #107
- Fixed test suite build while using Clang in C++11 mode
- Added c++1y mode support in CMake test suite
- Removed ms extension mode to CMake when no using Visual C++
- Added pedantic mode to CMake test suite for Clang and GCC
- Added use of GCC frontend on Unix for ICC and Visual C++ fronted on Windows
for ICC
- Added compilation errors for unsupported compiler versions
================================================================================
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
- 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 GLM 0.9.4.4: 2013-05-29

View File

@ -170,15 +170,7 @@ namespace findMSB
{0x08000000, 27}, {0x08000000, 27},
{0x10000000, 28}, {0x10000000, 28},
{0x20000000, 29}, {0x20000000, 29},
{0x40000000, 30}, {0x40000000, 30}
{0x80000000, 30},
{0xffffffff, -1},
{0xfffffffe, 0},
{0xfffffffd, 1},
{0xfffffffc, 1},
{0xfffffffb, 2},
{0xfffffffa, 2},
{0xfffffff0, 3}
}; };
int test() int test()
@ -209,8 +201,7 @@ namespace findLSB
{ {
{0x00000001, 0}, {0x00000001, 0},
{0x00000003, 0}, {0x00000003, 0},
{0x00000002, 1}, {0x00000002, 1}
{0x80000000, 31}
}; };
int test() int test()

View File

@ -123,8 +123,8 @@ namespace gli
glm::byte * DstData = DstMipmap.data(); glm::byte * DstData = DstMipmap.data();
glm::byte const * const SrcData = SrcMipmap.data(); glm::byte const * const SrcData = SrcMipmap.data();
std::size_t SizeX = std::min(std::size_t(SrcSize.x + SrcPosition.x), std::size_t(DstMipmap.dimensions().x + DstPosition.x)); std::size_t SizeX = glm::min(std::size_t(SrcSize.x + SrcPosition.x), std::size_t(DstMipmap.dimensions().x + DstPosition.x));
std::size_t SizeY = std::min(std::size_t(SrcSize.y + SrcPosition.y), std::size_t(DstMipmap.dimensions().y + DstPosition.y)); std::size_t SizeY = glm::min(std::size_t(SrcSize.y + SrcPosition.y), std::size_t(DstMipmap.dimensions().y + DstPosition.y));
for(std::size_t j = 0; j < SizeY; ++j) for(std::size_t j = 0; j < SizeY; ++j)
{ {

View File

@ -361,8 +361,8 @@ namespace bitfieldInterleave
int test() int test()
{ {
glm::uint32 x_max = 1 << 13; glm::uint32 x_max = 1 << 11;
glm::uint32 y_max = 1 << 12; glm::uint32 y_max = 1 << 10;
// ALU // ALU
std::vector<glm::uint64> Data(x_max * y_max); std::vector<glm::uint64> Data(x_max * y_max);
@ -493,17 +493,14 @@ namespace bitfieldInterleave
# if(GLM_ARCH != GLM_ARCH_PURE) # if(GLM_ARCH != GLM_ARCH_PURE)
{ {
// SIMD // SIMD
glm::int32 simd_x_max = 1 << 13;
glm::int32 simd_y_max = 1 << 12;
std::vector<__m128i> SimdData(x_max * y_max); std::vector<__m128i> SimdData(x_max * y_max);
std::vector<__m128i> SimdParam(x_max * y_max); std::vector<__m128i> SimdParam(x_max * y_max);
for(int i = 0; i < SimdParam.size(); ++i) for(int i = 0; i < SimdParam.size(); ++i)
SimdParam[i] = _mm_set_epi32(i % simd_x_max, 0, i / simd_y_max, 0); SimdParam[i] = _mm_set_epi32(i % x_max, 0, i / y_max, 0);
std::clock_t LastTime = std::clock(); std::clock_t LastTime = std::clock();
for(std::size_t i = 0; i < Data.size(); ++i) for(std::size_t i = 0; i < SimdData.size(); ++i)
SimdData[i] = glm::detail::_mm_bit_interleave_si128(SimdParam[i]); SimdData[i] = glm::detail::_mm_bit_interleave_si128(SimdParam[i]);
std::clock_t Time = std::clock() - LastTime; std::clock_t Time = std::clock() - LastTime;