Merge 0.9.6 branch

master
Christophe Riccio ago%!(EXTRA string=11 years)
commit 93d07fdc39
  1. BIN
      doc/~$glm.docx
  2. 12
      glm/detail/func_packing.hpp
  3. 31
      glm/detail/func_packing.inl
  4. 231
      glm/detail/setup.hpp
  5. 10
      glm/gtc/packing.inl
  6. 4
      glm/gtx/scalar_multiplication.hpp
  7. 3
      readme.txt
  8. 2
      test/gtx/gtx_scalar_multiplication.cpp

Binary file not shown.

@ -111,7 +111,7 @@ namespace glm
/// ///
/// @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 vec2 unpackUnorm2x16(uint const & p); GLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
@ -124,7 +124,7 @@ namespace glm
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 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 unpackSnorm2x16(uint const & p); GLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
@ -137,7 +137,7 @@ namespace glm
/// ///
/// @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 vec4 unpackUnorm4x8(uint const & p); GLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
@ -150,7 +150,7 @@ namespace glm
/// ///
/// @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 vec4 unpackSnorm4x8(uint const & p); GLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);
/// Returns a double-precision value obtained by packing the components of v into a 64-bit value. /// Returns a double-precision value obtained by packing the components of v into a 64-bit value.
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. /// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
@ -169,7 +169,7 @@ namespace glm
/// ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 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 uvec2 unpackDouble2x32(double const & v); GLM_FUNC_DECL uvec2 unpackDouble2x32(double v);
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector /// Returns an unsigned integer obtained by converting the components of a two-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,
@ -189,7 +189,7 @@ namespace glm
/// ///
/// @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 vec2 unpackHalf2x16(uint const & v); GLM_FUNC_DECL vec2 unpackHalf2x16(uint v);
/// @} /// @}
}//namespace glm }//namespace glm

