mirror of
https://github.com/g-truc/glm.git
synced 2024-11-25 18:04:34 +00:00
C++11 implementation tests
This commit is contained in:
parent
ef15d06104
commit
9799ef57da
@ -31,40 +31,76 @@
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include "../glm.hpp"
|
||||
/*
|
||||
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
|
||||
#include <emmintrin>
|
||||
#include <cstddef>
|
||||
struct float4
|
||||
{
|
||||
union
|
||||
{
|
||||
struct {float r, g, b, a;};
|
||||
struct {float s, t, p, q;};
|
||||
struct {float x, y, z, w;};
|
||||
__m128 data;
|
||||
};
|
||||
};
|
||||
|
||||
int test_simd()
|
||||
float4(){}
|
||||
float4(float const & s) :
|
||||
x(s), y(s), z(s), w(s)
|
||||
{}
|
||||
float4(float const & x, float const & y, float const & z, float const & w) :
|
||||
x(x), y(y), z(z), w(w)
|
||||
{}
|
||||
float operator[](std::size_t i) const
|
||||
{
|
||||
float4 f;
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
return (&x)[i];
|
||||
}
|
||||
union
|
||||
{
|
||||
struct {float r, g, b, a;};
|
||||
struct {float s, t, p, q;};
|
||||
struct {float x, y, z, w;};
|
||||
__m128 data;
|
||||
}
|
||||
}
|
||||
inline float4 operator*(float4 const & a, float4 const & b)
|
||||
{
|
||||
return float4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
|
||||
}
|
||||
float4 mul_intrinsic(float4 const m[4], float4 const & v)
|
||||
{
|
||||
__m128 v0 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
__m128 v1 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(1, 1, 1, 1));
|
||||
__m128 v2 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(2, 2, 2, 2));
|
||||
__m128 v3 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
__m128 m0 = _mm_mul_ps(m[0].data, v0);
|
||||
__m128 m1 = _mm_mul_ps(m[1].data, v1);
|
||||
__m128 a0 = _mm_add_ps(m0, m1);
|
||||
__m128 m2 = _mm_mul_ps(m[2].data, v2);
|
||||
__m128 m3 = _mm_mul_ps(m[3].data, v3);
|
||||
__m128 a1 = _mm_add_ps(m2, m3);
|
||||
__m128 a2 = _mm_add_ps(a0, a1);
|
||||
float4 f;
|
||||
f.data = a2;
|
||||
return f;
|
||||
}
|
||||
float4 mul_cpp(float4 const m[4], float4 const & v)
|
||||
{
|
||||
return float4(
|
||||
m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0] * v[3],
|
||||
m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1] * v[3],
|
||||
m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2] * v[3],
|
||||
m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3] * v[3]);
|
||||
}
|
||||
float4 mul_inst_like(float4 const m[4], float4 const & v)
|
||||
{
|
||||
float4 const Mov0(v[0]);
|
||||
float4 const Mov1(v[1]);
|
||||
float4 const Mul0 = m[0] * Mov0;
|
||||
float4 const Mul1 = m[1] * Mov1;
|
||||
float4 const Add0 = Mul0 * Mul1;
|
||||
float4 const Mov2(v[2]);
|
||||
float4 const Mov3(v[3]);
|
||||
float4 const Mul2 = m[2] * Mov2;
|
||||
float4 const Mul3 = m[3] * Mov3;
|
||||
float4 const Add1 = Mul2 * Mul3;
|
||||
float4 const Add2 = Add0 * Add1;
|
||||
return Add2;
|
||||
}
|
||||
|
||||
#endif//GLM_ARCH
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
glm::mat4 A(1.0f);
|
||||
glm::vec4 B(1.0f);
|
||||
glm::vec4 C = A * B;
|
||||
|
||||
/*
|
||||
# if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
test_simd();
|
||||
# endif
|
||||
*/
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,10 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Version
|
||||
|
||||
#define GLM_VERSION 95
|
||||
#define GLM_VERSION_MAJOR 0
|
||||
#define GLM_VERSION_MINOR 9
|
||||
#define GLM_VERSION_PATCH 5
|
||||
#define GLM_VERSION 200
|
||||
#define GLM_VERSION_MAJOR 2
|
||||
#define GLM_VERSION_MINOR 0
|
||||
#define GLM_VERSION_PATCH 0
|
||||
#define GLM_VERSION_REVISION 0
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -100,127 +100,10 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Compiler
|
||||
|
||||
// User defines: GLM_FORCE_COMPILER_UNKNOWN
|
||||
// TODO ? __llvm__
|
||||
|
||||
#define GLM_COMPILER_UNKNOWN 0x00000000
|
||||
|
||||
// Visual C++ defines
|
||||
#define GLM_COMPILER_VC 0x01000000
|
||||
#define GLM_COMPILER_VC2 0x01000010
|
||||
#define GLM_COMPILER_VC4 0x01000020
|
||||
#define GLM_COMPILER_VC5 0x01000030
|
||||
#define GLM_COMPILER_VC6 0x01000040
|
||||
#define GLM_COMPILER_VC2002 0x01000050
|
||||
#define GLM_COMPILER_VC2003 0x01000060
|
||||
#define GLM_COMPILER_VC2005 0x01000070
|
||||
#define GLM_COMPILER_VC2008 0x01000080
|
||||
#define GLM_COMPILER_VC2010 0x01000090
|
||||
#define GLM_COMPILER_VC2012 0x010000A0
|
||||
|
||||
// GCC defines
|
||||
#define GLM_COMPILER_GCC 0x02000000
|
||||
#define GLM_COMPILER_GCC_LLVM 0x02000001
|
||||
#define GLM_COMPILER_GCC_CLANG 0x02000002
|
||||
#define GLM_COMPILER_GCC30 0x02000010
|
||||
#define GLM_COMPILER_GCC31 0x02000020
|
||||
#define GLM_COMPILER_GCC32 0x02000030
|
||||
#define GLM_COMPILER_GCC33 0x02000040
|
||||
#define GLM_COMPILER_GCC34 0x02000050
|
||||
#define GLM_COMPILER_GCC35 0x02000060
|
||||
#define GLM_COMPILER_GCC40 0x02000070
|
||||
#define GLM_COMPILER_GCC41 0x02000080
|
||||
#define GLM_COMPILER_GCC42 0x02000090
|
||||
#define GLM_COMPILER_GCC43 0x020000A0
|
||||
#define GLM_COMPILER_GCC44 0x020000B0
|
||||
#define GLM_COMPILER_GCC45 0x020000C0
|
||||
#define GLM_COMPILER_GCC46 0x020000D0
|
||||
#define GLM_COMPILER_GCC47 0x020000E0
|
||||
#define GLM_COMPILER_GCC48 0x020000F0
|
||||
#define GLM_COMPILER_GCC49 0x02000100
|
||||
#define GLM_COMPILER_GCC50 0x02000200
|
||||
|
||||
// G++ command line to display defined
|
||||
// echo "" | g++ -E -dM -x c++ - | sort
|
||||
|
||||
// Borland C++ defines. How to identify BC?
|
||||
#define GLM_COMPILER_BC 0x04000000
|
||||
#define GLM_COMPILER_BCB4 0x04000100
|
||||
#define GLM_COMPILER_BCB5 0x04000200
|
||||
#define GLM_COMPILER_BCB6 0x04000300
|
||||
//#define GLM_COMPILER_BCBX 0x04000400 // What's the version value?
|
||||
#define GLM_COMPILER_BCB2009 0x04000500
|
||||
|
||||
// CodeWarrior
|
||||
#define GLM_COMPILER_CODEWARRIOR 0x08000000
|
||||
|
||||
// CUDA
|
||||
#define GLM_COMPILER_CUDA 0x10000000
|
||||
#define GLM_COMPILER_CUDA30 0x10000010
|
||||
#define GLM_COMPILER_CUDA31 0x10000020
|
||||
#define GLM_COMPILER_CUDA32 0x10000030
|
||||
#define GLM_COMPILER_CUDA40 0x10000040
|
||||
#define GLM_COMPILER_CUDA41 0x10000050
|
||||
#define GLM_COMPILER_CUDA42 0x10000060
|
||||
|
||||
// Clang
|
||||
#define GLM_COMPILER_CLANG 0x20000000
|
||||
#define GLM_COMPILER_CLANG26 0x20000010
|
||||
#define GLM_COMPILER_CLANG27 0x20000020
|
||||
#define GLM_COMPILER_CLANG28 0x20000030
|
||||
#define GLM_COMPILER_CLANG29 0x20000040
|
||||
#define GLM_COMPILER_CLANG30 0x20000050
|
||||
#define GLM_COMPILER_CLANG31 0x20000060
|
||||
#define GLM_COMPILER_CLANG32 0x20000070
|
||||
#define GLM_COMPILER_CLANG33 0x20000080
|
||||
#define GLM_COMPILER_CLANG40 0x20000090
|
||||
#define GLM_COMPILER_CLANG41 0x200000A0
|
||||
#define GLM_COMPILER_CLANG42 0x200000B0
|
||||
#define GLM_COMPILER_CLANG43 0x200000C0
|
||||
|
||||
// LLVM GCC
|
||||
#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
|
||||
#define GLM_MODEL_32 0x00000010
|
||||
#define GLM_MODEL_64 0x00000020
|
||||
|
||||
// Force generic C++ compiler
|
||||
#ifdef GLM_FORCE_COMPILER_UNKNOWN
|
||||
# define GLM_COMPILER GLM_COMPILER_UNKNOWN
|
||||
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
# if __INTEL_COMPILER == 900
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL9
|
||||
# elif __INTEL_COMPILER == 1000
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL10_0
|
||||
# elif __INTEL_COMPILER == 1010
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL10_1
|
||||
# elif __INTEL_COMPILER == 1100
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL11_0
|
||||
# elif __INTEL_COMPILER == 1110
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL11_1
|
||||
# elif __INTEL_COMPILER == 1200
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL12_0
|
||||
# elif __INTEL_COMPILER == 1210
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL12_1
|
||||
# elif __INTEL_COMPILER == 1300
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL13_0
|
||||
# else
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL
|
||||
# endif
|
||||
|
||||
// CUDA
|
||||
#elif defined(__CUDACC__)
|
||||
# define GLM_COMPILER GLM_COMPILER_CUDA
|
||||
@ -244,269 +127,6 @@
|
||||
# endif
|
||||
*/
|
||||
|
||||
// Visual C++
|
||||
#elif defined(_MSC_VER)
|
||||
# if _MSC_VER == 900
|
||||
# define GLM_COMPILER GLM_COMPILER_VC2
|
||||
# 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
|
||||
# define GLM_COMPILER GLM_COMPILER_VC2005
|
||||
# elif _MSC_VER == 1500
|
||||
# define GLM_COMPILER GLM_COMPILER_VC2008
|
||||
# elif _MSC_VER == 1600
|
||||
# define GLM_COMPILER GLM_COMPILER_VC2010
|
||||
# elif _MSC_VER == 1700
|
||||
# define GLM_COMPILER GLM_COMPILER_VC2012
|
||||
# else//_MSC_VER
|
||||
# define GLM_COMPILER GLM_COMPILER_VC
|
||||
# endif//_MSC_VER
|
||||
|
||||
// Clang
|
||||
#elif defined(__clang__)
|
||||
# if(__clang_major__ == 2) && (__clang_minor__ == 6)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG26
|
||||
# elif(__clang_major__ == 2) && (__clang_minor__ == 7)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG27
|
||||
# elif(__clang_major__ == 2) && (__clang_minor__ == 8)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG28
|
||||
# elif(__clang_major__ == 2) && (__clang_minor__ == 9)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG29
|
||||
# elif(__clang_major__ == 3) && (__clang_minor__ == 0)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG30
|
||||
# elif(__clang_major__ == 3) && (__clang_minor__ == 1)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG31
|
||||
# elif(__clang_major__ == 3) && (__clang_minor__ == 2)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG32
|
||||
# elif(__clang_major__ == 3) && (__clang_minor__ == 3)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG33
|
||||
# elif(__clang_major__ == 4) && (__clang_minor__ == 0)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG40
|
||||
# elif(__clang_major__ == 4) && (__clang_minor__ == 1)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG41
|
||||
# elif(__clang_major__ == 4) && (__clang_minor__ == 2)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG42
|
||||
# elif(__clang_major__ == 4) && (__clang_minor__ == 3)
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG43
|
||||
# else
|
||||
# define GLM_COMPILER GLM_COMPILER_CLANG
|
||||
# endif
|
||||
|
||||
// G++
|
||||
#elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
|
||||
# if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
|
||||
# define GLM_COMPILER GLM_COMPILER_GCC32
|
||||
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
|
||||
# define GLM_COMPILER GLM_COMPILER_GCC33
|
||||
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
|
||||
# define GLM_COMPILER GLM_COMPILER_GCC34
|
||||
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
|
||||
# define GLM_COMPILER GLM_COMPILER_GCC35
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 0)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC40)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 1)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC41)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC42)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC43)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC44)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 5)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC45)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC46)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC47)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC48)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC49)
|
||||
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC50)
|
||||
# else
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC)
|
||||
# endif
|
||||
|
||||
// Borland C++
|
||||
#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
|
||||
# endif
|
||||
|
||||
// Codewarrior
|
||||
#elif defined(__MWERKS__)
|
||||
# define GLM_COMPILER GLM_COMPILER_CODEWARRIOR
|
||||
|
||||
#else
|
||||
# define GLM_COMPILER GLM_COMPILER_UNKNOWN
|
||||
#endif
|
||||
|
||||
#ifndef GLM_COMPILER
|
||||
#error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message."
|
||||
#endif//GLM_COMPILER
|
||||
|
||||
// Report compiler detection
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPILER_DISPLAYED))
|
||||
# define GLM_MESSAGE_COMPILER_DISPLAYED
|
||||
# if(GLM_COMPILER & GLM_COMPILER_CUDA)
|
||||
# pragma message("GLM: CUDA compiler detected")
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# pragma message("GLM: Visual C++ compiler detected")
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# pragma message("GLM: Clang compiler detected")
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
|
||||
# pragma message("GLM: LLVM GCC compiler detected")
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_INTEL)
|
||||
# pragma message("GLM: Intel Compiler detected")
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
|
||||
# pragma message("GLM: LLVM GCC compiler detected")
|
||||
# elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
|
||||
# pragma message("GLM: CLANG compiler detected")
|
||||
# else
|
||||
# pragma message("GLM: GCC compiler detected")
|
||||
# endif
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_BC)
|
||||
# pragma message("GLM: Borland compiler detected but not supported")
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_CODEWARRIOR)
|
||||
# pragma message("GLM: Codewarrior compiler detected but not supported")
|
||||
# else
|
||||
# pragma message("GLM: Compiler not detected")
|
||||
# endif
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
/////////////////
|
||||
// Build model //
|
||||
|
||||
#if(defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__))
|
||||
# define GLM_MODEL GLM_MODEL_64
|
||||
#elif(defined(__i386__) || defined(__ppc__))
|
||||
# define GLM_MODEL GLM_MODEL_32
|
||||
#else
|
||||
# define GLM_MODEL GLM_MODEL_32
|
||||
#endif//
|
||||
|
||||
#if(!defined(GLM_MODEL) && GLM_COMPILER != 0)
|
||||
# error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
|
||||
#endif//GLM_MODEL
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_MODEL_DISPLAYED))
|
||||
# define GLM_MESSAGE_MODEL_DISPLAYED
|
||||
# if(GLM_MODEL == GLM_MODEL_64)
|
||||
# pragma message("GLM: 64 bits model")
|
||||
# elif(GLM_MODEL == GLM_MODEL_32)
|
||||
# pragma message("GLM: 32 bits model")
|
||||
# endif//GLM_MODEL
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
/////////////////
|
||||
// C++ Version //
|
||||
|
||||
// User defines: GLM_FORCE_CXX98
|
||||
|
||||
#define GLM_LANG_CXX_FLAG (1 << 0)
|
||||
#define GLM_LANG_CXX98_FLAG (1 << 1)
|
||||
#define GLM_LANG_CXX03_FLAG (1 << 2)
|
||||
#define GLM_LANG_CXX0X_FLAG (1 << 3)
|
||||
#define GLM_LANG_CXX11_FLAG (1 << 4)
|
||||
#define GLM_LANG_CXXMS_FLAG (1 << 5)
|
||||
#define GLM_LANG_CXXGNU_FLAG (1 << 6)
|
||||
|
||||
#define GLM_LANG_CXX GLM_LANG_CXX_FLAG
|
||||
#define GLM_LANG_CXX98 (GLM_LANG_CXX | GLM_LANG_CXX98_FLAG)
|
||||
#define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
|
||||
#define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
|
||||
#define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
|
||||
#define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
|
||||
#define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
|
||||
|
||||
#if(defined(GLM_FORCE_CXX11))
|
||||
# define GLM_LANG GLM_LANG_CXX11
|
||||
#elif(defined(GLM_FORCE_CXX03))
|
||||
# define GLM_LANG GLM_LANG_CXX03
|
||||
#elif(defined(GLM_FORCE_CXX98))
|
||||
# define GLM_LANG GLM_LANG_CXX98
|
||||
#else
|
||||
# if(__cplusplus >= 201103L)
|
||||
# define GLM_LANG GLM_LANG_CXX11
|
||||
// -std=c++0x or -std=gnu++0x
|
||||
# elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__))
|
||||
# define GLM_LANG GLM_LANG_CXX0X
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# if(defined(_MSC_EXTENSIONS))
|
||||
# if(GLM_COMPILER >= GLM_COMPILER_VC2012)
|
||||
# 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)
|
||||
# else
|
||||
# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
|
||||
# endif
|
||||
# else
|
||||
# if(GLM_COMPILER >= GLM_COMPILER_VC2012)
|
||||
# define GLM_LANG GLM_LANG_CXX11
|
||||
# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
|
||||
# define GLM_LANG GLM_LANG_CXX0X
|
||||
# else
|
||||
# define GLM_LANG GLM_LANG_CXX98
|
||||
# endif
|
||||
# endif
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_INTEL)
|
||||
# if(defined(_MSC_EXTENSIONS))
|
||||
# if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
|
||||
# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
|
||||
# else
|
||||
# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
|
||||
# endif
|
||||
# else
|
||||
# if(GLM_COMPILER >= GLM_COMPILER_INTEL13_0)
|
||||
# define GLM_LANG (GLM_LANG_CXX0X)
|
||||
# else
|
||||
# define GLM_LANG (GLM_LANG_CXX98)
|
||||
# endif
|
||||
# endif
|
||||
# elif(__cplusplus >= 199711L)
|
||||
# define GLM_LANG GLM_LANG_CXX98
|
||||
# else
|
||||
# define GLM_LANG GLM_LANG_CXX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
|
||||
# define GLM_MESSAGE_LANG_DISPLAYED
|
||||
# if(GLM_LANG & GLM_LANG_CXXGNU_FLAG)
|
||||
# pragma message("GLM: C++ with language extensions")
|
||||
# elif(GLM_LANG & GLM_LANG_CXXMS_FLAG)
|
||||
# pragma message("GLM: C++ with language extensions")
|
||||
# elif(GLM_LANG & GLM_LANG_CXX11_FLAG)
|
||||
# pragma message("GLM: C++11")
|
||||
# elif(GLM_LANG & GLM_LANG_CXX0X_FLAG)
|
||||
# pragma message("GLM: C++0x")
|
||||
# elif(GLM_LANG & GLM_LANG_CXX03_FLAG)
|
||||
# pragma message("GLM: C++03")
|
||||
# elif(GLM_LANG & GLM_LANG_CXX98_FLAG)
|
||||
# pragma message("GLM: C++98")
|
||||
# else
|
||||
# pragma message("GLM: C++ language undetected")
|
||||
# endif//GLM_MODEL
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
/////////////////
|
||||
// Platform
|
||||
|
||||
@ -614,68 +234,11 @@
|
||||
# endif//GLM_ARCH
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Support check macros
|
||||
|
||||
#define GLM_SUPPORT_ANONYMOUS_UNION() \
|
||||
(GLM_LANG & GLM_LANG_CXX98_FLAG)
|
||||
|
||||
#define GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() \
|
||||
((GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC))
|
||||
|
||||
#define GLM_SUPPORT_SWIZZLE_OPERATOR() \
|
||||
(defined(GLM_SWIZZLE) && GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE())
|
||||
|
||||
#define GLM_SUPPORT_SWIZZLE_FUNCTION() defined(GLM_SWIZZLE)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Components
|
||||
|
||||
//#define GLM_FORCE_ONLY_XYZW
|
||||
#define GLM_COMPONENT_ONLY_XYZW 0 // To disable multiple vector component names access.
|
||||
#define GLM_COMPONENT_CXX98 1 //
|
||||
#define GLM_COMPONENT_CXXMS 2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
|
||||
|
||||
#if(GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() && !defined(GLM_FORCE_ONLY_XYZW))
|
||||
# define GLM_COMPONENT GLM_COMPONENT_CXXMS
|
||||
#elif(GLM_SUPPORT_ANONYMOUS_UNION() && !defined(GLM_FORCE_ONLY_XYZW))
|
||||
# define GLM_COMPONENT GLM_COMPONENT_CXX98
|
||||
#else
|
||||
# define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
|
||||
#endif
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
|
||||
# define GLM_MESSAGE_COMPONENT_DISPLAYED
|
||||
# if(GLM_COMPONENT == GLM_COMPONENT_CXX98)
|
||||
# pragma message("GLM: x,y,z,w; r,g,b,a; s,t,p,q component names except of half based vector types")
|
||||
# elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
|
||||
# pragma message("GLM: x,y,z,w component names for all vector types")
|
||||
# elif(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
|
||||
# pragma message("GLM: x,y,z,w; r,g,b,a; s,t,p,q component names for all vector types")
|
||||
# else
|
||||
# error "GLM: GLM_COMPONENT value unknown"
|
||||
# endif//GLM_MESSAGE_COMPONENT_DISPLAYED
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Radians
|
||||
|
||||
//#define GLM_FORCE_RADIANS
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Static assert
|
||||
|
||||
#if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X)
|
||||
# define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
|
||||
#elif(defined(BOOST_STATIC_ASSERT))
|
||||
# define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
|
||||
#elif(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
|
||||
#else
|
||||
# define GLM_STATIC_ASSERT(x, message)
|
||||
# define GLM_STATIC_ASSERT_NULL
|
||||
#endif//GLM_LANG
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Qualifiers
|
||||
|
||||
@ -712,22 +275,6 @@
|
||||
#define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
|
||||
#define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
// User defines: GLM_SWIZZLE
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
|
||||
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
|
||||
# if(GLM_SUPPORT_SWIZZLE_OPERATOR())
|
||||
# pragma message("GLM: Swizzling operators enabled")
|
||||
# elif(GLM_SUPPORT_SWIZZLE_FUNCTION())
|
||||
# pragma message("GLM: Swizzling operators supported through swizzling functions")
|
||||
# else
|
||||
# pragma message("GLM: Swizzling operators disabled")
|
||||
# endif
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Qualifiers
|
||||
|
||||
|
@ -31,11 +31,6 @@
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
#if(((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
|
||||
//#if((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
|
||||
#include <cstdint>
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ namespace detail
|
||||
// Data
|
||||
|
||||
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
|
||||
union
|
||||
union
|
||||
{
|
||||
# if(defined(GLM_SWIZZLE))
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
|
||||
@ -75,7 +75,7 @@ namespace detail
|
||||
union {value_type y, g, t;};
|
||||
|
||||
# if(defined(GLM_SWIZZLE))
|
||||
// Defines all he swizzle operator as functions
|
||||
// Defines all the swizzle operator as functions
|
||||
GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, P, detail::tvec2, detail::tref2)
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
|
||||
# endif//(defined(GLM_SWIZZLE))
|
||||
@ -83,7 +83,7 @@ namespace detail
|
||||
value_type x, y;
|
||||
|
||||
# if(defined(GLM_SWIZZLE))
|
||||
// Defines all he swizzle operator as functions
|
||||
// Defines all the swizzle operator as functions
|
||||
GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(value_type, P, detail::tvec2, detail::tref2, x, y)
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4, x, y)
|
||||
# endif//(defined(GLM_SWIZZLE))
|
||||
|
@ -76,7 +76,11 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "core/_fixes.hpp"
|
||||
|
||||
/*
|
||||
#if(!(__cplusplus >= 201103L))
|
||||
# error "GLM 2 requires a C++11 compiler"
|
||||
#endif
|
||||
*/
|
||||
#ifndef glm_glm
|
||||
#define glm_glm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user