diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b87a8eb..eff478e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler") - add_compile_options(/FAs /W4 /WX) + add_compile_options(/W4 /WX) add_compile_options(/wd4309 /wd4324 /wd4389 /wd4127 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 2de9e4a2..ee0592df 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -781,6 +781,6 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_common_simd.inl" #endif diff --git a/glm/detail/func_exponential.inl b/glm/detail/func_exponential.inl index 808d6907..a847e63f 100644 --- a/glm/detail/func_exponential.inl +++ b/glm/detail/func_exponential.inl @@ -146,7 +146,7 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_exponential_simd.inl" #endif diff --git a/glm/detail/func_exponential_simd.inl b/glm/detail/func_exponential_simd.inl index 4b2ef455..a9adea22 100644 --- a/glm/detail/func_exponential_simd.inl +++ b/glm/detail/func_exponential_simd.inl @@ -19,6 +19,7 @@ namespace detail } }; +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE template<> struct compute_sqrt<4, float, aligned_lowp, true> { @@ -29,6 +30,7 @@ namespace detail return Result; } }; +# endif }//namespace detail }//namespace glm diff --git a/glm/detail/func_geometric.inl b/glm/detail/func_geometric.inl index 0408a8be..cc9e57df 100644 --- a/glm/detail/func_geometric.inl +++ b/glm/detail/func_geometric.inl @@ -242,6 +242,6 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_geometric_simd.inl" #endif diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index 6adc57d9..d02a5e1b 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -372,7 +372,7 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_integer_simd.inl" #endif diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index 6a0a41c5..c946f0a9 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -395,7 +395,7 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_matrix_simd.inl" #endif diff --git a/glm/detail/func_matrix_simd.inl b/glm/detail/func_matrix_simd.inl index b96c0282..9478ce52 100644 --- a/glm/detail/func_matrix_simd.inl +++ b/glm/detail/func_matrix_simd.inl @@ -61,6 +61,7 @@ namespace detail }; }//namespace detail +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE template<> GLM_FUNC_QUALIFIER mat<4, 4, float, aligned_lowp> outerProduct<4, 4, float, aligned_lowp>(vec<4, float, aligned_lowp> const& c, vec<4, float, aligned_lowp> const& r) { @@ -90,6 +91,7 @@ namespace detail std::memcpy(&Result[0], &NativeResult[0], sizeof(Result)); return Result; } +# endif }//namespace glm #endif diff --git a/glm/detail/func_packing.inl b/glm/detail/func_packing.inl index 94875680..1904d968 100644 --- a/glm/detail/func_packing.inl +++ b/glm/detail/func_packing.inl @@ -184,7 +184,7 @@ namespace glm } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_packing_simd.inl" #endif diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index 6306456d..8571a524 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -194,7 +194,7 @@ namespace glm } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_trigonometric_simd.inl" #endif diff --git a/glm/detail/func_vector_relational.inl b/glm/detail/func_vector_relational.inl index ba2e06d6..7c66125a 100644 --- a/glm/detail/func_vector_relational.inl +++ b/glm/detail/func_vector_relational.inl @@ -100,6 +100,6 @@ namespace glm } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "func_vector_relational_simd.inl" #endif diff --git a/glm/detail/qualifier.hpp b/glm/detail/qualifier.hpp index 2437fc06..9765fb2f 100644 --- a/glm/detail/qualifier.hpp +++ b/glm/detail/qualifier.hpp @@ -15,7 +15,7 @@ namespace glm packed_mediump, ///< Typed data is tightly packed in memory and operations are executed with medium precision in term of ULPs for higher performance packed_lowp, ///< Typed data is tightly packed in memory and operations are executed with low precision in term of ULPs to maximize performance -# if (GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE) +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE aligned_highp, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs aligned_mediump, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs for higher performance aligned_lowp, // ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs to maximize performance @@ -27,7 +27,7 @@ namespace glm lowp = packed_lowp, ///< By default lowp qualifier is also packed packed = packed_highp, ///< By default packed qualifier is also high precision -# if (GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE) && defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES) +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE && defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES) defaultp = aligned_highp # else defaultp = highp diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index c8ad0c90..3b012912 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -35,13 +35,6 @@ #include "../simd/platform.h" -/////////////////////////////////////////////////////////////////////////////////// -// Incompatible GLM_FORCE defines - -#if defined(GLM_FORCE_SWIZZLE) && defined(GLM_FORCE_UNRESTRICTED_GENTYPE) -# error "Both GLM_FORCE_SWIZZLE and GLM_FORCE_UNRESTRICTED_GENTYPE can't be defined at the same time" -#endif - /////////////////////////////////////////////////////////////////////////////////// // Build model @@ -233,9 +226,7 @@ #endif // N2346 -#if defined(GLM_FORCE_UNRESTRICTED_GENTYPE) -# define GLM_HAS_DEFAULTED_FUNCTIONS 0 -#elif GLM_COMPILER & GLM_COMPILER_CLANG +#if GLM_COMPILER & GLM_COMPILER_CLANG # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions) #elif GLM_LANG & GLM_LANG_CXX11_FLAG # define GLM_HAS_DEFAULTED_FUNCTIONS 1 @@ -408,12 +399,12 @@ // nullptr #if GLM_LANG & GLM_LANG_CXX0X_FLAG -# define GLM_HAS_NULLPTR 1 +# define GLM_USE_NULLPTR GLM_ENABLE #else -# define GLM_HAS_NULLPTR 0 +# define GLM_USE_NULLPTR GLM_DISABLE #endif -#if GLM_HAS_NULLPTR +#if GLM_USE_NULLPTR == GLM_ENABLE # define GLM_NULLPTR nullptr #else # define GLM_NULLPTR 0 @@ -442,12 +433,6 @@ # define GLM_CUDA_FUNC_DECL #endif -#if GLM_COMPILER & GLM_COMPILER_GCC -# define GLM_VAR_USED __attribute__ ((unused)) -#else -# define GLM_VAR_USED -#endif - #if defined(GLM_FORCE_INLINE) # if GLM_COMPILER & GLM_COMPILER_VC # define GLM_INLINE __forceinline @@ -498,7 +483,8 @@ #endif /////////////////////////////////////////////////////////////////////////////////// -// Clip control +// Clip control, define GLM_FORCE_DEPTH_ZERO_TO_ONE before including GLM +// to use a clip space between 0 to 1. #define GLM_DEPTH_ZERO_TO_ONE 0x00000001 #define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002 @@ -527,62 +513,16 @@ #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)) # define GLM_DEPRECATED __declspec(deprecated) -# define GLM_ALIGN(x) __declspec(align(x)) -# define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x)) # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name -# define GLM_RESTRICT_FUNC __declspec(restrict) -# define GLM_RESTRICT __restrict -# if GLM_COMPILER >= GLM_COMPILER_VC12 -# define GLM_VECTOR_CALL __vectorcall -# else -# define GLM_VECTOR_CALL -# endif #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL) # define GLM_DEPRECATED __attribute__((__deprecated__)) -# define GLM_ALIGN(x) __attribute__((aligned(x))) -# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment))) -# define GLM_RESTRICT_FUNC __restrict__ -# define GLM_RESTRICT __restrict__ -# if GLM_COMPILER & GLM_COMPILER_CLANG -# if GLM_COMPILER >= GLM_COMPILER_CLANG37 -# define GLM_VECTOR_CALL __vectorcall -# else -# define GLM_VECTOR_CALL -# endif -# else -# define GLM_VECTOR_CALL -# endif #elif GLM_COMPILER & GLM_COMPILER_CUDA # define GLM_DEPRECATED -# define GLM_ALIGN(x) __align__(x) -# define GLM_ALIGNED_STRUCT(x) struct __align__(x) # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x) -# define GLM_RESTRICT_FUNC __restrict__ -# define GLM_RESTRICT __restrict__ -# define GLM_VECTOR_CALL #else # define GLM_DEPRECATED -# define GLM_ALIGN -# define GLM_ALIGNED_STRUCT(x) struct # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name -# define GLM_RESTRICT_FUNC -# define GLM_RESTRICT -# define GLM_VECTOR_CALL -#endif//GLM_COMPILER - -/////////////////////////////////////////////////////////////////////////////////// - -#ifdef GLM_FORCE_NO_CTOR_INIT -# undef GLM_FORCE_CTOR_INIT -#endif - -#if GLM_HAS_DEFAULTED_FUNCTIONS && !defined(GLM_FORCE_CTOR_INIT) -# define GLM_USE_DEFAULTED_FUNCTIONS GLM_ENABLE -# define GLM_DEFAULT = default -#else -# define GLM_USE_DEFAULTED_FUNCTIONS GLM_DISABLE -# define GLM_DEFAULT #endif /////////////////////////////////////////////////////////////////////////////////// @@ -630,30 +570,64 @@ namespace glm #endif /////////////////////////////////////////////////////////////////////////////////// -// Check inclusions of different versions of GLM +// Configure the use of defaulted initialized types -#elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION)) -# error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error." -#elif GLM_SETUP_INCLUDED == GLM_VERSION +#define GLM_CTOR_INITIALIZER_LIST (1 << 1) +#define GLM_CTOR_INITIALISATION (1 << 2) + +#if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# define GLM_USE_CTOR_INIT GLM_CTOR_INITIALIZER_LIST +#elif defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# define GLM_USE_CTOR_INIT GLM_CTOR_INITIALISATION +#else +# define GLM_USE_CTOR_INIT GLM_DISABLE +#endif /////////////////////////////////////////////////////////////////////////////////// -// Enable aligned gentypes +// Configure the use of defaulted function -#if defined(GLM_FORCE_ALIGNED_GENTYPES) && GLM_HAS_ALIGNOF +#if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_USE_CTOR_INIT == GLM_DISABLE +# define GLM_USE_DEFAULTED_FUNCTIONS GLM_ENABLE +# define GLM_DEFAULT = default +#else +# define GLM_USE_DEFAULTED_FUNCTIONS GLM_DISABLE +# define GLM_DEFAULT +#endif + +/////////////////////////////////////////////////////////////////////////////////// +// Configure the use of aligned gentypes + +#if defined(GLM_FORCE_ALIGNED_GENTYPES) && GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) # define GLM_USE_ALIGNED_GENTYPES GLM_ENABLE #else # define GLM_USE_ALIGNED_GENTYPES GLM_DISABLE #endif /////////////////////////////////////////////////////////////////////////////////// -// Implementation detail +// Use SIMD instruction sets -#if (((GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)) || (GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE)) +#if (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT) +#define GLM_USE_SIMD GLM_ENABLE +#else +#define GLM_USE_SIMD GLM_DISABLE +#endif + +/////////////////////////////////////////////////////////////////////////////////// +// Configure the use of anonymous structure as implementation detail + +#if ((GLM_USE_SIMD == GLM_ENABLE) || (GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE)) # define GLM_USE_ANONYMOUS_STRUCT GLM_ENABLE #else # define GLM_USE_ANONYMOUS_STRUCT GLM_DISABLE #endif +/////////////////////////////////////////////////////////////////////////////////// +// Check inclusions of different versions of GLM + +#elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION)) +# error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error." +#elif GLM_SETUP_INCLUDED == GLM_VERSION + /////////////////////////////////////////////////////////////////////////////////// // Messages diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index d46290f5..316e3b18 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -7,14 +7,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<2, 2, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0), col_type(0, 1)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0); this->value[1] = col_type(0, 1); # endif diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 5580f3ae..19deae35 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -5,14 +5,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<2, 3, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0, 0), col_type(0, 1, 0)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0, 0); this->value[1] = col_type(0, 1, 0); # endif diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 251d90a6..439ac1de 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -5,14 +5,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<2, 4, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0, 0, 0), col_type(0, 1, 0, 0)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0, 0, 0); this->value[1] = col_type(0, 1, 0, 0); # endif diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 53e82229..b1d1c48e 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -5,14 +5,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<3, 2, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0), col_type(0, 1), col_type(0, 0)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0); this->value[1] = col_type(0, 1); this->value[2] = col_type(0, 0); diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index a72eb6d6..ad8c96e7 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -7,15 +7,15 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<3, 3, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0, 0), col_type(0, 1, 0), col_type(0, 0, 1)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS - this->value[0] = col_type(1, 0, 0); +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION + this->value[0] = col_type(1, 0, 0); this->value[1] = col_type(0, 1, 0); this->value[2] = col_type(0, 0, 1); # endif diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 8a722ffd..dc5d6ddb 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -5,14 +5,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<3, 4, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0, 0, 0), col_type(0, 1, 0, 0), col_type(0, 0, 1, 0)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0, 0, 0); this->value[1] = col_type(0, 1, 0, 0); this->value[2] = col_type(0, 0, 1, 0); diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 176e18fc..44fb77f7 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -5,14 +5,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<4, 2, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0), col_type(0, 1), col_type(0, 0), col_type(0, 0)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0); this->value[1] = col_type(0, 1); this->value[2] = col_type(0, 0); diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index b7b408b5..c9f9a620 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -5,14 +5,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<4, 3, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0, 0), col_type(0, 1, 0), col_type(0, 0, 1), col_type(0, 0, 0)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0, 0); this->value[1] = col_type(0, 1, 0); this->value[2] = col_type(0, 0, 1); diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index d98bf3b0..99844f7a 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -7,14 +7,14 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT) +# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 mat<4, 4, T, Q>::mat() -# if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST : value{col_type(1, 0, 0, 0), col_type(0, 1, 0, 0), col_type(0, 0, 1, 0), col_type(0, 0, 0, 1)} # endif { -# if defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS +# if GLM_USE_CTOR_INIT == GLM_CTOR_INITIALISATION this->value[0] = col_type(1, 0, 0, 0); this->value[1] = col_type(0, 1, 0, 0); this->value[2] = col_type(0, 0, 1, 0); @@ -704,6 +704,6 @@ namespace glm } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "type_mat4x4_simd.inl" #endif diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 918f0616..9a3ebe9e 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -8,7 +8,7 @@ namespace glm # if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<1, T, Q>::vec() -# ifdef GLM_FORCE_CTOR_INIT +# if GLM_USE_DEFAULTED_FUNCTIONS != GLM_DISABLE : x(0) # endif {} diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index bcd50d09..3ae7135a 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -10,7 +10,7 @@ namespace glm # if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<2, T, Q>::vec() -# ifdef GLM_FORCE_CTOR_INIT +# if GLM_USE_DEFAULTED_FUNCTIONS != GLM_DISABLE : x(0), y(0) # endif {} diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index b01dfe75..29dc1c8a 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -8,7 +8,7 @@ namespace glm # if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<3, T, Q>::vec() -# ifdef GLM_FORCE_CTOR_INIT +# if GLM_USE_DEFAULTED_FUNCTIONS != GLM_DISABLE : x(0), y(0), z(0) # endif {} diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 0422d8c3..7ca1f6db 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -161,7 +161,7 @@ namespace detail # if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<4, T, Q>::vec() -# ifdef GLM_FORCE_CTOR_INIT +# if GLM_USE_DEFAULTED_FUNCTIONS != GLM_DISABLE : x(0), y(0), z(0), w(0) # endif {} @@ -1142,6 +1142,6 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "type_vec4_simd.inl" #endif diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index db0eb3b2..618c895e 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -147,6 +147,7 @@ namespace detail }; # endif +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE template<> struct compute_vec4_div { @@ -157,6 +158,7 @@ namespace detail return Result; } }; +# endif template struct compute_vec4_and @@ -343,6 +345,7 @@ namespace detail }; }//namespace detail +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE template<> GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<4, float, aligned_lowp>::vec(float _s) : data(_mm_set1_ps(_s)) @@ -457,6 +460,7 @@ namespace detail GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 vec<4, float, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x))) {} +#endif// GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE }//namespace glm #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT diff --git a/glm/ext.hpp b/glm/ext.hpp index 5f1ae318..ff02c784 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -31,12 +31,11 @@ #include "./gtc/random.hpp" #include "./gtc/reciprocal.hpp" #include "./gtc/round.hpp" -//#include "./gtc/type_aligned.hpp" #include "./gtc/type_precision.hpp" #include "./gtc/type_ptr.hpp" #include "./gtc/ulp.hpp" #include "./gtc/vec1.hpp" -#if GLM_HAS_ANONYMOUS_STRUCT +#if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE # include "./gtc/type_aligned.hpp" #endif diff --git a/glm/glm.hpp b/glm/glm.hpp index 194415f5..731e97e0 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -98,11 +98,6 @@ #include #include "fwd.hpp" -#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED) -# define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED -# pragma message("GLM: Core library included") -#endif//GLM_MESSAGES - #include "vec2.hpp" #include "vec3.hpp" #include "vec4.hpp" diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 16357786..1b1f4398 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -87,7 +87,7 @@ namespace detail # if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 tquat::tquat() -# ifdef GLM_FORCE_CTOR_INIT +# if GLM_USE_DEFAULTED_FUNCTIONS != GLM_DISABLE : x(0), y(0), z(0), w(1) # endif {} @@ -799,7 +799,7 @@ namespace detail } }//namespace glm -#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT) +#if GLM_USE_SIMD == GLM_ENABLE # include "quaternion_simd.inl" #endif diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index b0dea070..4518df21 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -26,8 +26,8 @@ namespace glm # if GLM_USE_DEFAULTED_FUNCTIONS == GLM_DISABLE template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX11 tdualquat::tdualquat() -# ifdef GLM_FORCE_CTOR_INIT + GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 tdualquat::tdualquat() +# if GLM_USE_DEFAULTED_FUNCTIONS != GLM_DISABLE : real(tquat()) , dual(tquat(0, 0, 0, 0)) # endif diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl index 0ddb8ccf..8e5adcf2 100644 --- a/glm/gtx/intersect.inl +++ b/glm/gtx/intersect.inl @@ -91,33 +91,6 @@ namespace glm return true; } -/* - typename genType::value_type Epsilon = std::numeric_limits::epsilon(); - if(a < Epsilon && a > -Epsilon) - return false; - - typename genType::value_type f = typename genType::value_type(1.0f) / a; - - genType s = orig - v0; - baryPosition.x = f * glm::dot(s, p); - if(baryPosition.x < typename genType::value_type(0.0f)) - return false; - if(baryPosition.x > typename genType::value_type(1.0f)) - return false; - - genType q = glm::cross(s, e1); - baryPosition.y = f * glm::dot(dir, q); - if(baryPosition.y < typename genType::value_type(0.0f)) - return false; - if(baryPosition.y + baryPosition.x > typename genType::value_type(1.0f)) - return false; - - baryPosition.z = f * glm::dot(e2, q); - - return baryPosition.z >= typename genType::value_type(0.0f); - } -*/ - template GLM_FUNC_QUALIFIER bool intersectLineTriangle ( diff --git a/test/bug/bug_ms_vec_static.cpp b/test/bug/bug_ms_vec_static.cpp index 662321a0..3b433716 100644 --- a/test/bug/bug_ms_vec_static.cpp +++ b/test/bug/bug_ms_vec_static.cpp @@ -1,6 +1,6 @@ #include -#if GLM_HAS_ANONYMOUS_STRUCT +#if GLM_USE_ANONYMOUS_STRUCT == GLM_ENABLE struct vec2; struct _swizzle diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index eace0aba..13477a97 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -1,3 +1,7 @@ +glmCreateTestGTC(core_force_aligned_gentypes) +glmCreateTestGTC(core_force_ctor_init) +glmCreateTestGTC(core_force_explicit_ctor) +glmCreateTestGTC(core_force_inline) glmCreateTestGTC(core_force_pure) glmCreateTestGTC(core_force_unrestricted_gentype) glmCreateTestGTC(core_type_aligned) diff --git a/test/core/core_force_aligned_gentypes.cpp b/test/core/core_force_aligned_gentypes.cpp new file mode 100644 index 00000000..068d7efa --- /dev/null +++ b/test/core/core_force_aligned_gentypes.cpp @@ -0,0 +1,12 @@ +#define GLM_FORCE_ALIGNED_GENTYPES + +#include +#include + +int main() +{ + int Error = 0; + + return Error; +} + diff --git a/test/core/core_force_ctor_init.cpp b/test/core/core_force_ctor_init.cpp new file mode 100644 index 00000000..ec47c730 --- /dev/null +++ b/test/core/core_force_ctor_init.cpp @@ -0,0 +1,12 @@ +#define GLM_FORCE_CTOR_INIT + +#include +#include + +int main() +{ + int Error = 0; + + return Error; +} + diff --git a/test/core/core_force_explicit_ctor.cpp b/test/core/core_force_explicit_ctor.cpp new file mode 100644 index 00000000..7af5b79f --- /dev/null +++ b/test/core/core_force_explicit_ctor.cpp @@ -0,0 +1,17 @@ +#define GLM_FORCE_EXPLICIT_CTOR + +#include +#include + +int main() +{ + int Error = 0; + + glm::ivec4 B(1); + Error += B == glm::ivec4(1) ? 0 : 1; + + //glm::vec4 A = B; + + return Error; +} + diff --git a/test/core/core_force_inline.cpp b/test/core/core_force_inline.cpp new file mode 100644 index 00000000..cd23fd98 --- /dev/null +++ b/test/core/core_force_inline.cpp @@ -0,0 +1,12 @@ +#define GLM_FORCE_INLINE + +#include +#include + +int main() +{ + int Error = 0; + + return Error; +} + diff --git a/test/core/core_force_unrestricted_gentype.cpp b/test/core/core_force_unrestricted_gentype.cpp index 46a8b1ed..21d6e520 100644 --- a/test/core/core_force_unrestricted_gentype.cpp +++ b/test/core/core_force_unrestricted_gentype.cpp @@ -1,6 +1,7 @@ #define GLM_FORCE_UNRESTRICTED_GENTYPE #include +#include int main() { diff --git a/test/core/core_func_swizzle.cpp b/test/core/core_func_swizzle.cpp index c3a5fac7..100d39e4 100644 --- a/test/core/core_func_swizzle.cpp +++ b/test/core/core_func_swizzle.cpp @@ -1,4 +1,3 @@ -#define GLM_FORCE_MESSAGES #define GLM_FORCE_SWIZZLE #include diff --git a/test/core/core_setup_message.cpp b/test/core/core_setup_message.cpp index 30eba30d..2908ada3 100644 --- a/test/core/core_setup_message.cpp +++ b/test/core/core_setup_message.cpp @@ -1,4 +1,3 @@ -#define GLM_FORCE_MESSAGES #include #include diff --git a/test/gtc/gtc_type_aligned.cpp b/test/gtc/gtc_type_aligned.cpp index da2dbd2c..41292cda 100644 --- a/test/gtc/gtc_type_aligned.cpp +++ b/test/gtc/gtc_type_aligned.cpp @@ -1,4 +1,3 @@ -#define GLM_FORCE_MESSAGES #define GLM_FORCE_ALIGNED_GENTYPES #include diff --git a/test/gtx/gtx_intersect.cpp b/test/gtx/gtx_intersect.cpp index a637dee8..5a575490 100644 --- a/test/gtx/gtx_intersect.cpp +++ b/test/gtx/gtx_intersect.cpp @@ -24,11 +24,31 @@ int test_intersectRayTriangle() return Error; } +int test_intersectLineTriangle() +{ + int Error = 0; + + glm::vec3 const Orig(0, 0, 2); + glm::vec3 const Dir(0, 0, -1); + glm::vec3 const Vert0(0, 0, 0); + glm::vec3 const Vert1(-1, -1, 0); + glm::vec3 const Vert2(1, -1, 0); + glm::vec3 Position(2.0f, 0.0f, 0.0f); + + bool const Result = glm::intersectLineTriangle(Orig, Dir, Vert0, Vert1, Vert2, Position); + + Error += glm::all(glm::epsilonEqual(Position, glm::vec3(2.0f, 0.0f, 0.0f), std::numeric_limits::epsilon())) ? 0 : 1; + Error += Result ? 0 : 1; + + return Error; +} + int main() { int Error = 0; Error += test_intersectRayTriangle(); + Error += test_intersectLineTriangle(); return Error; } diff --git a/test/gtx/gtx_io.cpp b/test/gtx/gtx_io.cpp index a1b5efa9..ad0b49b3 100644 --- a/test/gtx/gtx_io.cpp +++ b/test/gtx/gtx_io.cpp @@ -20,7 +20,7 @@ namespace case glm::highp: os << "uhi"; break; case glm::mediump: os << "umd"; break; case glm::lowp: os << "ulo"; break; -# if GLM_HAS_ANONYMOUS_STRUCT +# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE case glm::aligned_highp: os << "ahi"; break; case glm::aligned_mediump: os << "amd"; break; case glm::aligned_lowp: os << "alo"; break;