Merge branch '0.9.6' of https://github.com/g-truc/glm into 0.9.6

This commit is contained in:
Christophe Riccio
2014-08-31 18:12:53 -04:00
160 changed files with 1429 additions and 1332 deletions

View File

@@ -26,9 +26,6 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_COMMON_INCLUDED #pragma once
#define GLM_COMMON_INCLUDED
#include "detail/func_common.hpp" #include "detail/func_common.hpp"
#endif//GLM_COMMON_INCLUDED

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_features #pragma once
#define glm_core_features
// #define GLM_CXX98_EXCEPTIONS // #define GLM_CXX98_EXCEPTIONS
// #define GLM_CXX98_RTTI // #define GLM_CXX98_RTTI
@@ -423,5 +422,3 @@
# endif # endif
#endif//(GLM_COMPILER & GLM_COMPILER_CLANG) #endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
#endif//glm_core_features

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_literals #pragma once
#define glm_core_literals
namespace glm namespace glm
{ {
@@ -47,5 +46,3 @@ namespace glm
#endif//GLM_CXX11_USER_LITERALS #endif//GLM_CXX11_USER_LITERALS
}//namespace glm }//namespace glm
#endif//glm_core_literals

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_DETAIL_NOISE_INCLUDED #pragma once
#define GLM_DETAIL_NOISE_INCLUDED
namespace glm{ namespace glm{
namespace detail namespace detail
@@ -126,5 +125,3 @@ namespace detail
}//namespace detail }//namespace detail
}//namespace glm }//namespace glm
#endif//GLM_DETAIL_NOISE_INCLUDED

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_swizzle #pragma once
#define glm_core_swizzle
namespace glm{ namespace glm{
namespace detail namespace detail
@@ -836,5 +835,3 @@ namespace glm
struct { _swizzle<4, T, P, V<T, P>, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ struct { _swizzle<4, T, P, V<T, P>, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ struct { _swizzle<4, T, P, V<T, P>, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; struct { _swizzle<4, T, P, V<T, P>, 3,3,3,3> E3 ## E3 ## E3 ## E3; };
#endif//glm_core_swizzle

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_swizzle_func #pragma once
#define glm_core_swizzle_func
#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ #define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \
SWIZZLED_TYPE<TMPL_TYPE, PRECISION> A ## B() CONST \ SWIZZLED_TYPE<TMPL_TYPE, PRECISION> A ## B() CONST \
@@ -720,5 +719,3 @@
GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q)
//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) //GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4)
#endif//glm_core_swizzle_func

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_DETAIL_INCLUDED #pragma once
#define GLM_CORE_DETAIL_INCLUDED
#include "type_vec1.hpp" #include "type_vec1.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -213,5 +212,3 @@ namespace detail
}; };
}//namespace detail }//namespace detail
}//namespace glm }//namespace glm
#endif//GLM_CORE_DETAIL_INCLUDED

View File

@@ -41,7 +41,8 @@ struct material
glm::vec4 diffuse; // Dcm glm::vec4 diffuse; // Dcm
glm::vec4 specular; // Scm glm::vec4 specular; // Scm
float shininess; // Srm float shininess; // Srm
}; };
struct light struct light
{ {
glm::vec4 ambient; // Acli glm::vec4 ambient; // Acli
@@ -58,7 +59,8 @@ struct light
float constantAttenuation; // K0 float constantAttenuation; // K0
float linearAttenuation; // K1 float linearAttenuation; // K1
float quadraticAttenuation;// K2 float quadraticAttenuation;// K2
float quadraticAttenuation;// K2 };
// Sample 1 // Sample 1
#include <glm/vec3.hpp>// glm::vec3 #include <glm/vec3.hpp>// glm::vec3

View File

@@ -33,8 +33,7 @@
/// These all operate component-wise. The description is per component. /// These all operate component-wise. The description is per component.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_FUNC_COMMON_INCLUDED #pragma once
#define GLM_FUNC_COMMON_INCLUDED
#include "setup.hpp" #include "setup.hpp"
#include "precision.hpp" #include "precision.hpp"
@@ -469,4 +468,3 @@ namespace glm
#include "func_common.inl" #include "func_common.inl"
#endif//GLM_FUNC_COMMON_INCLUDED

View File

@@ -716,7 +716,7 @@ namespace detail
# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) # if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
return _isnan(x) != 0; return _isnan(x) != 0;
# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
return _isnan(x) != 0; return _isnan(x) != 0;
# else # else
return std::isnan(x); return std::isnan(x);
@@ -787,7 +787,7 @@ namespace detail
# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) # if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) # elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
return _isinf(x) != 0; return _isinf(x) != 0;
# else # else
return std::isinf(x); return std::isinf(x);

View File

@@ -33,8 +33,7 @@
/// These all operate component-wise. The description is per component. /// These all operate component-wise. The description is per component.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_exponential #pragma once
#define glm_core_func_exponential
#include "type_vec1.hpp" #include "type_vec1.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -128,5 +127,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "func_exponential.inl" #include "func_exponential.inl"
#endif//glm_core_func_exponential

View File

@@ -33,8 +33,7 @@
/// These operate on vectors as vectors, not component-wise. /// These operate on vectors as vectors, not component-wise.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_geometric #pragma once
#define glm_core_func_geometric
#include "type_vec3.hpp" #include "type_vec3.hpp"
@@ -147,5 +146,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "func_geometric.inl" #include "func_geometric.inl"
#endif//glm_core_func_geometric

View File

@@ -92,8 +92,7 @@ namespace detail
{ {
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
genType sqr = x * x; return abs(x);
return sqrt(sqr);
} }
template <typename T, precision P> template <typename T, precision P>

View File

@@ -35,8 +35,7 @@
/// b, inclusive. The lowest-order bit is bit 0. /// b, inclusive. The lowest-order bit is bit 0.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_integer #pragma once
#define glm_core_func_integer
#include "setup.hpp" #include "setup.hpp"
@@ -198,6 +197,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "func_integer.inl" #include "func_integer.inl"
#endif//glm_core_func_integer

View File

@@ -37,8 +37,7 @@
/// floating point version is shown. /// floating point version is shown.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_matrix #pragma once
#define GLM_CORE_func_matrix
// Dependencies // Dependencies
#include "../detail/precision.hpp" #include "../detail/precision.hpp"
@@ -175,5 +174,3 @@ namespace detail
}//namespace glm }//namespace glm
#include "func_matrix.inl" #include "func_matrix.inl"
#endif//GLM_CORE_func_matrix

View File

@@ -35,8 +35,7 @@
/// appearance of randomness, but are not truly random. /// appearance of randomness, but are not truly random.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_noise #pragma once
#define glm_core_func_noise
#include "type_vec1.hpp" #include "type_vec1.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -88,5 +87,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "func_noise.inl" #include "func_noise.inl"
#endif//glm_core_func_noise

View File

@@ -33,8 +33,7 @@
/// These functions do not operate component-wise, rather as described in each case. /// These functions do not operate component-wise, rather as described in each case.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_packing #pragma once
#define GLM_CORE_func_packing
#include "type_vec2.hpp" #include "type_vec2.hpp"
#include "type_vec4.hpp" #include "type_vec4.hpp"
@@ -191,5 +190,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "func_packing.inl" #include "func_packing.inl"
#endif//GLM_CORE_func_packing

View File

@@ -35,7 +35,9 @@ namespace glm
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v) GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
{ {
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f)); u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
return reinterpret_cast<uint&>(Topack); // return reinterpret_cast<uint&>(Topack);
uint* ptr(reinterpret_cast<uint*>(&Topack));
return *ptr;
} }
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p) GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
@@ -47,7 +49,9 @@ namespace glm
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v) GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
{ {
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
return reinterpret_cast<uint32&>(Topack); // return reinterpret_cast<uint32&>(Topack);
uint* ptr(reinterpret_cast<uint*>(&Topack));
return *ptr;
} }
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p) GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)

View File

