Merge branch '0.9.1' of ssh://ogl-math.git.sourceforge.net/gitroot/ogl-math/ogl-math into 0.9.1
This commit is contained in:
commit
19f1decaac
@ -29,7 +29,7 @@ namespace glm
|
||||
};
|
||||
}//namespace glm
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW)
|
||||
#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define xx swizzle(glm::X, glm::X)
|
||||
#define yx swizzle(glm::Y, glm::X)
|
||||
@ -48,9 +48,9 @@ namespace glm
|
||||
#define zw swizzle(glm::Z, glm::W)
|
||||
#define ww swizzle(glm::W, glm::W)
|
||||
|
||||
#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA)
|
||||
#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define rr swizzle(glm::X, glm::X)
|
||||
#define gr swizzle(glm::Y, glm::X)
|
||||
@ -69,9 +69,9 @@ namespace glm
|
||||
#define ba swizzle(glm::Z, glm::W)
|
||||
#define aa swizzle(glm::W, glm::W)
|
||||
|
||||
#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ)
|
||||
#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define ss swizzle(glm::X, glm::X)
|
||||
#define ts swizzle(glm::Y, glm::X)
|
||||
@ -90,9 +90,9 @@ namespace glm
|
||||
#define pq swizzle(glm::Z, glm::W)
|
||||
#define qq swizzle(glm::W, glm::W)
|
||||
|
||||
#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW)
|
||||
#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define xxx swizzle(glm::X, glm::X, glm::X)
|
||||
#define yxx swizzle(glm::Y, glm::X, glm::X)
|
||||
@ -159,9 +159,9 @@ namespace glm
|
||||
#define zww swizzle(glm::Z, glm::W, glm::W)
|
||||
#define www swizzle(glm::W, glm::W, glm::W)
|
||||
|
||||
#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA)
|
||||
#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define rrr swizzle(glm::X, glm::X, glm::X)
|
||||
#define grr swizzle(glm::Y, glm::X, glm::X)
|
||||
@ -228,9 +228,9 @@ namespace glm
|
||||
#define baa swizzle(glm::Z, glm::W, glm::W)
|
||||
#define aaa swizzle(glm::W, glm::W, glm::W)
|
||||
|
||||
#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ)
|
||||
#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define sss swizzle(glm::X, glm::X, glm::X)
|
||||
#define tss swizzle(glm::Y, glm::X, glm::X)
|
||||
@ -297,9 +297,9 @@ namespace glm
|
||||
#define pqq swizzle(glm::Z, glm::W, glm::W)
|
||||
#define qqq swizzle(glm::W, glm::W, glm::W)
|
||||
|
||||
#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW)
|
||||
#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define xxxx swizzle(glm::X, glm::X, glm::X, glm::X)
|
||||
#define yxxx swizzle(glm::Y, glm::X, glm::X, glm::X)
|
||||
@ -558,9 +558,9 @@ namespace glm
|
||||
#define zwww swizzle(glm::Z, glm::W, glm::W, glm::W)
|
||||
#define wwww swizzle(glm::W, glm::W, glm::W, glm::W)
|
||||
|
||||
#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA)
|
||||
#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define rrrr swizzle(glm::X, glm::X, glm::X, glm::X)
|
||||
#define grrr swizzle(glm::Y, glm::X, glm::X, glm::X)
|
||||
@ -819,9 +819,9 @@ namespace glm
|
||||
#define baaa swizzle(glm::Z, glm::W, glm::W, glm::W)
|
||||
#define aaaa swizzle(glm::W, glm::W, glm::W, glm::W)
|
||||
|
||||
#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA)
|
||||
#endif
|
||||
|
||||
#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ)
|
||||
#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE))
|
||||
|
||||
#define ssss swizzle(glm::X, glm::X, glm::X, glm::X)
|
||||
#define tsss swizzle(glm::Y, glm::X, glm::X, glm::X)
|
||||
@ -1080,6 +1080,6 @@ namespace glm
|
||||
#define pqqq swizzle(glm::Z, glm::W, glm::W, glm::W)
|
||||
#define qqqq swizzle(glm::W, glm::W, glm::W, glm::W)
|
||||
|
||||
#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ)
|
||||
#endif
|
||||
|
||||
#endif//glm_core_swizzle
|
||||
|
@ -134,6 +134,13 @@ namespace glm
|
||||
{
|
||||
typedef detail::fmat4x4SIMD simd_mat4;
|
||||
|
||||
//! Multiply matrix x by matrix y component-wise, i.e.,
|
||||
//! result[i][j] is the scalar product of x[i][j] and y[i][j].
|
||||
//! (From GLM_GTX_simd_mat4 extension).
|
||||
detail::fmat4x4SIMD simd_matrixCompMult(
|
||||
detail::fmat4x4SIMD const & x,
|
||||
detail::fmat4x4SIMD const & y);
|
||||
|
||||
//! Returns the transposed matrix of x
|
||||
//! (From GLM_GTX_simd_mat4 extension).
|
||||
detail::fmat4x4SIMD simd_transpose(detail::fmat4x4SIMD const & m);
|
||||
|
@ -237,13 +237,18 @@ namespace detail
|
||||
namespace gtx{
|
||||
namespace simd_mat4
|
||||
{
|
||||
inline detail::fmat4x4SIMD matrixCompMult
|
||||
inline detail::fmat4x4SIMD simd_matrixCompMult
|
||||
(
|
||||
detail::fmat4x4SIMD const & x,
|
||||
detail::fmat4x4SIMD const & y
|
||||
)
|
||||
{
|
||||
//GLM_STATIC_ASSERT(0, "TODO");
|
||||
detail::fmat4x4SIMD result;
|
||||
result[0] = x[0] * y[0];
|
||||
result[1] = x[1] * y[1];
|
||||
result[2] = x[2] * y[2];
|
||||
result[3] = x[3] * y[3];
|
||||
return result;
|
||||
}
|
||||
|
||||
inline detail::fmat4x4SIMD simd_transpose(detail::fmat4x4SIMD const & m)
|
||||
@ -255,7 +260,9 @@ namespace simd_mat4
|
||||
|
||||
inline float simd_determinant(detail::fmat4x4SIMD const & m)
|
||||
{
|
||||
//GLM_STATIC_ASSERT(0, "TODO");
|
||||
float Result;
|
||||
_mm_store_ss(&Result, detail::sse_det_ps(&m[0].Data));
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline detail::fmat4x4SIMD simd_inverse(detail::fmat4x4SIMD const & m)
|
||||
|
@ -120,10 +120,37 @@ namespace glm
|
||||
{
|
||||
typedef detail::fvec4SIMD simd_vec4;
|
||||
|
||||
detail::fvec4SIMD cross(
|
||||
detail::fvec4SIMD simd_length(
|
||||
detail::fvec4SIMD const & v);
|
||||
|
||||
detail::fvec4SIMD simd_cross(
|
||||
detail::fvec4SIMD const & a,
|
||||
detail::fvec4SIMD const & b);
|
||||
|
||||
detail::fvec4SIMD simd_distance(
|
||||
detail::fvec4SIMD const & v);
|
||||
|
||||
detail::fvec4SIMD simd_dot(
|
||||
detail::fvec4SIMD const & a,
|
||||
detail::fvec4SIMD const & b);
|
||||
|
||||
detail::fvec4SIMD simd_normalize(
|
||||
detail::fvec4SIMD const & v);
|
||||
|
||||
detail::fvec4SIMD simd_faceforward(
|
||||
detail::fvec4SIMD const & N,
|
||||
detail::fvec4SIMD const & I,
|
||||
detail::fvec4SIMD const & Nref);
|
||||
|
||||
detail::fvec4SIMD simd_reflect(
|
||||
detail::fvec4SIMD const & I,
|
||||
detail::fvec4SIMD const & N);
|
||||
|
||||
detail::fvec4SIMD simd_refract(
|
||||
detail::fvec4SIMD const & I,
|
||||
detail::fvec4SIMD const & N,
|
||||
float const & eta);
|
||||
|
||||
}//namespace simd_vec4
|
||||
|
||||
namespace simd_vec4
|
||||
|
@ -267,7 +267,7 @@ namespace glm
|
||||
namespace simd_vec4
|
||||
{
|
||||
# if(GLM_INSTRUCTION_SET & GLM_INSTRUCTION_SET_SSE)
|
||||
inline detail::fvec4SIMD cross
|
||||
inline detail::fvec4SIMD simd_cross
|
||||
(
|
||||
detail::fvec4SIMD const & a,
|
||||
detail::fvec4SIMD const & b
|
||||
@ -276,7 +276,7 @@ namespace glm
|
||||
return detail::sse_xpd_ps(a.Data, b.Data);
|
||||
}
|
||||
# else//(GLM_INSTRUCTION_SET & GLM_INSTRUCTION_SET_PURE)
|
||||
inline detail::fvec4SIMD cross
|
||||
inline detail::fvec4SIMD simd_cross
|
||||
(
|
||||
detail::fvec4SIMD const & a,
|
||||
detail::fvec4SIMD const & b
|
||||
|
@ -2,7 +2,7 @@
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2006-11-13
|
||||
// Updated : 2010-01-28
|
||||
// Updated : 2011-01-26
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/setup.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -22,6 +22,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Compiler
|
||||
|
||||
// User defines: GLM_FORCE_COMPILER_UNKNOWNED
|
||||
|
||||
#define GLM_COMPILER_UNKNOWNED 0x00000000
|
||||
|
||||
// Visual C++ defines
|
||||
@ -213,8 +215,13 @@
|
||||
/////////////////
|
||||
// C++ Version //
|
||||
|
||||
// User defines: GLM_FORCE_CXX98
|
||||
|
||||
#define GLM_LANG_CXX 0
|
||||
#define GLM_LANG_CXX98 1
|
||||
#define GLM_LANG_CXX0X 2
|
||||
#define GLM_LANG_CXXMS 3
|
||||
#define GLM_LANG_CXXGNU 4
|
||||
|
||||
#if(defined(GLM_FORCE_CXX98))
|
||||
# define GLM_LANG GLM_LANG_CXX98
|
||||
@ -222,8 +229,12 @@
|
||||
# define GLM_LANG GLM_LANG_CXX0X
|
||||
#elif(GLM_COMPILER == GLM_COMPILER_VC2010) //_MSC_EXTENSIONS for MS language extensions
|
||||
# define GLM_LANG GLM_LANG_CXX0X
|
||||
#else
|
||||
#elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__STRICT_ANSI__))
|
||||
# define GLM_LANG GLM_LANG_CXX98
|
||||
#elif(((GLM_COMPILER & GLM_COMPILER_VC) == GLM_COMPILER_VC) && !defined(_MSC_EXTENSIONS))
|
||||
# define GLM_LANG GLM_LANG_CXX98
|
||||
#else
|
||||
# define GLM_LANG GLM_LANG_CXX
|
||||
#endif
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_LANG_DISPLAYED))
|
||||
@ -238,6 +249,8 @@
|
||||
/////////////////
|
||||
// Platform
|
||||
|
||||
// User defines: GLM_FORCE_PURE
|
||||
|
||||
#define GLM_ARCH_PURE 0x0000 //(0x0000)
|
||||
#define GLM_ARCH_SSE2 0x0001 //(0x0001)
|
||||
#define GLM_ARCH_SSE3 0x0003 //(0x0002 | GLM_ARCH_SSE2)
|
||||
@ -303,19 +316,19 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Components
|
||||
|
||||
//#define GLM_FORCE_ONLY_XYZW
|
||||
#define GLM_COMPONENT_GLSL_NAMES 0
|
||||
#define GLM_COMPONENT_ONLY_XYZW 1 // To disable multiple vector component names access.
|
||||
#define GLM_COMPONENT_MS_EXT 2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
|
||||
|
||||
//! By default:
|
||||
// #define GLM_COMPONENT GLM_COMPONENT_GLSL_NAMES
|
||||
|
||||
#ifndef GLM_COMPONENT
|
||||
#ifndef GLM_FORCE_ONLY_XYZW
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && defined(_MSC_EXTENSIONS))
|
||||
# define GLM_COMPONENT GLM_COMPONENT_MS_EXT
|
||||
# else
|
||||
# define GLM_COMPONENT GLM_COMPONENT_GLSL_NAMES
|
||||
# endif
|
||||
#else
|
||||
# define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
|
||||
#endif
|
||||
|
||||
#if((GLM_COMPONENT == GLM_COMPONENT_MS_EXT) && !(GLM_COMPILER & GLM_COMPILER_VC))
|
||||
@ -348,31 +361,37 @@
|
||||
# define GLM_STATIC_ASSERT(x, message)
|
||||
#endif//GLM_LANG
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// inline
|
||||
|
||||
// User defines: GLM_FORCE_INLINE
|
||||
|
||||
#if(defined(GLM_FORCE_INLINE))
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
|
||||
# define GLM_INLINE __forceinline
|
||||
# elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
|
||||
# define GLM_INLINE __attribute__((always_inline))
|
||||
# else
|
||||
# define GLM_INLINE inline
|
||||
# endif//GLM_COMPILER
|
||||
#else
|
||||
# define GLM_INLINE inline
|
||||
#endif//defined(GLM_FORCE_INLINE)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
#define GLM_SWIZZLE_NONE 0x00000000
|
||||
#define GLM_SWIZZLE_XYZW 0x00000002
|
||||
#define GLM_SWIZZLE_RGBA 0x00000004
|
||||
#define GLM_SWIZZLE_STQP 0x00000008
|
||||
#define GLM_SWIZZLE_FULL (GLM_SWIZZLE_XYZW | GLM_SWIZZLE_RGBA | GLM_SWIZZLE_STQP)
|
||||
|
||||
//! By default:
|
||||
// #define GLM_SWIZZLE GLM_SWIZZLE_NONE
|
||||
|
||||
//#ifndef GLM_SWIZZLE
|
||||
//# define GLM_SWIZZLE GLM_SWIZZLE_NONE
|
||||
//#endif//GLM_SWIZZLE
|
||||
// User defines: GLM_SWIZZLE_XYZW GLM_SWIZZLE_RGBA GLM_SWIZZLE_STQP GLM_SWIZZLE
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
|
||||
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
|
||||
# if !defined(GLM_SWIZZLE)|| (defined(GLM_SWIZZLE) && GLM_SWIZZLE == GLM_SWIZZLE_NONE)
|
||||
# pragma message("GLM: No swizzling operator enabled")
|
||||
# elif(defined(GLM_SWIZZLE) && GLM_SWIZZLE == GLM_SWIZZLE_FULL)
|
||||
# if(defined(GLM_SWIZZLE))
|
||||
# pragma message("GLM: Full swizzling operator enabled")
|
||||
# elif(defined(GLM_SWIZZLE) && GLM_SWIZZLE & GLM_SWIZZLE_FULL)
|
||||
# elif(!defined(GLM_SWIZZLE_XYZW) && !defined(GLM_SWIZZLE_RGBA) && !defined(GLM_SWIZZLE_STQP) && !defined(GLM_SWIZZLE))
|
||||
# pragma message("GLM: No swizzling operator enabled")
|
||||
# else
|
||||
# pragma message("GLM: Partial swizzling operator enabled")
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -392,6 +411,4 @@
|
||||
#define GLM_PRECISION_MEDIUMP_UINT 0x00120000
|
||||
#define GLM_PRECISION_HIGHP_UINT 0x00130000
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif//glm_setup
|
||||
|
@ -274,6 +274,8 @@ int main()
|
||||
Failed += test_compute_glm();
|
||||
Failed += test_compute_gtx();
|
||||
|
||||
float Det = glm::simd_determinant(glm::simd_mat4(1.0));
|
||||
glm::simd_mat4 B = glm::simd_matrixCompMult(glm::simd_mat4(1.0), glm::simd_mat4(1.0));
|
||||
|
||||
system("pause");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user