@ -38,13 +38,11 @@ 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 const Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
// return reinterpret_cast<uint&>(Topack); return reinterpret_cast<uint const &>(Topack);
uint* ptr(reinterpret_cast<uint*>(&Topack));
return *ptr;
} }
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p) GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint p)
{ {
vec2 Unpack(reinterpret_cast<u16vec2 const &>(p)); vec2 Unpack(reinterpret_cast<u16vec2 const &>(p));
return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0 return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0
@ -56,7 +54,7 @@ namespace glm
return reinterpret_cast<uint const &>(Topack); return reinterpret_cast<uint const &>(Topack);
} }
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p) GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint p)
{ {
vec2 const Unpack(reinterpret_cast<i16vec2 const &>(p)); vec2 const Unpack(reinterpret_cast<i16vec2 const &>(p));
return clamp( return clamp(
@ -70,7 +68,7 @@ namespace glm
return reinterpret_cast<uint const &>(Topack); return reinterpret_cast<uint const &>(Topack);
} }
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint const & p) GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint p)
{ {
vec4 const Unpack(reinterpret_cast<u8vec4 const&>(p)); vec4 const Unpack(reinterpret_cast<u8vec4 const&>(p));
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255 return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
@ -78,13 +76,13 @@ namespace glm
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v) GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
{ {
i8vec4 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f)); i8vec4 const Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
return reinterpret_cast<uint&>(Topack); return reinterpret_cast<uint const &>(Topack);
} }
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint const & p) GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint p)
{ {
vec4 Unpack(reinterpret_cast<i8vec4 const &>(p)); vec4 const Unpack(reinterpret_cast<i8vec4 const &>(p));
return clamp( return clamp(
Unpack * 0.0078740157480315f, // 1.0f / 127.0f Unpack * 0.0078740157480315f, // 1.0f / 127.0f
-1.0f, 1.0f); -1.0f, 1.0f);
@ -95,24 +93,23 @@ namespace glm
return reinterpret_cast<double const &>(v); return reinterpret_cast<double const &>(v);
} }
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v) GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double v)
{ {
return reinterpret_cast<uvec2 const &>(v); return reinterpret_cast<uvec2 const &>(v);
} }
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v) GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
{ {
i16vec2 Unpack( i16vec2 const Unpack(
detail::toFloat16(v.x), detail::toFloat16(v.x),
detail::toFloat16(v.y)); detail::toFloat16(v.y));
uint * Result = reinterpret_cast<uint*>(&Unpack); return reinterpret_cast<uint const &>(Unpack);
return *Result;
} }
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint v)
{ {
i16vec2 Unpack(reinterpret_cast<i16vec2 const &>(v)); i16vec2 const Unpack(reinterpret_cast<i16vec2 const &>(v));
return vec2( return vec2(
detail::toFloat32(Unpack.x), detail::toFloat32(Unpack.x),

@ -496,113 +496,161 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Has of C++ features // Has of C++ features
#ifndef __has_include
# define __has_include(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_feature
# define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_extension
# define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif
// http://clang.llvm.org/cxx_status.html // http://clang.llvm.org/cxx_status.html
// http://gcc.gnu.org/projects/cxx0x.html // http://gcc.gnu.org/projects/cxx0x.html
// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
// N1720 #if GLM_PLATFORM != GLM_PLATFORM_ANDROID
#define GLM_HAS_CXX11_STL !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ((GLM_PLATFORM != GLM_PLATFORM_ANDROID) && (\ # define GLM_HAS_CXX11_STL 0
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ #elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_INTEL)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ # define GLM_HAS_CXX11_STL __has_include("__config")
__has_include("__config"))) #else
# define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && \
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
// N1720 // N1720
#define GLM_HAS_STATIC_ASSERT !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ # define GLM_HAS_STATIC_ASSERT 1
__has_feature(cxx_static_assert)) #else
# define GLM_HAS_STATIC_ASSERT (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)))
#endif
// N1988 // N1988
#define GLM_HAS_EXTENDED_INTEGER_TYPE !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_LANG & GLM_LANG_CXX11_FLAG
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_EXTENDED_INTEGER_TYPE 1
#else
# define GLM_HAS_EXTENDED_INTEGER_TYPE (\
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_LLVM) && (GLM_COMPILER >= GLM_COMPILER_LLVM30)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40))) ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_APPLE_CLANG) && (GLM_COMPILER >= GLM_COMPILER_APPLE_CLANG40)))
#endif
// N2235 // N2235
#define GLM_HAS_CONSTEXPR !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_CONSTEXPR __has_feature(cxx_constexpr)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
__has_feature(cxx_constexpr)) #elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_CONSTEXPR 1
# define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
#else
# define GLM_HAS_CONSTEXPR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
# define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015))
#endif
// N2672 // N2672
#define GLM_HAS_INITIALIZER_LISTS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \ # define GLM_HAS_INITIALIZER_LISTS 1
__has_feature(cxx_generalized_initializers)) #else
# define GLM_HAS_INITIALIZER_LISTS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
// N2544 Unrestricted unions // N2544 Unrestricted unions
#define GLM_HAS_UNRESTRICTED_UNIONS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
(GLM_LANG & GLM_LANG_CXXMS_FLAG) || \ #elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ # define GLM_HAS_UNRESTRICTED_UNIONS 1
__has_feature(cxx_unrestricted_unions)) #else
# define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
#endif
// N2346 // N2346
#define GLM_HAS_DEFAULTED_FUNCTIONS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \ # define GLM_HAS_DEFAULTED_FUNCTIONS 1
__has_feature(cxx_defaulted_functions)) #else
# define GLM_HAS_DEFAULTED_FUNCTIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
// N2118 // N2118
#define GLM_HAS_RVALUE_REFERENCES !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \ #elif GLM_LANG & GLM_LANG_CXX11_FLAG
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ # define GLM_HAS_RVALUE_REFERENCES 1
__has_feature(cxx_rvalue_references)) #else
# define GLM_HAS_RVALUE_REFERENCES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
// N2437 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
#define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #endif
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
__has_feature(cxx_explicit_conversions))
#define GLM_HAS_STL_ARRAY !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)))
#define GLM_HAS_TEMPLATE_ALIASES !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \
__has_feature(cxx_alias_templates))
#define GLM_HAS_RANGE_FOR !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
__has_feature(cxx_range_for))
#define GLM_HAS_ASSIGNABLE !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))) # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
#else
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
#define GLM_HAS_TRIVIAL_QUERIES !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
#if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
# define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_TEMPLATE_ALIASES 1
#else
# define GLM_HAS_TEMPLATE_ALIASES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
#define GLM_HAS_MAKE_SIGNED !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && ( \ // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \ #if GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
# define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_RANGE_FOR 1
#else
# define GLM_HAS_RANGE_FOR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
#endif
//
#if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_ASSIGNABLE 1
#else
# define GLM_HAS_ASSIGNABLE (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
#endif
//
#define GLM_HAS_TRIVIAL_QUERIES ( \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
//
#if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_MAKE_SIGNED 1
#else
# define GLM_HAS_MAKE_SIGNED (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
#endif
#define GLM_HAS_BITSCAN_WINDOWS ( \ //
(GLM_ARCH != GLM_ARCH_PURE) && \ #if GLM_ARCH == GLM_ARCH_PURE
(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && \ # define GLM_HAS_BITSCAN_WINDOWS 0
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))) #else
# define GLM_HAS_BITSCAN_WINDOWS (GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))
#endif
// OpenMP // OpenMP
#ifdef _OPENMP #ifdef _OPENMP
@ -624,7 +672,7 @@
#endif #endif
// Not standard // Not standard
#define GLM_HAS_ANONYMOUS_UNION !defined(GLM_FORCE_CXX98) && !defined(GLM_FORCE_CXX03) && (GLM_LANG & GLM_LANG_CXXMS_FLAG) #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Platform // Platform
@ -885,6 +933,29 @@ namespace detail
# endif # endif
#endif//GLM_MESSAGE #endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////
// countof
#ifndef __has_feature
# define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#if GLM_HAS_CONSTEXPR_PARTIAL
namespace glm
{
template <typename T, std::size_t N>
constexpr std::size_t countof(T const (&)[N])
{
return N;
}
}//namespace glm
# define GLM_COUNTOF(arr) glm::countof(arr)
#elif _MSC_VER
# define GLM_COUNTOF(arr) _countof(arr)
#else
# define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])
#endif
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Uninitialize constructors // Uninitialize constructors