@@ -37,8 +37,7 @@
/// These all operate component-wise. The description is per component. /// These all operate component-wise. The description is per component.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_trigonometric #pragma once
#define GLM_CORE_func_trigonometric
namespace glm namespace glm
{ {
@@ -197,7 +196,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "func_trigonometric.inl" #include "func_trigonometric.inl"
#endif//GLM_CORE_func_trigonometric

View File

@@ -38,8 +38,7 @@
/// call must match. /// call must match.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_vector_relational #pragma once
#define GLM_CORE_func_vector_relational
#include "precision.hpp" #include "precision.hpp"
#include "setup.hpp" #include "setup.hpp"
@@ -141,5 +140,3 @@ namespace glm
#endif #endif
#include "func_vector_relational.inl" #include "func_vector_relational.inl"
#endif//GLM_CORE_func_vector_relational

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type #pragma once
#define glm_core_type
namespace glm namespace glm
{ {
@@ -36,5 +35,3 @@ namespace glm
class nicest {}; class nicest {};
class fastest {}; class fastest {};
}//namespace glm }//namespace glm
#endif//glm_core_type

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_detail_intrinsic_common #pragma once
#define glm_detail_intrinsic_common
#include "setup.hpp" #include "setup.hpp"
@@ -86,4 +85,3 @@ namespace detail
#include "intrinsic_common.inl" #include "intrinsic_common.inl"
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_detail_intrinsic_common

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_detail_intrinsic_exponential #pragma once
#define glm_detail_intrinsic_exponential
#include "setup.hpp" #include "setup.hpp"
@@ -76,4 +75,3 @@ GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float *
}//namespace glm }//namespace glm
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_detail_intrinsic_exponential

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_intrinsic_geometric #pragma once
#define glm_core_intrinsic_geometric
#include "setup.hpp" #include "setup.hpp"
@@ -73,4 +72,3 @@ namespace detail
#include "intrinsic_geometric.inl" #include "intrinsic_geometric.inl"
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_core_intrinsic_geometric

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_detail_intrinsic_integer #pragma once
#define glm_detail_intrinsic_integer
#include "glm/glm.hpp" #include "glm/glm.hpp"
@@ -47,4 +46,3 @@ namespace detail
#include "intrinsic_integer.inl" #include "intrinsic_integer.inl"
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_detail_intrinsic_integer

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_detail_intrinsic_matrix #pragma once
#define glm_detail_intrinsic_matrix
#include "setup.hpp" #include "setup.hpp"
@@ -66,4 +65,3 @@ namespace detail
#include "intrinsic_matrix.inl" #include "intrinsic_matrix.inl"
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_detail_intrinsic_matrix

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_detail_intrinsic_trigonometric #pragma once
#define glm_detail_intrinsic_trigonometric
#include "setup.hpp" #include "setup.hpp"
@@ -45,4 +44,3 @@ namespace detail
#include "intrinsic_trigonometric.inl" #include "intrinsic_trigonometric.inl"
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_detail_intrinsic_trigonometric

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_detail_intrinsic_vector_relational #pragma once
#define glm_detail_intrinsic_vector_relational
#include "setup.hpp" #include "setup.hpp"
@@ -45,4 +44,3 @@ namespace detail
#include "intrinsic_vector_relational.inl" #include "intrinsic_vector_relational.inl"
#endif//GLM_ARCH #endif//GLM_ARCH
#endif//glm_detail_intrinsic_vector_relational

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_PRECISION_INCLUDED #pragma once
#define GLM_CORE_PRECISION_INCLUDED
namespace glm namespace glm
{ {
@@ -39,5 +38,3 @@ namespace glm
defaultp = highp defaultp = highp
}; };
}//namespace glm }//namespace glm
#endif//GLM_CORE_PRECISION_INCLUDED

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_SETUP_INCLUDED #pragma once
#define GLM_SETUP_INCLUDED
#include <cassert> #include <cassert>
@@ -578,16 +577,19 @@
#define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_SSE2 0x0001 #define GLM_ARCH_SSE2 0x0001
#define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2 #define GLM_ARCH_SSE3 0x0002
#define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #define GLM_ARCH_SSE4 0x0004
#define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #define GLM_ARCH_AVX 0x0008
#define GLM_ARCH_AVX2 0x0010
#if(defined(GLM_FORCE_PURE)) #if(defined(GLM_FORCE_PURE))
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
#elif(defined(GLM_FORCE_AVX2)) #elif(defined(GLM_FORCE_AVX2))
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_AVX)) #elif(defined(GLM_FORCE_AVX))
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_SSE4))
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_SSE3)) #elif(defined(GLM_FORCE_SSE3))
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_SSE2)) #elif(defined(GLM_FORCE_SSE2))
@@ -606,14 +608,26 @@
# endif # endif
#elif(GLM_COMPILER & GLM_COMPILER_VC) #elif(GLM_COMPILER & GLM_COMPILER_VC)
# if _M_IX86_FP == 2 && defined(__AVX__) # if _M_IX86_FP == 2 && defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif _M_IX86_FP == 2 # elif _M_IX86_FP == 2
# define GLM_ARCH (GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2)
# else # else
# define GLM_ARCH (GLM_ARCH_PURE) # define GLM_ARCH (GLM_ARCH_PURE)
# endif # endif
#elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC)) #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC) || (GLM_COMPILER & GLM_COMPILER_CLANG))
# define GLM_ARCH GLM_ARCH_PURE # if defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE4_1__ )
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#else #else
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
#endif #endif
@@ -786,5 +800,3 @@ namespace glm
#else #else
# define GLM_CONSTEXPR # define GLM_CONSTEXPR
#endif #endif
#endif//GLM_SETUP_INCLUDED

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_float #pragma once
#define glm_core_type_float
#include "setup.hpp" #include "setup.hpp"
@@ -91,5 +90,3 @@ namespace detail
/// @} /// @}
}//namespace glm }//namespace glm
#endif//glm_core_type_float

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_gentype #pragma once
#define glm_core_type_gentype
namespace glm namespace glm
{ {
@@ -219,5 +218,3 @@ namespace detail
}//namespace glm }//namespace glm
//#include "type_gentype.inl" //#include "type_gentype.inl"
#endif//glm_core_type_gentype

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_half #pragma once
#define glm_core_type_half
#include "setup.hpp" #include "setup.hpp"
@@ -47,5 +46,3 @@ namespace detail
}//namespace glm }//namespace glm
#include "type_half.inl" #include "type_half.inl"
#endif//glm_core_type_half

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_int #pragma once
#define glm_core_type_int
#include "setup.hpp" #include "setup.hpp"
@@ -187,5 +186,3 @@ namespace detail
#endif//GLM_STATIC_ASSERT_NULL #endif//GLM_STATIC_ASSERT_NULL
}//namespace glm }//namespace glm
#endif//glm_core_type_int

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat #pragma once
#define glm_core_type_mat
#include "precision.hpp" #include "precision.hpp"
@@ -791,5 +790,3 @@ namespace detail
/// @} /// @}
}//namespace glm }//namespace glm
#endif//glm_core_type_mat

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat2x2 #pragma once
#define glm_core_type_mat2x2
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -259,5 +258,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat2x2.inl" #include "type_mat2x2.inl"
#endif #endif
#endif //glm_core_type_mat2x2

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat2x3 #pragma once
#define glm_core_type_mat2x3
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -223,5 +222,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat2x3.inl" #include "type_mat2x3.inl"
#endif #endif
#endif //glm_core_type_mat2x3

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat2x4 #pragma once
#define glm_core_type_mat2x4
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -225,5 +224,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat2x4.inl" #include "type_mat2x4.inl"
#endif #endif
#endif //glm_core_type_mat2x4

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat3x2 #pragma once
#define glm_core_type_mat3x2
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -229,5 +228,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat3x2.inl" #include "type_mat3x2.inl"
#endif #endif
#endif //glm_core_type_mat3x2

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat3x3 #pragma once
#define glm_core_type_mat3x3
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec3.hpp" #include "type_vec3.hpp"
@@ -263,5 +262,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat3x3.inl" #include "type_mat3x3.inl"
#endif #endif
#endif //glm_core_type_mat3x3

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat3x4 #pragma once
#define glm_core_type_mat3x4
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec3.hpp" #include "type_vec3.hpp"
@@ -229,5 +228,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat3x4.inl" #include "type_mat3x4.inl"
#endif #endif
#endif //glm_core_type_mat3x4

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat4x2 #pragma once
#define glm_core_type_mat4x2
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec2.hpp" #include "type_vec2.hpp"
@@ -236,5 +235,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat4x2.inl" #include "type_mat4x2.inl"
#endif #endif
#endif //glm_core_type_mat4x2

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat4x3 #pragma once
#define glm_core_type_mat4x3
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec3.hpp" #include "type_vec3.hpp"
@@ -236,5 +235,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat4x3.inl" #include "type_mat4x3.inl"
#endif //GLM_EXTERNAL_TEMPLATE #endif //GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_mat4x3

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat4x4 #pragma once
#define glm_core_type_mat4x4
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec4.hpp" #include "type_vec4.hpp"
@@ -59,6 +58,7 @@ namespace detail
private: private:
/// @cond DETAIL /// @cond DETAIL
col_type value[4]; col_type value[4];
/// @endcond
public: public:
// Constructors // Constructors
@@ -263,5 +263,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_mat4x4.inl" #include "type_mat4x4.inl"
#endif//GLM_EXTERNAL_TEMPLATE #endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_mat4x4

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_vec #pragma once
#define glm_core_type_vec
#include "precision.hpp" #include "precision.hpp"
#include "type_int.hpp" #include "type_int.hpp"
@@ -512,5 +511,3 @@ namespace detail
/// @} /// @}
}//namespace glm }//namespace glm
#endif//glm_core_type_vec

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_gentype1 #pragma once
#define glm_core_type_gentype1
#include "../fwd.hpp" #include "../fwd.hpp"
#include "type_vec.hpp" #include "type_vec.hpp"
@@ -273,5 +272,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec1.inl" #include "type_vec1.inl"
#endif//GLM_EXTERNAL_TEMPLATE #endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_gentype1

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_gentype2 #pragma once
#define glm_core_type_gentype2
//#include "../fwd.hpp" //#include "../fwd.hpp"
#include "type_vec.hpp" #include "type_vec.hpp"
@@ -311,5 +310,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec2.inl" #include "type_vec2.inl"
#endif//GLM_EXTERNAL_TEMPLATE #endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_gentype2

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_gentype3 #pragma once
#define glm_core_type_gentype3
//#include "../fwd.hpp" //#include "../fwd.hpp"
#include "type_vec.hpp" #include "type_vec.hpp"
@@ -329,5 +328,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec3.inl" #include "type_vec3.inl"
#endif//GLM_EXTERNAL_TEMPLATE #endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_gentype3

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_gentype4 #pragma once
#define glm_core_type_gentype4
//#include "../fwd.hpp" //#include "../fwd.hpp"
#include "setup.hpp" #include "setup.hpp"
@@ -245,13 +244,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator+=(T s); GLM_FUNC_DECL tvec4<T, P> & operator+=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator-=(T s); GLM_FUNC_DECL tvec4<T, P> & operator-=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator*=(T s); GLM_FUNC_DECL tvec4<T, P> & operator*=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> & operator/=(T s); GLM_FUNC_DECL tvec4<T, P> & operator/=(T v);
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<T, P> const & v); GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<T, P> const & v);
template <typename U, precision Q> template <typename U, precision Q>
@@ -418,5 +417,3 @@ namespace detail
#ifndef GLM_EXTERNAL_TEMPLATE #ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec4.inl" #include "type_vec4.inl"
#endif//GLM_EXTERNAL_TEMPLATE #endif//GLM_EXTERNAL_TEMPLATE
#endif//glm_core_type_gentype4

View File

@@ -295,12 +295,12 @@ namespace detail
#endif #endif
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (T s) GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator+= (T v)
{ {
this->x += s; this->x += v;
this->y += s; this->y += v;
this->z += s; this->z += v;
this->w += s; this->w += v;
return *this; return *this;
} }
@@ -331,12 +331,12 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (T s) GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator-= (T v)
{ {
this->x -= s; this->x -= v;
this->y -= s; this->y -= v;
this->z -= s; this->z -= v;
this->w -= s; this->w -= v;
return *this; return *this;
} }
@@ -351,12 +351,12 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (T s) GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*= (T v)
{ {
this->x *= s; this->x *= v;
this->y *= s; this->y *= v;
this->z *= s; this->z *= v;
this->w *= s; this->w *= v;
return *this; return *this;
} }
@@ -371,12 +371,12 @@ namespace detail
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (T s) GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/= (T v)
{ {
this->x /= s; this->x /= v;
this->y /= s; this->y /= v;
this->z /= s; this->z /= v;
this->w /= s; this->w /= v;
return *this; return *this;
} }
@@ -390,9 +390,6 @@ namespace detail
return *this; return *this;
} }
template <typename T, precision P> template <typename T, precision P>
template <typename U, precision Q> template <typename U, precision Q>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= (tvec4<U, Q> const & v) GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator= (tvec4<U, Q> const & v)

View File

@@ -26,9 +26,6 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_EXPONENTIAL_INCLUDED #pragma once
#define GLM_EXPONENTIAL_INCLUDED
#include "detail/func_exponential.hpp" #include "detail/func_exponential.hpp"
#endif//GLM_EXPONENTIAL_INCLUDED

View File

@@ -55,8 +55,7 @@
/// (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showprofile&User=22660). /// (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showprofile&User=22660).
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_EXT_INCLUDED #pragma once
#define GLM_EXT_INCLUDED
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED)) #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED))
# define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED # define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED
@@ -133,5 +132,3 @@
# include "./gtx/simd_vec4.hpp" # include "./gtx/simd_vec4.hpp"
# include "./gtx/simd_mat4.hpp" # include "./gtx/simd_mat4.hpp"
#endif #endif
#endif //GLM_EXT_INCLUDED

View File

@@ -26,8 +26,7 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_FWD_INCLUDED #pragma once
#define GLM_FWD_INCLUDED
#include "detail/type_int.hpp" #include "detail/type_int.hpp"
#include "detail/type_float.hpp" #include "detail/type_float.hpp"
@@ -2594,5 +2593,3 @@ namespace glm
typedef highp_f64quat f64quat; typedef highp_f64quat f64quat;
#endif #endif
}//namespace glm }//namespace glm
#endif//GLM_FWD_INCLUDED

View File

@@ -26,9 +26,6 @@
/// @author Christophe Riccio /// @author Christophe Riccio
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GEOMETRIC_INCLUDED #pragma once
#define GLM_GEOMETRIC_INCLUDED
#include "detail/func_geometric.hpp" #include "detail/func_geometric.hpp"
#endif//GLM_GEOMETRIC_INCLUDED

View File

@@ -77,8 +77,7 @@
#include "detail/_fixes.hpp" #include "detail/_fixes.hpp"
#ifndef GLM_INCLUDED #pragma once
#define GLM_INCLUDED
#include <cmath> #include <cmath>
#include <climits> #include <climits>
@@ -113,5 +112,3 @@
#include "matrix.hpp" #include "matrix.hpp"
#include "vector_relational.hpp" #include "vector_relational.hpp"
#include "integer.hpp" #include "integer.hpp"
#endif//GLM_INCLUDED

View File

@@ -36,8 +36,7 @@
/// <glm/gtc/constants.hpp> need to be included to use these features. /// <glm/gtc/constants.hpp> need to be included to use these features.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_constants #pragma once
#define GLM_GTC_constants
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -181,5 +180,3 @@ namespace glm
} //namespace glm } //namespace glm
#include "constants.inl" #include "constants.inl"
#endif//GLM_GTC_constants

View File

@@ -37,8 +37,7 @@
/// <glm/gtc/epsilon.hpp> need to be included to use these functionalities. /// <glm/gtc/epsilon.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_epsilon #pragma once
#define GLM_GTC_epsilon
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -97,5 +96,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "epsilon.inl" #include "epsilon.inl"
#endif//GLM_GTC_epsilon

View File

@@ -34,8 +34,7 @@
/// <glm/gtc/matrix_access.hpp> need to be included to use these functionalities. /// <glm/gtc/matrix_access.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_matrix_access #pragma once
#define GLM_GTC_matrix_access
// Dependency: // Dependency:
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -83,5 +82,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "matrix_access.inl" #include "matrix_access.inl"
#endif//GLM_GTC_matrix_access

View File

@@ -34,8 +34,7 @@
/// <glm/gtc/matrix_integer.hpp> need to be included to use these functionalities. /// <glm/gtc/matrix_integer.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_matrix_integer #pragma once
#define GLM_GTC_matrix_integer
// Dependency: // Dependency:
#include "../mat2x2.hpp" #include "../mat2x2.hpp"
@@ -510,5 +509,3 @@ namespace glm
/// @} /// @}
}//namespace glm }//namespace glm
#endif//GLM_GTC_matrix_integer

View File

@@ -34,8 +34,7 @@
/// <glm/gtc/matrix_inverse.hpp> need to be included to use these functionalities. /// <glm/gtc/matrix_inverse.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_matrix_inverse #pragma once
#define GLM_GTC_matrix_inverse
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -70,5 +69,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "matrix_inverse.inl" #include "matrix_inverse.inl"
#endif//GLM_GTC_matrix_inverse

View File

@@ -43,14 +43,14 @@
/// <glm/gtc/matrix_transform.hpp> need to be included to use these functionalities. /// <glm/gtc/matrix_transform.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_matrix_transform #pragma once
#define GLM_GTC_matrix_transform
// Dependencies // Dependencies
#include "../mat4x4.hpp" #include "../mat4x4.hpp"
#include "../vec2.hpp" #include "../vec2.hpp"
#include "../vec3.hpp" #include "../vec3.hpp"
#include "../vec4.hpp" #include "../vec4.hpp"
#include "../gtc/constants.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_matrix_transform extension included") # pragma message("GLM: GLM_GTC_matrix_transform extension included")
@@ -164,8 +164,8 @@ namespace glm
/// @param far /// @param far
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
/// @see gtc_matrix_transform /// @see gtc_matrix_transform
template <typename T, precision P> template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, P> frustum( GLM_FUNC_DECL detail::tmat4x4<T, defaultp> frustum(
T const & left, T const & left,
T const & right, T const & right,
T const & bottom, T const & bottom,
@@ -181,8 +181,8 @@ namespace glm
/// @param far /// @param far
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
/// @see gtc_matrix_transform /// @see gtc_matrix_transform
template <typename T, precision P> template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, P> perspective( GLM_FUNC_DECL detail::tmat4x4<T, defaultp> perspective(
T const & fovy, T const & fovy,
T const & aspect, T const & aspect,
T const & near, T const & near,
@@ -197,8 +197,8 @@ namespace glm
/// @param far /// @param far
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
/// @see gtc_matrix_transform /// @see gtc_matrix_transform
template <typename T, precision P> template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, P> perspectiveFov( GLM_FUNC_DECL detail::tmat4x4<T, defaultp> perspectiveFov(
T const & fov, T const & fov,
T const & width, T const & width,
T const & height, T const & height,
@@ -212,8 +212,8 @@ namespace glm
/// @param near /// @param near
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
/// @see gtc_matrix_transform /// @see gtc_matrix_transform
template <typename T, precision P> template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, P> infinitePerspective( GLM_FUNC_DECL detail::tmat4x4<T, defaultp> infinitePerspective(
T fovy, T aspect, T near); T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
@@ -223,10 +223,21 @@ namespace glm
/// @param near /// @param near
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
/// @see gtc_matrix_transform /// @see gtc_matrix_transform
template <typename T, precision P> template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, P> tweakedInfinitePerspective( GLM_FUNC_DECL detail::tmat4x4<T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near); T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
///
/// @param fovy Expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
/// @param aspect
/// @param near
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
/// @see gtc_matrix_transform
template <typename T>
GLM_FUNC_DECL detail::tmat4x4<T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near, T ep);
/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
/// ///
/// @param obj /// @param obj
@@ -290,5 +301,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "matrix_transform.inl" #include "matrix_transform.inl"
#endif//GLM_GTC_matrix_transform

View File

@@ -167,7 +167,7 @@ namespace glm
detail::tmat4x4<T, defaultp> Result(1); detail::tmat4x4<T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left); Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom); Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - T(2) / (zFar - zNear); Result[2][2] = - static_cast<T>(2) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left); Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom); Result[3][1] = - (top + bottom) / (top - bottom);
Result[3][2] = - (zFar + zNear) / (zFar - zNear); Result[3][2] = - (zFar + zNear) / (zFar - zNear);
@@ -186,93 +186,93 @@ namespace glm
detail::tmat4x4<T, defaultp> Result(1); detail::tmat4x4<T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left); Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom); Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - T(1); Result[2][2] = - static_cast<T>(1);
Result[3][0] = - (right + left) / (right - left); Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom); Result[3][1] = - (top + bottom) / (top - bottom);
return Result; return Result;
} }
template <typename valType> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType, defaultp> frustum GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> frustum
( (
valType const & left, T const & left,
valType const & right, T const & right,
valType const & bottom, T const & bottom,
valType const & top, T const & top,
valType const & nearVal, T const & nearVal,
valType const & farVal T const & farVal
) )
{ {
detail::tmat4x4<valType, defaultp> Result(0); detail::tmat4x4<T, defaultp> Result(0);
Result[0][0] = (valType(2) * nearVal) / (right - left); Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (valType(2) * nearVal) / (top - bottom); Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left); Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom); Result[2][1] = (top + bottom) / (top - bottom);
Result[2][2] = -(farVal + nearVal) / (farVal - nearVal); Result[2][2] = -(farVal + nearVal) / (farVal - nearVal);
Result[2][3] = valType(-1); Result[2][3] = static_cast<T>(-1);
Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal); Result[3][2] = -(static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
return Result; return Result;
} }
template <typename valType> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType, defaultp> perspective GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> perspective
( (
valType const & fovy, T const & fovy,
valType const & aspect, T const & aspect,
valType const & zNear, T const & zNear,
valType const & zFar T const & zFar
) )
{ {
assert(aspect != valType(0)); assert(aspect != static_cast<T>(0));
assert(zFar != zNear); assert(zFar != zNear);
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
valType const rad = fovy; T const rad = fovy;
#else #else
# pragma message("GLM: perspective function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") # pragma message("GLM: perspective function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.")
valType const rad = glm::radians(fovy); T const rad = glm::radians(fovy);
#endif #endif
valType tanHalfFovy = tan(rad / valType(2)); T tanHalfFovy = tan(rad / static_cast<T>(2));
detail::tmat4x4<valType, defaultp> Result(valType(0)); detail::tmat4x4<T, defaultp> Result(static_cast<T>(0));
Result[0][0] = valType(1) / (aspect * tanHalfFovy); Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = valType(1) / (tanHalfFovy); Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[2][3] = - valType(1); Result[2][3] = - static_cast<T>(1);
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear); Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result; return Result;
} }
template <typename valType> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType, defaultp> perspectiveFov GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> perspectiveFov
( (
valType const & fov, T const & fov,
valType const & width, T const & width,
valType const & height, T const & height,
valType const & zNear, T const & zNear,
valType const & zFar T const & zFar
) )
{ {
assert(width > valType(0)); assert(width > static_cast<T>(0));
assert(height > valType(0)); assert(height > static_cast<T>(0));
assert(fov > valType(0)); assert(fov > static_cast<T>(0));
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
valType rad = fov; T rad = fov;
#else #else
# pragma message("GLM: perspectiveFov function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") # pragma message("GLM: perspectiveFov function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.")
valType rad = glm::radians(fov); T rad = glm::radians(fov);
#endif #endif
valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad); T h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
valType w = h * height / width; ///todo max(width , Height) / min(width , Height)? T w = h * height / width; ///todo max(width , Height) / min(width , Height)?
detail::tmat4x4<valType, defaultp> Result(valType(0)); detail::tmat4x4<T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w; Result[0][0] = w;
Result[1][1] = h; Result[1][1] = h;
Result[2][2] = - (zFar + zNear) / (zFar - zNear); Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[2][3] = - valType(1); Result[2][3] = - static_cast<T>(1);
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear); Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result; return Result;
} }
@@ -304,12 +304,14 @@ namespace glm
return Result; return Result;
} }
// Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> tweakedInfinitePerspective GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> tweakedInfinitePerspective
( (
T fovy, T fovy,
T aspect, T aspect,
T zNear T zNear,
T ep
) )
{ {
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
@@ -324,14 +326,25 @@ namespace glm
T top = range; T top = range;
detail::tmat4x4<T, defaultp> Result(T(0)); detail::tmat4x4<T, defaultp> Result(T(0));
Result[0][0] = (T(2) * zNear) / (right - left); Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (T(2) * zNear) / (top - bottom); Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = static_cast<T>(0.0001) - T(1); Result[2][2] = ep - static_cast<T>(1);
Result[2][3] = static_cast<T>(-1); Result[2][3] = static_cast<T>(-1);
Result[3][2] = - (T(0.0001) - T(2)) * zNear; Result[3][2] = (ep - static_cast<T>(2)) * zNear;
return Result; return Result;
} }
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, defaultp> tweakedInfinitePerspective
(
T fovy,
T aspect,
T zNear
)
{
return tweakedInfinitePerspective(fovy, aspect, zNear, epsilon<T>());
}
template <typename T, typename U, precision P> template <typename T, typename U, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> project GLM_FUNC_QUALIFIER detail::tvec3<T, P> project
( (

View File

@@ -38,8 +38,7 @@
/// <glm/gtc/noise.hpp> need to be included to use these functionalities. /// <glm/gtc/noise.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_noise #pragma once
#define GLM_GTC_noise
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -77,5 +76,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "noise.inl" #include "noise.inl"
#endif//GLM_GTC_noise

View File

@@ -36,8 +36,7 @@
/// <glm/gtc/packing.hpp> need to be included to use these features. /// <glm/gtc/packing.hpp> need to be included to use these features.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_packing #pragma once
#define GLM_GTC_packing
// Dependency: // Dependency:
#include "type_precision.hpp" #include "type_precision.hpp"
@@ -62,7 +61,7 @@ namespace glm
/// @see uint32 packUnorm4x8(vec4 const & v) /// @see uint32 packUnorm4x8(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint8 packUnorm1x8(float const & v); GLM_FUNC_DECL uint8 packUnorm1x8(float v);
/// Convert a single 8-bit integer to a normalized floating-point value. /// Convert a single 8-bit integer to a normalized floating-point value.
/// ///
@@ -74,7 +73,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p) /// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackUnorm1x8(uint8 const & p); GLM_FUNC_DECL float unpackUnorm1x8(uint8 p);
/// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// First, converts each component of the normalized floating-point value v into 8-bit integer values.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@@ -106,7 +105,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p) /// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 const & p); GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p);
/// First, converts the normalized floating-point value v into 8-bit integer value. /// First, converts the normalized floating-point value v into 8-bit integer value.
/// Then, the results are packed into the returned 8-bit unsigned integer. /// Then, the results are packed into the returned 8-bit unsigned integer.
@@ -119,7 +118,7 @@ namespace glm
/// @see uint32 packSnorm4x8(vec4 const & v) /// @see uint32 packSnorm4x8(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint8 packSnorm1x8(float const & s); GLM_FUNC_DECL uint8 packSnorm1x8(float s);
/// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers. /// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.
/// Then, the value is converted to a normalized floating-point value to generate the returned scalar. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
@@ -132,7 +131,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p) /// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackSnorm1x8(uint8 const & p); GLM_FUNC_DECL float unpackSnorm1x8(uint8 p);
/// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// First, converts each component of the normalized floating-point value v into 8-bit integer values.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@@ -164,7 +163,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p) /// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 const & p); GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);
/// First, converts the normalized floating-point value v into a 16-bit integer value. /// First, converts the normalized floating-point value v into a 16-bit integer value.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@@ -177,7 +176,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v) /// @see uint64 packSnorm4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint16 packUnorm1x16(float const & v); GLM_FUNC_DECL uint16 packUnorm1x16(float v);
/// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers. /// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.
/// Then, the value is converted to a normalized floating-point value to generate the returned scalar. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
@@ -190,7 +189,7 @@ namespace glm
/// @see vec4 unpackUnorm4x16(uint64 p) /// @see vec4 unpackUnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackUnorm1x16(uint16 const & p); GLM_FUNC_DECL float unpackUnorm1x16(uint16 p);
/// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// First, converts each component of the normalized floating-point value v into 16-bit integer values.
/// Then, the results are packed into the returned 64-bit unsigned integer. /// Then, the results are packed into the returned 64-bit unsigned integer.
@@ -222,7 +221,7 @@ namespace glm
/// @see vec2 unpackUnorm2x16(uint32 p) /// @see vec2 unpackUnorm2x16(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 const & p); GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p);
/// First, converts the normalized floating-point value v into 16-bit integer value. /// First, converts the normalized floating-point value v into 16-bit integer value.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@@ -235,7 +234,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v) /// @see uint64 packSnorm4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint16 packSnorm1x16(float const & v); GLM_FUNC_DECL uint16 packSnorm1x16(float v);
/// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers. /// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned scalar. /// Then, each component is converted to a normalized floating-point value to generate the returned scalar.
@@ -248,7 +247,7 @@ namespace glm
/// @see vec4 unpackSnorm4x16(uint64 p) /// @see vec4 unpackSnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackSnorm1x16(uint16 const & p); GLM_FUNC_DECL float unpackSnorm1x16(uint16 p);
/// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// First, converts each component of the normalized floating-point value v into 16-bit integer values.
/// Then, the results are packed into the returned 64-bit unsigned integer. /// Then, the results are packed into the returned 64-bit unsigned integer.
@@ -291,7 +290,7 @@ namespace glm
/// @see uint64 packHalf4x16(vec4 const & v) /// @see uint64 packHalf4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint16 packHalf1x16(float const & v); GLM_FUNC_DECL uint16 packHalf1x16(float v);
/// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value, /// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,
/// interpreted as a 16-bit floating-point number according to the OpenGL Specification, /// interpreted as a 16-bit floating-point number according to the OpenGL Specification,
@@ -302,7 +301,7 @@ namespace glm
/// @see vec4 unpackHalf4x16(uint64 const & v) /// @see vec4 unpackHalf4x16(uint64 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackHalf1x16(uint16 const & v); GLM_FUNC_DECL float unpackHalf1x16(uint16 v);
/// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector
/// to the 16-bit floating-point representation found in the OpenGL Specification, /// to the 16-bit floating-point representation found in the OpenGL Specification,
@@ -328,7 +327,7 @@ namespace glm
/// @see vec2 unpackHalf2x16(uint32 const & v) /// @see vec2 unpackHalf2x16(uint32 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 const & p); GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);
/// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector /// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector
/// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification, /// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,
@@ -352,7 +351,7 @@ namespace glm
/// @see uint32 packU3x10_1x2(uvec4 const & v) /// @see uint32 packU3x10_1x2(uvec4 const & v)
/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p); /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
/// @see uvec4 unpackI3x10_1x2(uint32 const & p); /// @see uvec4 unpackI3x10_1x2(uint32 const & p);
GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 const & p); GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);
/// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector /// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector
/// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification, /// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,
@@ -376,7 +375,7 @@ namespace glm
/// @see uint32 packU3x10_1x2(uvec4 const & v) /// @see uint32 packU3x10_1x2(uvec4 const & v)
/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p); /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
/// @see uvec4 unpackI3x10_1x2(uint32 const & p); /// @see uvec4 unpackI3x10_1x2(uint32 const & p);
GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 const & p); GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);
/// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values. /// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.
/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values. /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values.
@@ -411,7 +410,7 @@ namespace glm
/// @see vec4 unpackUnorm3x10_1x2(uint32 const & p)) /// @see vec4 unpackUnorm3x10_1x2(uint32 const & p))
/// @see uvec4 unpackI3x10_1x2(uint32 const & p) /// @see uvec4 unpackI3x10_1x2(uint32 const & p)
/// @see uvec4 unpackU3x10_1x2(uint32 const & p) /// @see uvec4 unpackU3x10_1x2(uint32 const & p)
GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 const & p); GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);
/// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values. /// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.
/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values. /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values.
@@ -446,7 +445,7 @@ namespace glm
/// @see vec4 unpackInorm3x10_1x2(uint32 const & p)) /// @see vec4 unpackInorm3x10_1x2(uint32 const & p))
/// @see uvec4 unpackI3x10_1x2(uint32 const & p) /// @see uvec4 unpackI3x10_1x2(uint32 const & p)
/// @see uvec4 unpackU3x10_1x2(uint32 const & p) /// @see uvec4 unpackU3x10_1x2(uint32 const & p)
GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 const & p); GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);
/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values. /// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value. /// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
@@ -467,12 +466,9 @@ namespace glm
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see uint32 packF2x11_1x10(vec3 const & v) /// @see uint32 packF2x11_1x10(vec3 const & v)
GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 const & p); GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);
/// @} /// @}
}// namespace glm }// namespace glm
#include "packing.inl" #include "packing.inl"
#endif//GLM_GTC_packing