@ -263,7 +263,7 @@ namespace detail
GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v) GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v)
{ {
u8vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f)); u8vec2 const Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
return reinterpret_cast<uint16 const &>(Topack); return reinterpret_cast<uint16 const &>(Topack);
} }
@ -354,15 +354,13 @@ namespace detail
GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v) GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v)
{ {
int16 Topack = detail::toFloat16(v); int16 const Topack(detail::toFloat16(v));
uint16* Packed = reinterpret_cast<uint16*>(&Topack); return reinterpret_cast<uint16 const &>(Topack);
return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v) GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v)
{ {
int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v)); return detail::toFloat32(reinterpret_cast<int16 const &>(v));
return detail::toFloat32(*Unpack);
} }
GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v) GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v)

@ -43,8 +43,8 @@
#include "../detail/setup.hpp" #include "../detail/setup.hpp"
#if !GLM_HAS_TEMPLATE_ALIASES #if !GLM_HAS_TEMPLATE_ALIASES && !(GLM_COMPILER & GLM_COMPILER_GCC)
# error "GLM_GTX_scalar_multiplication requires C++11 suppport or alias templates" # error "GLM_GTX_scalar_multiplication requires C++11 suppport or alias templates and if not support for GCC"
#endif #endif
#include "../vec2.hpp" #include "../vec2.hpp"

@ -78,6 +78,7 @@ Features:
Improvements: Improvements:
- Removed assert for perspective with zFar < zNear #298 - Removed assert for perspective with zFar < zNear #298
- Added Visual Studio natvis support for vec1, quat and dualqual types - Added Visual Studio natvis support for vec1, quat and dualqual types
- Cleaned up C++11 feature detections
Fixes: Fixes:
- Fixed faceforward build #289 - Fixed faceforward build #289
@ -87,6 +88,8 @@ Fixes:
- Fixed warnings in F2x11_1x10 packing function in GTC_packing #295 - Fixed warnings in F2x11_1x10 packing function in GTC_packing #295
- Fixed Visual Studio natvis support for vec4 #288 - Fixed Visual Studio natvis support for vec4 #288
- Fixed GTC_packing *pack*norm*x* build and added tests #292 - Fixed GTC_packing *pack*norm*x* build and added tests #292
- Disabled GTX_scalar_multiplication for GCC, failing to build tests #242
- Fixed Visual C++ 2015 constexpr errors: Disabled only partial support
================================================================================ ================================================================================
GLM 0.9.6.1: 2014-12-10 GLM 0.9.6.1: 2014-12-10

@ -31,7 +31,7 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#if GLM_HAS_TEMPLATE_ALIASES #if GLM_HAS_TEMPLATE_ALIASES & !(GLM_COMPILER & GLM_COMPILER_GCC)
#include <glm/gtx/scalar_multiplication.hpp> #include <glm/gtx/scalar_multiplication.hpp>
int main() int main()

Loading…
Cancel
Save