View File

@@ -31,11 +31,12 @@
#include "../vec3.hpp" #include "../vec3.hpp"
#include "../vec4.hpp" #include "../vec4.hpp"
#include "../detail/type_half.hpp" #include "../detail/type_half.hpp"
#include <cstring>
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 const & f) GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 f)
{ {
// 10 bits => EE EEEFFFFF // 10 bits => EE EEEFFFFF
// 11 bits => EEE EEFFFFFF // 11 bits => EEE EEFFFFFF
@@ -53,7 +54,7 @@ namespace detail
((f >> 13) & 0x03ff); // Mantissa ((f >> 13) & 0x03ff); // Mantissa
} }
GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 const & f) GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 f)
{ {
// 10 bits => EE EEEFFFFF // 10 bits => EE EEEFFFFF
// 11 bits => EEE EEFFFFFF // 11 bits => EEE EEFFFFFF
@@ -71,7 +72,7 @@ namespace detail
((f >> 17) & 0x003f); // Mantissa ((f >> 17) & 0x003f); // Mantissa
} }
GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 const & p) GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 p)
{ {
// 10 bits => EE EEEFFFFF // 10 bits => EE EEEFFFFF
// 11 bits => EEE EEFFFFFF // 11 bits => EEE EEFFFFFF
@@ -89,7 +90,7 @@ namespace detail
((p & 0x003f) << 17); // Mantissa ((p & 0x003f) << 17); // Mantissa
} }
GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 const & f) GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 f)
{ {
// 10 bits => EE EEEFFFFF // 10 bits => EE EEEFFFFF
// 11 bits => EEE EEFFFFFF // 11 bits => EEE EEFFFFFF
@@ -110,7 +111,7 @@ namespace detail
((f >> 18) & 0x001f); // Mantissa ((f >> 18) & 0x001f); // Mantissa
} }
GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 const & p) GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 p)
{ {
// 10 bits => EE EEEFFFFF // 10 bits => EE EEEFFFFF
// 11 bits => EEE EEFFFFFF // 11 bits => EEE EEFFFFFF
@@ -131,7 +132,7 @@ namespace detail
((p & 0x001f) << 18); // Mantissa ((p & 0x001f) << 18); // Mantissa
} }
GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint const & h) GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint h)
{ {
return ((h & 0x8000) << 16) | ((( h & 0x7c00) + 0x1C000) << 13) | ((h & 0x03FF) << 13); return ((h & 0x8000) << 16) | ((( h & 0x7c00) + 0x1C000) << 13) | ((h & 0x03FF) << 13);
} }
@@ -145,7 +146,14 @@ namespace detail
else if(glm::isinf(x)) else if(glm::isinf(x))
return 0x1f << 6; return 0x1f << 6;
return float2packed11(reinterpret_cast<uint&>(x)); # if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
uint Pack = 0;
memcpy(&Pack, &x, sizeof(Pack));
# else
uint Pack = reinterpret_cast<uint&>(x);
# endif
return float2packed11(Pack);
} }
GLM_FUNC_QUALIFIER float packed11bitToFloat(glm::uint x) GLM_FUNC_QUALIFIER float packed11bitToFloat(glm::uint x)
@@ -157,8 +165,15 @@ namespace detail
else if(x == (0x1f << 6)) else if(x == (0x1f << 6))
return ~0;//Inf return ~0;//Inf
uint result = packed11ToFloat(x); uint Result = packed11ToFloat(x);
return reinterpret_cast<float&>(result);
# if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
float Temp = 0;
memcpy(&Temp, &Result, sizeof(Temp));
return Temp;
# else
return reinterpret_cast<float&>(Result);
# endif
} }
GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x) GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x)
@@ -170,7 +185,14 @@ namespace detail
else if(glm::isinf(x)) else if(glm::isinf(x))
return 0x1f << 5; return 0x1f << 5;
return float2packed10(reinterpret_cast<uint&>(x)); # if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
uint Pack = 0;
memcpy(&Pack, &x, sizeof(Pack));
# else
uint Pack = reinterpret_cast<uint&>(x);
# endif
return float2packed10(Pack);
} }
GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x) GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x)
@@ -182,8 +204,15 @@ namespace detail
else if(x == (0x1f << 5)) else if(x == (0x1f << 5))
return ~0;//Inf return ~0;//Inf
uint result = packed10ToFloat(x); uint Result = packed10ToFloat(x);
return reinterpret_cast<float&>(result);
# if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
float Temp = 0;
memcpy(&Temp, &Result, sizeof(Temp));
return Temp;
# else
return reinterpret_cast<float&>(Result);
# endif
} }
// GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z) // GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z)
@@ -217,12 +246,12 @@ namespace detail
}//namespace detail }//namespace detail
GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float const & v) GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v)
{ {
return static_cast<uint8>(round(clamp(v, 0.0f, 1.0f) * 255.0f)); return static_cast<uint8>(round(clamp(v, 0.0f, 1.0f) * 255.0f));
} }
GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 const & p) GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 p)
{ {
float Unpack(static_cast<float>(p)); float Unpack(static_cast<float>(p));
return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255 return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255
@@ -235,20 +264,20 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p) GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 p)
{ {
u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p)); u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p));
return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255 return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255
} }
GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v) GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float v)
{ {
int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f))); int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f)));
uint8* Packed = reinterpret_cast<uint8*>(&Topack); uint8* Packed = reinterpret_cast<uint8*>(&Topack);
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p) GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 p)
{ {
float Unpack(static_cast<float>(*const_cast<uint8*>(&p))); float Unpack(static_cast<float>(*const_cast<uint8*>(&p)));
return clamp( return clamp(
@@ -263,7 +292,7 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p) GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 p)
{ {
i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p)); i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p));
return clamp( return clamp(
@@ -271,12 +300,12 @@ namespace detail
-1.0f, 1.0f); -1.0f, 1.0f);
} }
GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float const & s) GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float s)
{ {
return static_cast<uint16>(round(clamp(s, 0.0f, 1.0f) * 65535.0f)); return static_cast<uint16>(round(clamp(s, 0.0f, 1.0f) * 65535.0f));
} }
GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 const & p) GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 p)
{ {
float Unpack = static_cast<float>(*const_cast<uint16*>(&p)); float Unpack = static_cast<float>(*const_cast<uint16*>(&p));
return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
@@ -289,20 +318,20 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 const & p) GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 p)
{ {
u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p)); u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p));
return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
} }
GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v) GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float v)
{ {
int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
uint16* Packed = reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p) GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 p)
{ {
float Unpack = static_cast<float>(*const_cast<uint16*>(&p)); float Unpack = static_cast<float>(*const_cast<uint16*>(&p));
return clamp( return clamp(
@@ -317,7 +346,7 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p) GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 p)
{ {
i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p))); i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
return clamp( return clamp(
@@ -325,14 +354,14 @@ namespace detail
-1.0f, 1.0f); -1.0f, 1.0f);
} }
GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & v) GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v)
{ {
int16 Topack = detail::toFloat16(v); int16 Topack = detail::toFloat16(v);
uint16* Packed = reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v) GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v)
{ {
int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v)); int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v));
return detail::toFloat32(*Unpack); return detail::toFloat32(*Unpack);
@@ -350,7 +379,7 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 const & v) GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 v)
{ {
i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v)); i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v));
i16vec4 Unpack(*p); i16vec4 Unpack(*p);
@@ -372,7 +401,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 v)
{ {
detail::i10i10i10i2 Unpack; detail::i10i10i10i2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@@ -393,7 +422,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 v)
{ {
detail::u10u10u10u2 Unpack; detail::u10u10u10u2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@@ -414,7 +443,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 v)
{ {
detail::i10i10i10i2 Unpack; detail::i10i10i10i2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@@ -436,7 +465,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 v)
{ {
detail::i10i10i10i2 Unpack; detail::i10i10i10i2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@@ -456,7 +485,7 @@ namespace detail
((detail::floatTo10bit(v.z) & ((1 << 10) - 1)) << 22); ((detail::floatTo10bit(v.z) & ((1 << 10) - 1)) << 22);
} }
GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 const & v) GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 v)
{ {
return vec3( return vec3(
detail::packed11bitToFloat(v >> 0), detail::packed11bitToFloat(v >> 0),

View File

@@ -37,8 +37,7 @@
/// <glm/gtc/quaternion.hpp> need to be included to use these functionalities. /// <glm/gtc/quaternion.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_quaternion #pragma once
#define GLM_GTC_quaternion
// Dependency: // Dependency:
#include "../mat3x3.hpp" #include "../mat3x3.hpp"
@@ -59,6 +58,7 @@ namespace detail
{ {
enum ctor{null}; enum ctor{null};
typedef T value_type;
typedef tvec4<bool, P> bool_type; typedef tvec4<bool, P> bool_type;
public: public:
@@ -399,5 +399,3 @@ namespace detail
} //namespace glm } //namespace glm
#include "quaternion.inl" #include "quaternion.inl"
#endif//GLM_GTC_quaternion

View File

@@ -114,9 +114,9 @@ namespace detail
detail::tvec3<T, P> const & v detail::tvec3<T, P> const & v
) )
{ {
detail::tvec3<T, P> w = cross(u, v); detail::tvec3<T, P> const LocalW(cross(u, v));
T Dot = detail::compute_dot<detail::tvec3, T, P>::call(u, v); T Dot = detail::compute_dot<detail::tvec3, T, P>::call(u, v);
detail::tquat<T, P> q(T(1) + Dot, w.x, w.y, w.z); detail::tquat<T, P> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z);
*this = normalize(q); *this = normalize(q);
} }
@@ -255,7 +255,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_dot<tquat, T, P> struct compute_dot<tquat, T, P>
{ {
static T call(tquat<T, P> const & x, tquat<T, P> const & y) static GLM_FUNC_QUALIFIER T call(tquat<T, P> const & x, tquat<T, P> const & y)
{ {
tvec4<T, P> tmp(x.x * y.x, x.y * y.y, x.z * y.z, x.w * y.w); tvec4<T, P> tmp(x.x * y.x, x.y * y.y, x.z * y.z, x.w * y.w);
return (tmp.x + tmp.y) + (tmp.z + tmp.w); return (tmp.x + tmp.y) + (tmp.z + tmp.w);
@@ -302,16 +302,11 @@ namespace detail
detail::tvec3<T, P> const & v detail::tvec3<T, P> const & v
) )
{ {
T Two(2); detail::tvec3<T, P> const QuatVector(q.x, q.y, q.z);
detail::tvec3<T, P> const uv(glm::cross(QuatVector, v));
detail::tvec3<T, P> const uuv(glm::cross(QuatVector, uv));
detail::tvec3<T, P> uv, uuv; return v + ((uv * q.w) + uuv) * static_cast<T>(2);
detail::tvec3<T, P> QuatVector(q.x, q.y, q.z);
uv = glm::cross(QuatVector, v);
uuv = glm::cross(QuatVector, uv);
uv *= (Two * q.w);
uuv *= Two;
return v + uv + uuv;
} }
template <typename T, precision P> template <typename T, precision P>
@@ -587,10 +582,10 @@ namespace detail
{ {
// Linear interpolation // Linear interpolation
return detail::tquat<T, P>( return detail::tquat<T, P>(
mix(x.w, y.w, a), mix(x.w, z.w, a),
mix(x.x, y.x, a), mix(x.x, z.x, a),
mix(x.y, y.y, a), mix(x.y, z.y, a),
mix(x.z, y.z, a)); mix(x.z, z.z, a));
} }
else else
{ {

View File

@@ -37,8 +37,7 @@
/// <glm/gtc/random.hpp> need to be included to use these functionalities. /// <glm/gtc/random.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_random #pragma once
#define GLM_GTC_random
// Dependency: // Dependency:
#include "../vec2.hpp" #include "../vec2.hpp"
@@ -110,5 +109,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "random.inl" #include "random.inl"
#endif//GLM_GTC_random

View File

@@ -35,8 +35,7 @@
/// <glm/gtc/reciprocal.hpp> need to be included to use these features. /// <glm/gtc/reciprocal.hpp> need to be included to use these features.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_reciprocal #pragma once
#define GLM_GTC_reciprocal
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -129,5 +128,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "reciprocal.inl" #include "reciprocal.inl"
#endif//GLM_GTC_reciprocal

View File

@@ -40,8 +40,7 @@
/// <glm/gtc/type_precision.hpp> need to be included to use these functionalities. /// <glm/gtc/type_precision.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_type_precision #pragma once
#define GLM_GTC_type_precision
// Dependency: // Dependency:
#include "../gtc/quaternion.hpp" #include "../gtc/quaternion.hpp"
@@ -870,5 +869,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "type_precision.inl" #include "type_precision.inl"
#endif//GLM_GTC_type_precision

View File

@@ -56,8 +56,7 @@
/// <glm/gtc/type_ptr.hpp> need to be included to use these functionalities. /// <glm/gtc/type_ptr.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_type_ptr #pragma once
#define GLM_GTC_type_ptr
// Dependency: // Dependency:
#include "../gtc/quaternion.hpp" #include "../gtc/quaternion.hpp"
@@ -174,6 +173,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "type_ptr.inl" #include "type_ptr.inl"
#endif//GLM_GTC_type_ptr

View File

@@ -36,8 +36,7 @@
/// <glm/gtc/ulp.hpp> need to be included to use these features. /// <glm/gtc/ulp.hpp> need to be included to use these features.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_ulp #pragma once
#define GLM_GTC_ulp
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -87,6 +86,3 @@ namespace glm
}// namespace glm }// namespace glm
#include "ulp.inl" #include "ulp.inl"
#endif//GLM_GTC_ulp

View File

@@ -199,10 +199,12 @@ namespace glm
template <> template <>
GLM_FUNC_QUALIFIER float next_float(float const & x) GLM_FUNC_QUALIFIER float next_float(float const & x)
{ {
# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID))
return std::nextafter(x, std::numeric_limits<float>::max()); return std::nextafter(x, std::numeric_limits<float>::max());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafterf(x, FLT_MAX); return detail::nextafterf(x, FLT_MAX);
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _nextafterf(x, FLT_MAX);
# else # else
return nextafterf(x, FLT_MAX); return nextafterf(x, FLT_MAX);
# endif # endif
@@ -211,7 +213,7 @@ namespace glm
template <> template <>
GLM_FUNC_QUALIFIER double next_float(double const & x) GLM_FUNC_QUALIFIER double next_float(double const & x)
{ {
# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID))
return std::nextafter(x, std::numeric_limits<double>::max()); return std::nextafter(x, std::numeric_limits<double>::max());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafter(x, std::numeric_limits<double>::max()); return detail::nextafter(x, std::numeric_limits<double>::max());
@@ -231,10 +233,12 @@ namespace glm
GLM_FUNC_QUALIFIER float prev_float(float const & x) GLM_FUNC_QUALIFIER float prev_float(float const & x)
{ {
# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID))
return std::nextafter(x, std::numeric_limits<float>::min()); return std::nextafter(x, std::numeric_limits<float>::min());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return detail::nextafterf(x, FLT_MIN); return detail::nextafterf(x, FLT_MIN);
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _nextafterf(x, FLT_MIN);
# else # else
return nextafterf(x, FLT_MIN); return nextafterf(x, FLT_MIN);
# endif # endif
@@ -242,9 +246,9 @@ namespace glm
GLM_FUNC_QUALIFIER double prev_float(double const & x) GLM_FUNC_QUALIFIER double prev_float(double const & x)
{ {
# if((GLM_LANG & GLM_LANG_CXX11_FLAG)) # if((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_PLATFORM & GLM_PLATFORM_ANDROID))
return std::nextafter(x, std::numeric_limits<double>::min()); return std::nextafter(x, std::numeric_limits<double>::min());
# elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) # elif((GLM_PLATFORM & GLM_PLATFORM_ANDROID) || (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)))
return _nextafter(x, DBL_MIN); return _nextafter(x, DBL_MIN);
# else # else
return nextafter(x, DBL_MIN); return nextafter(x, DBL_MIN);

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/associated_min_max.hpp> need to be included to use these functionalities. /// <glm/gtx/associated_min_max.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_associated_min_max #pragma once
#define GLM_GTX_associated_min_max
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -102,5 +101,3 @@ namespace glm
} //namespace glm } //namespace glm
#include "associated_min_max.inl" #include "associated_min_max.inl"
#endif//GLM_GTX_associated_min_max

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/bit.hpp> need to be included to use these functionalities. /// <glm/gtx/bit.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_bit #pragma once
#define GLM_GTX_bit
// Dependencies // Dependencies
#include "../detail/type_int.hpp" #include "../detail/type_int.hpp"
@@ -230,5 +229,3 @@ namespace glm
} //namespace glm } //namespace glm
#include "bit.inl" #include "bit.inl"
#endif//GLM_GTX_bit

View File

@@ -287,7 +287,7 @@ namespace glm
assert(ToBit <= sizeof(genIUType) * std::size_t(8)); assert(ToBit <= sizeof(genIUType) * std::size_t(8));
genIUType Result = Value; genIUType Result = Value;
for(std::size_t i = 0; i <= ToBit; ++i) for(signed i = 0; i <= ToBit; ++i)
Result |= (1 << i); Result |= (1 << i);
return Result; return Result;
} }
@@ -304,7 +304,7 @@ namespace glm
assert(ToBit <= sizeof(genIUType) * std::size_t(8)); assert(ToBit <= sizeof(genIUType) * std::size_t(8));
genIUType Result = Value; genIUType Result = Value;
for(std::size_t i = 0; i <= ToBit; ++i) for(signed i = 0; i <= ToBit; ++i)
Result &= ~(1 << i); Result &= ~(1 << i);
return Result; return Result;
} }

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/closest_point.hpp> need to be included to use these functionalities. /// <glm/gtx/closest_point.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_closest_point #pragma once
#define GLM_GTX_closest_point
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -62,5 +61,3 @@ namespace glm
}// namespace glm }// namespace glm
#include "closest_point.inl" #include "closest_point.inl"
#endif//GLM_GTX_closest_point

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/color_space.hpp> need to be included to use these functionalities. /// <glm/gtx/color_space.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_color_space #pragma once
#define GLM_GTX_color_space
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -92,5 +91,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "color_space.inl" #include "color_space.inl"
#endif//GLM_GTX_color_space

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/color_space_YCoCg.hpp> need to be included to use these functionalities. /// <glm/gtx/color_space_YCoCg.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_gtx_color_space_YCoCg #pragma once
#define glm_gtx_color_space_YCoCg
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -80,5 +79,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "color_space_YCoCg.inl" #include "color_space_YCoCg.inl"
#endif//glm_gtx_color_space_YCoCg

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/compatibility.hpp> need to be included to use these functionalities. /// <glm/gtx/compatibility.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_compatibility #pragma once
#define GLM_GTX_compatibility
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -155,6 +154,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "compatibility.inl" #include "compatibility.inl"
#endif//GLM_GTX_compatibility

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/component_wise.hpp> need to be included to use these functionalities. /// <glm/gtx/component_wise.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_component_wise #pragma once
#define GLM_GTX_component_wise
// Dependencies // Dependencies
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
@@ -78,5 +77,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "component_wise.inl" #include "component_wise.inl"
#endif//GLM_GTX_component_wise

View File

@@ -38,8 +38,7 @@
/// <glm/gtx/dual_quaternion.hpp> need to be included to use these functionalities. /// <glm/gtx/dual_quaternion.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_dual_quaternion #pragma once
#define GLM_GTX_dual_quaternion
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -57,13 +56,13 @@ namespace detail
struct tdualquat struct tdualquat
{ {
enum ctor{null}; enum ctor{null};
typedef T value_type;
typedef glm::detail::tquat<T, P> part_type; typedef glm::detail::tquat<T, P> part_type;
public: public:
glm::detail::tquat<T, P> real, dual; glm::detail::tquat<T, P> real, dual;
GLM_FUNC_DECL GLM_CONSTEXPR int length() const; GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
// Constructors // Constructors
GLM_FUNC_DECL tdualquat(); GLM_FUNC_DECL tdualquat();
@@ -291,5 +290,3 @@ namespace detail
} //namespace glm } //namespace glm
#include "dual_quaternion.inl" #include "dual_quaternion.inl"
#endif//GLM_GTX_dual_quaternion

View File

@@ -33,7 +33,7 @@ namespace glm{
namespace detail namespace detail
{ {
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tdualquat<T, P>::length() const GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tdualquat<T, P>::length() const
{ {
return 8; return 8;
} }

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/euler_angles.hpp> need to be included to use these functionalities. /// <glm/gtx/euler_angles.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_euler_angles #pragma once
#define GLM_GTX_euler_angles
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -151,5 +150,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "euler_angles.inl" #include "euler_angles.inl"
#endif//GLM_GTX_euler_angles

View File

@@ -250,7 +250,7 @@ namespace glm
detail::tvec3<T, P> const & angles detail::tvec3<T, P> const & angles
) )
{ {
return detail::tmat3x3<T, P>(yawPitchRoll(angles.x, angles.y, angles.z)); return detail::tmat3x3<T, P>(yawPitchRoll(angles.z, angles.x, angles.y));
} }
template <typename T, precision P> template <typename T, precision P>

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/extend.hpp> need to be included to use these functionalities. /// <glm/gtx/extend.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_extend #pragma once
#define GLM_GTX_extend
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -62,5 +61,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "extend.inl" #include "extend.inl"
#endif//GLM_GTX_extend

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/extented_min_max.hpp> need to be included to use these functionalities. /// <glm/gtx/extented_min_max.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_extented_min_max #pragma once
#define GLM_GTX_extented_min_max
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -157,5 +156,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "extented_min_max.inl" #include "extented_min_max.inl"
#endif//GLM_GTX_extented_min_max

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/fast_exponential.hpp> need to be included to use these functionalities. /// <glm/gtx/fast_exponential.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_fast_exponential #pragma once
#define GLM_GTX_fast_exponential
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -94,5 +93,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "fast_exponential.inl" #include "fast_exponential.inl"
#endif//GLM_GTX_fast_exponential

View File

@@ -37,8 +37,7 @@
/// <glm/gtx/fast_square_root.hpp> need to be included to use these functionalities. /// <glm/gtx/fast_square_root.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_fast_square_root #pragma once
#define GLM_GTX_fast_square_root
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -86,5 +85,3 @@ namespace glm
}// namespace glm }// namespace glm
#include "fast_square_root.inl" #include "fast_square_root.inl"
#endif//GLM_GTX_fast_square_root

View File

@@ -101,13 +101,43 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType fastDistance GLM_FUNC_QUALIFIER genType fastDistance
( (
genType const & x, genType const & x,
genType const & y genType const & y
) )
{ {
return fastLength(y - x); return fastLength(y - x);
} }
template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastDistance
(
detail::tvec2<valType, P> const & x,
detail::tvec2<valType, P> const & y
)
{
return fastLength(y - x);
}
template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastDistance
(
detail::tvec3<valType, P> const & x,
detail::tvec3<valType, P> const & y
)
{
return fastLength(y - x);
}
template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastDistance
(
detail::tvec4<valType, P> const & x,
detail::tvec4<valType, P> const & y
)
{
return fastLength(y - x);
}
// fastNormalize // fastNormalize
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType fastNormalize GLM_FUNC_QUALIFIER genType fastNormalize

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/fast_trigonometry.hpp> need to be included to use these functionalities. /// <glm/gtx/fast_trigonometry.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_fast_trigonometry #pragma once
#define GLM_GTX_fast_trigonometry
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -96,5 +95,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "fast_trigonometry.inl" #include "fast_trigonometry.inl"
#endif//GLM_GTX_fast_trigonometry

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/gradient_paint.hpp> need to be included to use these functionalities. /// <glm/gtx/gradient_paint.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_gradient_paint #pragma once
#define GLM_GTX_gradient_paint
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -72,5 +71,3 @@ namespace glm
}// namespace glm }// namespace glm
#include "gradient_paint.inl" #include "gradient_paint.inl"
#endif//GLM_GTX_gradient_paint

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/handed_coordinate_system.hpp> need to be included to use these functionalities. /// <glm/gtx/handed_coordinate_system.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_handed_coordinate_space #pragma once
#define GLM_GTX_handed_coordinate_space
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -70,5 +69,3 @@ namespace glm
}// namespace glm }// namespace glm
#include "handed_coordinate_space.inl" #include "handed_coordinate_space.inl"
#endif//GLM_GTX_handed_coordinate_space

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/inertia.hpp> need to be included to use these functionalities. /// <glm/gtx/inertia.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_inertia #pragma once
#define GLM_GTX_inertia
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -112,5 +111,3 @@ namespace glm
}// namespace glm }// namespace glm
#include "inertia.inl" #include "inertia.inl"
#endif//GLM_GTX_inertia

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/integer.hpp> need to be included to use these functionalities. /// <glm/gtx/integer.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_integer #pragma once
#define GLM_GTX_integer
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -100,5 +99,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "integer.inl" #include "integer.inl"
#endif//GLM_GTX_integer

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/intersect.hpp> need to be included to use these functionalities. /// <glm/gtx/intersect.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_intersect #pragma once
#define GLM_GTX_intersect
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -107,5 +106,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "intersect.inl" #include "intersect.inl"
#endif//GLM_GTX_intersect

View File

@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net) /// OpenGL Mathematics (glm.g-truc.net)
/// ///
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy /// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal /// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights /// in the Software without restriction, including without limitation the rights
@@ -26,125 +26,198 @@
/// @author Jan P Springer (regnirpsj@gmail.com) /// @author Jan P Springer (regnirpsj@gmail.com)
/// ///
/// @see core (dependence) /// @see core (dependence)
/// @see gtx_quaternion (dependence) /// @see gtc_quaternion (dependence)
/// ///
/// @defgroup gtx_io GLM_GTX_io /// @defgroup gtx_io GLM_GTX_io
/// @ingroup gtx /// @ingroup gtx
/// ///
/// @brief std::[w]ostream support for glm types /// @brief std::[w]ostream support for glm types
/// ///
/// std::[w]ostream support for glm types + precision/width/etc. manipulators
/// based on howard hinnant's std::chrono io proposal
/// [http://home.roadrunner.com/~hinnant/bloomington/chrono_io.html]
///
/// <glm/gtx/io.hpp> needs to be included to use these functionalities. /// <glm/gtx/io.hpp> needs to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_io #pragma once
#define GLM_GTX_io
// Dependency: // Dependency:
#include "../detail/setup.hpp" #include "../glm.hpp"
#include "../gtc/quaternion.hpp" #include "../gtx/quaternion.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_GTX_io extension included") # pragma message("GLM: GLM_GTX_io extension included")
#endif #endif
#include <iosfwd> // std::basic_ostream<> (fwd) #include <iosfwd> // std::basic_ostream<> (fwd)
#include <locale> // std::locale, std::locale::facet, std::locale::id
#include <utility> // std::pair<> #include <utility> // std::pair<>
namespace glm namespace glm
{ {
/// @addtogroup gtx_io /// @addtogroup gtx_io
/// @{ /// @{
namespace io
{
class precision_guard {
public: namespace io
GLM_FUNC_DECL explicit precision_guard();
GLM_FUNC_DECL ~precision_guard();
private:
unsigned precision_;
unsigned value_width_;
};
class format_guard
{ {
public: enum order_type { column_major, row_major};
enum order_t { column_major, row_major, };
GLM_FUNC_DECL explicit format_guard(); template <typename CTy>
GLM_FUNC_DECL ~format_guard(); class format_punct : public std::locale::facet
{
typedef CTy char_type;
private: public:
order_t order_; static std::locale::id id;
char cr_;
};
// decimal places (dflt: 3) bool formatted;
GLM_FUNC_DECL unsigned& precision(); unsigned precision;
unsigned width;
char_type separator;
char_type delim_left;
char_type delim_right;
char_type space;
char_type newline;
order_type order;
// sign + value + '.' + decimals (dflt: 1 + 4 + 1 + precision()) explicit format_punct(size_t a = 0);
GLM_FUNC_DECL unsigned& value_width(); explicit format_punct(format_punct const&);
};
// matrix output order (dflt: row_major) template <typename CTy, typename CTr = std::char_traits<CTy> >
GLM_FUNC_DECL format_guard::order_t& order(); class basic_state_saver {
// carriage/return char (dflt: '\n') public:
GLM_FUNC_DECL char& cr();
// matrix output order -> column_major explicit basic_state_saver(std::basic_ios<CTy,CTr>&);
GLM_FUNC_DECL std::ios_base& column_major(std::ios_base&); ~basic_state_saver();
// matrix output order -> row_major private:
GLM_FUNC_DECL std::ios_base& row_major (std::ios_base&);
// carriage/return char -> '\n' typedef ::std::basic_ios<CTy,CTr> state_type;
GLM_FUNC_DECL std::ios_base& formatted (std::ios_base&); typedef typename state_type::char_type char_type;
typedef ::std::ios_base::fmtflags flags_type;
typedef ::std::streamsize streamsize_type;
typedef ::std::locale const locale_type;
// carriage/return char -> ' ' state_type& state_;
GLM_FUNC_DECL std::ios_base& unformatted (std::ios_base&); flags_type flags_;
streamsize_type precision_;
streamsize_type width_;
char_type fill_;
locale_type locale_;
}//namespace io basic_state_saver& operator=(basic_state_saver const&);
};
namespace detail typedef basic_state_saver<char> state_saver;
{ typedef basic_state_saver<wchar_t> wstate_saver;
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
/// @} template <typename CTy, typename CTr = std::char_traits<CTy> >
}//namespace detail class basic_format_saver
{
public:
explicit basic_format_saver(std::basic_ios<CTy,CTr>&);
~basic_format_saver();
private:
basic_state_saver<CTy> const bss_;
basic_format_saver& operator=(basic_format_saver const&);
};
typedef basic_format_saver<char> format_saver;
typedef basic_format_saver<wchar_t> wformat_saver;
struct precision
{
unsigned value;
explicit precision(unsigned);
};
struct width
{
unsigned value;
explicit width(unsigned);
};
template <typename CTy>
struct delimeter
{
CTy value[3];
explicit delimeter(CTy /* left */, CTy /* right */, CTy /* separator */ = ',');
};
struct order
{
order_type value;
explicit order(order_type);
};
// functions, inlined (inline)
template <typename FTy, typename CTy, typename CTr>
FTy const& get_facet(std::basic_ios<CTy,CTr>&);
template <typename FTy, typename CTy, typename CTr>
std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>&);
template <typename FTy, typename CTy, typename CTr>
std::basic_ios<CTy,CTr>& unformattet(std::basic_ios<CTy,CTr>&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, precision const&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, width const&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, delimeter<CTy> const&);
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>&, order const&);
}//namespace io
namespace detail
{
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tvec4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat2x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat3x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x2<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_DECL std::basic_ostream<CTy,CTr> & operator<<(
std::basic_ostream<CTy,CTr> &,
std::pair<tmat4x4<T,P> const,
tmat4x4<T,P> const> const &);
}//namespace detail
/// @}
}//namespace glm }//namespace glm
#include "io.inl" #include "io.inl"
#endif//GLM_GTX_io

View File

@@ -1,328 +1,598 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2013-11-22 // Created : 2013-11-22
// Updated : 2013-11-22 // Updated : 2013-12-18
// Licence : This source is under MIT License // Licence : This source is under MIT License
// File : glm/gtx/inl.inl // File : glm/gtx/inl.inl
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../matrix.hpp" #include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw
// #include <boost/io/ios_state.hpp> // boost::io::ios_all_saver #include <ostream> // std::basic_ostream<>
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right,
// std::setw
#include <ostream> // std::basic_ostream<>
namespace glm{ namespace glm{
namespace io namespace io
{ {
template <typename CTy>
/* explicit */ GLM_FUNC_QUALIFIER /* explicit */ GLM_FUNC_QUALIFIER
precision_guard::precision_guard() format_punct<CTy>::format_punct(size_t a)
: precision_ (precision()), : std::locale::facet(a),
value_width_(value_width()) formatted (true),
{} precision (3),
width (1 + 4 + 1 + precision),
separator (','),
delim_left ('['),
delim_right (']'),
space (' '),
newline ('\n'),
order (row_major)
{}
GLM_FUNC_QUALIFIER template <typename CTy>
precision_guard::~precision_guard() /* explicit */ GLM_FUNC_QUALIFIER
{ format_punct<CTy>::format_punct(format_punct const& a)
value_width() = value_width_; : std::locale::facet(0),
precision() = precision_; formatted (a.formatted),
} precision (a.precision),
width (a.width),
separator (a.separator),
delim_left (a.delim_left),
delim_right (a.delim_right),
space (a.space),
newline (a.newline),
order (a.order)
{}
/* explicit */ GLM_FUNC_QUALIFIER template <typename CTy> std::locale::id format_punct<CTy>::id;
format_guard::format_guard()
: order_(order()),
cr_ (cr())
{}
GLM_FUNC_QUALIFIER template <typename CTy, typename CTr>
format_guard::~format_guard() /* explicit */ GLM_FUNC_QUALIFIER basic_state_saver<CTy,CTr>::basic_state_saver(std::basic_ios<CTy,CTr>& a)
{ : state_ (a),
cr() = cr_; flags_ (a.flags()),
order() = order_; precision_(a.precision()),
} width_ (a.width()),
fill_ (a.fill()),
locale_ (a.getloc())
{}
GLM_FUNC_QUALIFIER unsigned& precision() template <typename CTy, typename CTr>
{ GLM_FUNC_QUALIFIER basic_state_saver<CTy,CTr>::~basic_state_saver()
static unsigned p(3); {
state_.imbue(locale_);
state_.fill(fill_);
state_.width(width_);
state_.precision(precision_);
state_.flags(flags_);
}
return p; template <typename CTy, typename CTr>
} /* explicit */ GLM_FUNC_QUALIFIER basic_format_saver<CTy,CTr>::basic_format_saver(std::basic_ios<CTy,CTr>& a)
: bss_(a)
GLM_FUNC_QUALIFIER unsigned& value_width() {
{ a.imbue(std::locale(a.getloc(), new format_punct<CTy>(get_facet<format_punct<CTy> >(a))));
static unsigned p(9); }
return p; template <typename CTy, typename CTr>
} GLM_FUNC_QUALIFIER
basic_format_saver<CTy,CTr>::~basic_format_saver()
GLM_FUNC_QUALIFIER format_guard::order_t& order() {}
{
static format_guard::order_t p(format_guard::row_major);
return p; /* explicit */ GLM_FUNC_QUALIFIER precision::precision(unsigned a)
} : value(a)
{}
GLM_FUNC_QUALIFIER char&
cr()
{
static char p('\n'); return p;
}
GLM_FUNC_QUALIFIER std::ios_base& column_major(std::ios_base& os)
{
order() = format_guard::column_major;
return os;
}
GLM_FUNC_QUALIFIER std::ios_base& row_major(std::ios_base& os)
{
order() = format_guard::row_major;
return os;
}
GLM_FUNC_QUALIFIER std::ios_base& formatted(std::ios_base& os) /* explicit */ GLM_FUNC_QUALIFIER width::width(unsigned a)
{ : value(a)
cr() = '\n'; {}
return os; template <typename CTy>
} /* explicit */ GLM_FUNC_QUALIFIER delimeter<CTy>::delimeter(CTy a, CTy b, CTy c)
: value()
GLM_FUNC_QUALIFIER std::ios_base& unformatted(std::ios_base& os) {
{ value[0] = a;
cr() = ' '; value[1] = b;
value[2] = c;
return os; }
}
/* explicit */ GLM_FUNC_QUALIFIER
order::order(order_type a)
: value(a)
{}
template <typename FTy, typename CTy, typename CTr>
GLM_FUNC_QUALIFIER FTy const& get_facet(std::basic_ios<CTy,CTr>& ios)
{
if (!std::has_facet<FTy>(ios.getloc())) {
ios.imbue(std::locale(ios.getloc(), new FTy));
}
return std::use_facet<FTy>(ios.getloc());
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ios<CTy,CTr>& formatted(std::basic_ios<CTy,CTr>& ios)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(ios)).formatted = true;
return ios;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ios<CTy,CTr>& unformatted(std::basic_ios<CTy,CTr>& ios)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(ios)).formatted = false;
return ios;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, precision const& a)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).precision = a.value;
return os;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, width const& a)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).width = a.value;
return os;
}
template <typename CTy, typename CTr>
std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, delimeter<CTy> const& a)
{
format_punct<CTy> & fmt(const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)));
fmt.delim_left = a.value[0];
fmt.delim_right = a.value[1];
fmt.separator = a.value[2];
return os;
}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy, CTr>& operator<<(std::basic_ostream<CTy, CTr>& os, order const& a)
{
const_cast<format_punct<CTy>&>(get_facet<format_punct<CTy> >(os)).order = a.value;
return os;
}
} // namespace io } // namespace io
namespace detail namespace detail
{ {
// functions, inlined (inline) template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tquat<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
template <typename CTy, typename CTr, typename T, precision P> if(cerberus)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tquat<T,P> const& a) {
{ io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { if(fmt.formatted)
// boost::io::ios_all_saver const ias(os); {
io::basic_state_saver<CTy> const bss(os);
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z
<< ']';
}
return os; os << std::fixed
} << std::right
<< std::setprecision(fmt.precision)
template <typename CTy, typename CTr, typename T, precision P> << std::setfill(fmt.space)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec2<T,P> const& a) << fmt.delim_left
{ << std::setw(fmt.width) << a.w << fmt.separator
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); << std::setw(fmt.width) << a.x << fmt.separator
<< std::setw(fmt.width) << a.y << fmt.separator
<< std::setw(fmt.width) << a.z
<< fmt.delim_right;
}
else
{
os << a.w << fmt.space << a.x << fmt.space << a.y << fmt.space << a.z;
}
}
if (cerberus) { return os;
// boost::io::ios_all_saver const ias(os); }
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y
<< ']';
}
return os; template <typename CTy, typename CTr, typename T, precision P>
} GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec2<T,P> const& a)
{
template <typename CTy, typename CTr, typename T, precision P> typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { if(cerberus)
// boost::io::ios_all_saver const ias(os); {
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z
<< ']';
}
return os; if(fmt.formatted)
} {
io::basic_state_saver<CTy> const bss(os);
template <typename CTy, typename CTr, typename T, precision P> os << std::fixed
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a) << std::right
{ << std::setprecision(fmt.precision)
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); << std::setfill(fmt.space)
<< fmt.delim_left
<< std::setw(fmt.width) << a.x << fmt.separator
<< std::setw(fmt.width) << a.y
<< fmt.delim_right;
}
else
{
os << a.x << fmt.space << a.y;
}
}
if (cerberus) { return os;
// boost::io::ios_all_saver const ias(os); }
os << std::fixed << std::setprecision(io::precision())
<< '['
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.x << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.y << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.z << ','
<< std::right << std::setfill<CTy>(' ') << std::setw(io::value_width()) << a.w
<< ']';
}
return os; template <typename CTy, typename CTr, typename T, precision P>
} GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec3<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
template <typename CTy, typename CTr, typename T, precision P> if(cerberus)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& m) {
{ io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { if(fmt.formatted)
{
os << io::cr() io::basic_state_saver<CTy> const bss(os);
<< '[' << m[0] << io::cr()
<< ' ' << m[1] << ']';
}
return os; os << std::fixed
} << std::right
<< std::setprecision(fmt.precision)
<< std::setfill(fmt.space)
<< fmt.delim_left
<< std::setw(fmt.width) << a.x << fmt.separator
<< std::setw(fmt.width) << a.y << fmt.separator
<< std::setw(fmt.width) << a.z
<< fmt.delim_right;
}
else
{
os << a.x << fmt.space << a.y << fmt.space << a.z;
}
}
template <typename CTy, typename CTr, typename T, precision P> return os;
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& m) }
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tvec4<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
os << io::cr() if(cerberus)
<< '[' << m[0] << io::cr() {
<< ' ' << m[1] << ']'; io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
}
return os; if(fmt.formatted)
} {
io::basic_state_saver<CTy> const bss(os);
template <typename CTy, typename CTr, typename T, precision P> os << std::fixed
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& m) << std::right
{ << std::setprecision(fmt.precision)
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); << std::setfill(fmt.space)
<< fmt.delim_left
<< std::setw(fmt.width) << a.x << fmt.separator
<< std::setw(fmt.width) << a.y << fmt.separator
<< std::setw(fmt.width) << a.z << fmt.separator
<< std::setw(fmt.width) << a.w
<< fmt.delim_right;
}
else
{
os << a.x << fmt.space << a.y << fmt.space << a.z << fmt.space << a.w;
}
}
if (cerberus) { return os;
}
os << io::cr() template <typename CTy, typename CTr, typename T, precision P>
<< '[' << m[0] << io::cr() GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& a)
<< ' ' << m[1] << ']'; {
} typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
return os; if(cerberus)
} {
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat2x2<T,P> m(a);
template <typename CTy, typename CTr, typename T, precision P> if(io::row_major == fmt.order)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& m) m = transpose(a);
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { if(fmt.formatted)
{
os << fmt.newline
<< fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1];
}
}
os << io::cr() return os;
<< '[' << m[0] << io::cr() }
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << ']';
}
return os; template <typename CTy, typename CTr, typename T, precision P>
} GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
template <typename CTy, typename CTr, typename T, precision P> if(cerberus)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& m) {
{ io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); tmat3x2<T,P> m(a);
if (cerberus) { if(io::row_major == fmt.order)
m = transpose(a);
os << io::cr() if(fmt.formatted)
<< '[' << m[0] << io::cr() {
<< ' ' << m[1] << io::cr() os << fmt.newline
<< ' ' << m[2] << ']'; << fmt.delim_left << m[0] << fmt.newline
} << fmt.space << m[1] << fmt.newline
<< fmt.space << m[2] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2];
}
}
return os; return os;
} }
template <typename CTy, typename CTr, typename T, precision P> template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& m) GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& a)
{ {
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x2<T,P> m(a);
os << io::cr() if(io::row_major == fmt.order)
<< '[' << m[0] << io::cr() m = transpose(a);
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << ']';
}
return os;
}
template <typename CTy, typename CTr, typename T, precision P> if(fmt.formatted)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& m) {
{ os << fmt.newline
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); << fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.newline
<< fmt.space << m[2] << fmt.newline
<< fmt.space << m[3] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3];
}
}
if (cerberus) { return os;
}
os << io::cr() template <typename CTy, typename CTr, typename T, precision P>
<< '[' << m[0] << io::cr() GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& a)
<< ' ' << m[1] << io::cr() {
<< ' ' << m[2] << io::cr() typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
<< ' ' << m[3] << ']';
}
return os; if(cerberus)
} {
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat2x3<T,P> m(a);
template <typename CTy, typename CTr, typename T, precision P> if(io::row_major == fmt.order)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& m) m = transpose(a);
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if (cerberus) { if(fmt.formatted)
{
os << fmt.newline
<< fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1];
}
}
os << io::cr() return os;
<< '[' << m[0] << io::cr() }
<< ' ' << m[1] << io::cr()
<< ' ' << m[2] << io::cr()
<< ' ' << m[3] << ']';
}
return os; template <typename CTy, typename CTr, typename T, precision P>
} GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
template <typename CTy, typename CTr, typename T, precision P> if(cerberus)
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& m) {
{ io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os); tmat3x3<T,P> m(a);
if (cerberus) { if(io::row_major == fmt.order)
m = transpose(a);
os << io::cr() if(fmt.formatted)
<< '[' << m[0] << io::cr() {
<< ' ' << m[1] << io::cr() os << fmt.newline
<< ' ' << m[2] << io::cr() << fmt.delim_left << m[0] << fmt.newline
<< ' ' << m[3] << ']'; << fmt.space << m[1] << fmt.newline
} << fmt.space << m[2] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2];
}
}
return os; return os;
} }
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x3<T,P> m(a);
if(io::row_major == fmt.order)
m = transpose(a);
if (fmt.formatted)
{
os << fmt.newline
<< fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.newline
<< fmt.space << m[2] << fmt.newline
<< fmt.space << m[3] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3];
}
}
return os;
}
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat2x4<T,P> m(a);
if(io::row_major == fmt.order)
m = transpose(a);
if (fmt.formatted)
{
os << fmt.newline
<< fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1];
}
}
return os;
}
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat3x4<T,P> m(a);
if(io::row_major == fmt.order)
m = transpose(a);
if(fmt.formatted)
{
os << fmt.newline
<< fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.newline
<< fmt.space << m[2] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2];
}
}
return os;
}
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr> & operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x4<T,P> m(a);
if (io::row_major == fmt.order)
m = transpose(a);
if(fmt.formatted)
{
os << fmt.newline
<< fmt.delim_left << m[0] << fmt.newline
<< fmt.space << m[1] << fmt.newline
<< fmt.space << m[2] << fmt.newline
<< fmt.space << m[3] << fmt.delim_right;
}
else
{
os << m[0] << fmt.space << m[1] << fmt.space << m[2] << fmt.space << m[3];
}
}
return os;
}
template <typename CTy, typename CTr, typename T, precision P>
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(
std::basic_ostream<CTy,CTr> & os,
std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const& a)
{
typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
if(cerberus)
{
io::format_punct<CTy> const & fmt(io::get_facet<io::format_punct<CTy> >(os));
tmat4x4<T,P> ml(a.first);
tmat4x4<T,P> mr(a.second);
if(io::row_major == fmt.order)
{
ml = transpose(a.first);
mr = transpose(a.second);
}
if(fmt.formatted)
{
CTy const & l(fmt.delim_left);
CTy const & r(fmt.delim_right);
CTy const & s(fmt.space);
os << fmt.newline
<< l << ml[0] << s << s << l << mr[0] << fmt.newline
<< s << ml[1] << s << s << s << mr[1] << fmt.newline
<< s << ml[2] << s << s << s << mr[2] << fmt.newline
<< s << ml[3] << r << s << s << mr[3] << r;
}
else
{
os << ml << fmt.space << mr;
}
}
return os;
}
}//namespace detail }//namespace detail
}//namespace glm }//namespace glm

View File

@@ -35,8 +35,7 @@
/// <glm/gtx/log_base.hpp> need to be included to use these functionalities. /// <glm/gtx/log_base.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_log_base #pragma once
#define GLM_GTX_log_base
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -61,5 +60,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "log_base.inl" #include "log_base.inl"
#endif//GLM_GTX_log_base

View File

@@ -36,8 +36,7 @@
/// <glm/gtx/matrix_cross_product.hpp> need to be included to use these functionalities. /// <glm/gtx/matrix_cross_product.hpp> need to be included to use these functionalities.
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_matrix_cross_product #pragma once
#define GLM_GTX_matrix_cross_product
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
@@ -67,5 +66,3 @@ namespace glm
}//namespace glm }//namespace glm
#include "matrix_cross_product.inl" #include "matrix_cross_product.inl"
#endif//GLM_GTX_matrix_cross_product

Some files were not shown because too many files have changed in this diff Show More