diff --git a/CMakeLists.txt b/CMakeLists.txt index efae933d..ff7f239e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 2.6 FATAL_ERROR) +cmake_policy(VERSION 2.6) +if (NOT CMAKE_VERSION VERSION_LESS "3.1") + cmake_policy(SET CMP0054 NEW) +endif() project(glm) -set(GLM_VERSION "0.9.7") +set(GLM_VERSION "0.9.8") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -27,6 +31,16 @@ if(GLM_BUILD_MANUAL_ENABLE) endif() endif() +option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF) +if(GLM_STATIC_LIBRARY_ENABLE) + message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_STATIC_LIBRARY_ENABLE with ON to build an optional static library") +endif() + +option(GLM_DYNAMIC_LIBRARY_ENABLE "GLM static library" OFF) +if(GLM_DYNAMIC_LIBRARY_ENABLE) + message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_DYNAMIC_LIBRARY_ENABLE with ON to build an optional dynamic library") +endif() + option(GLM_TEST_ENABLE "GLM test" OFF) if(NOT GLM_TEST_ENABLE) message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench") @@ -64,6 +78,12 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") set(CMAKE_CXX_FLAGS "-std=c++98") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # GLM is using GCC 64 bits integer extension + add_definitions(-Wno-long-long) + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_definitions(-Wno-c++11-long-long) + endif() endif() endif() diff --git a/CTestConfig.cmake b/CTestConfig.cmake deleted file mode 100644 index d3388358..00000000 --- a/CTestConfig.cmake +++ /dev/null @@ -1,13 +0,0 @@ -## This file should be placed in the root directory of your project. -## Then modify the CMakeLists.txt file in the root directory of your -## project to incorporate the testing dashboard. -## # The following are required to uses Dart and the Cdash dashboard -## ENABLE_TESTING() -## INCLUDE(CTest) -set(CTEST_PROJECT_NAME "GLM") -set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "my.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=GLM") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt index 8f2f552e..66f81067 100644 --- a/glm/CMakeLists.txt +++ b/glm/CMakeLists.txt @@ -40,5 +40,18 @@ if(GLM_TEST_ENABLE) ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) endif(GLM_TEST_ENABLE) -#add_library(glm STATIC glm.cpp) -#add_library(glm_shared SHARED glm.cpp) +if(GLM_STATIC_LIBRARY_ENABLE) + add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_STATIC_LIBRARY_ENABLE) + +if(GLM_DYNAMIC_LIBRARY_ENABLE) + add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_DYNAMIC_LIBRARY_ENABLE) diff --git a/glm/detail/dummy.cpp b/glm/detail/dummy.cpp index 09a2ae59..4da61968 100644 --- a/glm/detail/dummy.cpp +++ b/glm/detail/dummy.cpp @@ -32,7 +32,7 @@ /// GLM is a header only library. There is nothing to compile. /// dummy.cpp exist only a wordaround for CMake file. /////////////////////////////////////////////////////////////////////////////////// - +/* #define GLM_MESSAGES #include #include @@ -149,6 +149,8 @@ struct intersection glm::vec4 position; glm::vec3 normal; }; +*/ + /* // Sample 4 @@ -191,7 +193,7 @@ glm::vec3 lighting } */ - +/* template class vecType> T normalizeDotA(vecType const & x, vecType const & y) { @@ -211,9 +213,10 @@ typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) { return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); } - +*/ int main() { +/* glm::vec1 o(1); glm::vec2 a(1); glm::vec3 b(1); @@ -227,6 +230,6 @@ int main() float a0 = normalizeDotA(a, a); float b0 = normalizeDotB(b, b); float c0 = normalizeDotC(c, c); - +*/ return 0; } diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 83252de4..2c32626f 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -548,14 +548,16 @@ namespace detail # if GLM_HAS_CXX11_STL return std::isnan(x); -# elif GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL) +# elif GLM_COMPILER & GLM_COMPILER_VC return _isnan(x) != 0; -# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) -# if GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L +# elif GLM_COMPILER & GLM_COMPILER_INTEL +# if GLM_PLATFORM & GLM_PLATFORM_WINDOWS return _isnan(x) != 0; # else - return std::isnan(x); + return ::isnan(x) != 0; # endif +# elif (GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))) && (GLM_PLATFORM & GLM_PLATFORM_ANDROID) && __cplusplus < 201103L + return _isnan(x) != 0; # elif GLM_COMPILER & GLM_COMPILER_CUDA return isnan(x) != 0; # else @@ -583,7 +585,11 @@ namespace detail # if GLM_HAS_CXX11_STL return std::isinf(x); # elif GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC) - return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# else + return ::isinf(x); +# endif # elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L) return _isinf(x) != 0; @@ -662,7 +668,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return std::frexp(x, exp); + return std::frexp(x, &exp); } template @@ -670,7 +676,7 @@ namespace detail { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'frexp' only accept floating-point inputs"); - return tvec1(std::frexp(x.x, exp.x)); + return tvec1(std::frexp(x.x, &exp.x)); } template @@ -706,7 +712,7 @@ namespace detail frexp(x.w, exp.w)); } - template + template GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index 5a9cb11f..56d16d2b 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -72,19 +72,19 @@ namespace detail template struct outerProduct_trait { - typedef tmat2x3 type; + typedef tmat3x2 type; }; template struct outerProduct_trait { - typedef tmat2x4 type; + typedef tmat4x2 type; }; template struct outerProduct_trait { - typedef tmat3x2 type; + typedef tmat2x3 type; }; template @@ -96,19 +96,19 @@ namespace detail template struct outerProduct_trait { - typedef tmat3x4 type; + typedef tmat4x3 type; }; template struct outerProduct_trait { - typedef tmat4x2 type; + typedef tmat2x4 type; }; template struct outerProduct_trait { - typedef tmat4x3 type; + typedef tmat3x4 type; }; template diff --git a/glm/detail/func_trigonometric.inl b/glm/detail/func_trigonometric.inl index 62861a68..e350ba7a 100644 --- a/glm/detail/func_trigonometric.inl +++ b/glm/detail/func_trigonometric.inl @@ -170,7 +170,7 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'asinh' only accept floating-point input"); - return (x < static_cast(0) ? static_cast(-1) : (x > static_cast(0) ? static_cast(1) : static_cast(0))) * log(abs(x) + sqrt(static_cast(1) + x * x)); + return (x < static_cast(0) ? static_cast(-1) : (x > static_cast(0) ? static_cast(1) : static_cast(0))) * log(std::abs(x) + sqrt(static_cast(1) + x * x)); } # endif @@ -210,7 +210,7 @@ namespace glm { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'atanh' only accept floating-point input"); - if(abs(x) >= static_cast(1)) + if(std::abs(x) >= static_cast(1)) return 0; return static_cast(0.5) * log((static_cast(1) + x) / (static_cast(1) - x)); } diff --git a/glm/detail/precision.hpp b/glm/detail/precision.hpp index 32785b94..c657d031 100644 --- a/glm/detail/precision.hpp +++ b/glm/detail/precision.hpp @@ -42,12 +42,4 @@ namespace glm simd, defaultp = highp }; - - template class genType> - struct type - { - static bool const is_vec = false; - static bool const is_mat = false; - static bool const is_quat = false; - }; }//namespace glm diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 2478c3ef..c69852a6 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -62,6 +62,7 @@ #define GLM_PLATFORM_UNIX 0x00400000 #define GLM_PLATFORM_QNXNTO 0x00800000 #define GLM_PLATFORM_WINCE 0x01000000 +#define GLM_PLATFORM_CYGWIN 0x02000000 #ifdef GLM_FORCE_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN @@ -151,6 +152,7 @@ #define GLM_COMPILER_GCC51 0x02000300 #define GLM_COMPILER_GCC52 0x02000400 #define GLM_COMPILER_GCC53 0x02000500 +#define GLM_COMPILER_GCC60 0x02000600 // CUDA #define GLM_COMPILER_CUDA 0x10000000 @@ -201,7 +203,7 @@ # define GLM_COMPILER GLM_COMPILER_INTEL13 # elif __INTEL_COMPILER == 1400 # define GLM_COMPILER GLM_COMPILER_INTEL14 -# elif __INTEL_COMPILER >= 1500 +# elif __INTEL_COMPILER == 1500 # define GLM_COMPILER GLM_COMPILER_INTEL15 # elif __INTEL_COMPILER >= 1600 # define GLM_COMPILER GLM_COMPILER_INTEL16 @@ -312,6 +314,8 @@ # define GLM_COMPILER (GLM_COMPILER_GCC52) # elif (__GNUC__ == 5) && (__GNUC_MINOR__ >= 3) # define GLM_COMPILER (GLM_COMPILER_GCC53) +# elif (__GNUC__ >= 6) +# define GLM_COMPILER (GLM_COMPILER_GCC60) # else # define GLM_COMPILER (GLM_COMPILER_GCC) # endif @@ -371,7 +375,7 @@ /////////////////////////////////////////////////////////////////////////////////// // Platform -// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 +// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 GLM_FORCE_AVX2 #define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_ARM 0x0001 @@ -381,9 +385,12 @@ #define GLM_ARCH_SSE4 0x0010 #define GLM_ARCH_AVX 0x0020 #define GLM_ARCH_AVX2 0x0040 +#define GLM_ARCH_AVX512 0x0080 // Skylake set #if defined(GLM_FORCE_PURE) # define GLM_ARCH GLM_ARCH_PURE +#elif defined(GLM_FORCE_AVX512) +# define GLM_ARCH (GLM_ARCH_AVX512 | GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif defined(GLM_FORCE_AVX2) # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) #elif defined(GLM_FORCE_AVX) @@ -395,13 +402,16 @@ #elif defined(GLM_FORCE_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2) #elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX)) -# if(__AVX2__) +// This is Skylake set of instruction set +# if defined(__AVX512BW__) && defined(__AVX512F__) && defined(__AVX512CD__) && defined(__AVX512VL__) && defined(__AVX512DQ__) +# define GLM_ARCH (GLM_ARCH_AVX512 | GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) +# elif defined(__AVX2__) # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(__AVX__) +# elif defined(__AVX__) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(__SSE3__) +# elif defined(__SSE3__) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) -# elif(__SSE2__) +# elif defined(__SSE2__) # define GLM_ARCH (GLM_ARCH_SSE2) # else # define GLM_ARCH GLM_ARCH_PURE @@ -457,13 +467,6 @@ #endif//GLM_ARCH #if GLM_ARCH & GLM_ARCH_SSE2 # include -# if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround - inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; } - inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; } - inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; } - inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; } - inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; } -# endif #endif//GLM_ARCH #if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED) @@ -581,22 +584,18 @@ # ifdef _MSC_EXTENSIONS # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG # else -# define GLM_MSC_EXT -# endif -# if __INTEL_CXX11_MODE__ -# if __cplusplus >= 201402L -# define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) -# elif __cplusplus >= 201103L -# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) -# else -# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) -# endif +# define GLM_MSC_EXT 0 +# endif +# if __cplusplus >= 201402L +# define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT) +# elif __cplusplus >= 201103L +# define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT) +# elif __INTEL_CXX11_MODE__ +# define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT) +# elif __cplusplus >= 199711L +# define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT) # else -# if __cplusplus >= 199711L -# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) -# else -# define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG) -# endif +# define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT) # endif # else // Unkown compiler # if __cplusplus >= 201402L @@ -805,7 +804,7 @@ # define GLM_HAS_BITSCAN_WINDOWS 0 #else # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ - (GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL)))) + (GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)))) #endif // OpenMP @@ -894,6 +893,39 @@ # endif #endif//GLM_MESSAGE +/////////////////////////////////////////////////////////////////////////////////// +// Clip control + +#ifdef GLM_DEPTH_ZERO_TO_ONE // Legacy 0.9.8 development +# error Define GLM_FORCE_DEPTH_ZERO_TO_ONE instead of GLM_DEPTH_ZERO_TO_ONE to use 0 to 1 clip space. +#endif + +#define GLM_DEPTH_ZERO_TO_ONE 0x00000001 +#define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002 + +#ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE +# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_ZERO_TO_ONE +#else +# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE +#endif + +/////////////////////////////////////////////////////////////////////////////////// +// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM +// to use left handed coordinate system by default. + +#ifdef GLM_LEFT_HANDED // Legacy 0.9.8 development +# error Define GLM_FORCE_LEFT_HANDED instead of GLM_LEFT_HANDED left handed coordinate system by default. +#endif + +#define GLM_LEFT_HANDED 0x00000001 // For DirectX, Metal, Vulkan +#define GLM_RIGHT_HANDED 0x00000002 // For OpenGL, default in GLM + +#ifdef GLM_FORCE_LEFT_HANDED +# define GLM_COORDINATE_SYSTEM GLM_LEFT_HANDED +#else +# define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED +#endif + /////////////////////////////////////////////////////////////////////////////////// // Qualifiers @@ -1008,7 +1040,7 @@ namespace detail } }//namespace glm # define GLM_COUNTOF(arr) glm::countof(arr) -#elif _MSC_VER +#elif defined(_MSC_VER) # define GLM_COUNTOF(arr) _countof(arr) #else # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0]) diff --git a/glm/detail/type_half.inl b/glm/detail/type_half.inl index ff8740c8..b9f9f0ed 100644 --- a/glm/detail/type_half.inl +++ b/glm/detail/type_half.inl @@ -52,12 +52,12 @@ namespace detail i(0) {} - GLM_FUNC_QUALIFIER uif32(float f) : - f(f) + GLM_FUNC_QUALIFIER uif32(float f_) : + f(f_) {} - GLM_FUNC_QUALIFIER uif32(uint32 i) : - i(i) + GLM_FUNC_QUALIFIER uif32(uint32 i_) : + i(i_) {} float f; diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 9df68720..c0a99e35 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -49,22 +49,6 @@ namespace glm typedef tmat2x2 transpose_type; typedef T value_type; - template - friend tvec2 operator/(tmat2x2 const & m, tvec2 const & v); - template - friend tvec2 operator/(tvec2 const & v, tmat2x2 const & m); - -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR length_t cols = 2; - static GLM_RELAXED_CONSTEXPR length_t rows = 2; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif private: col_type value[2]; @@ -77,7 +61,7 @@ namespace glm GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); GLM_FUNC_DECL explicit tmat2x2(ctor); - GLM_FUNC_DECL explicit tmat2x2(T const & x); + GLM_FUNC_DECL explicit tmat2x2(T scalar); GLM_FUNC_DECL tmat2x2( T const & x1, T const & y1, T const & x2, T const & y2); @@ -102,30 +86,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x2 const & m); - GLM_FUNC_DECL explicit tmat2x2(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat2x2(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -169,28 +145,28 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator+(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator+(T scalar, tmat2x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m1, tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x2 operator+(tmat2x2 const & m1, tmat2x2 const & m2); template - GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator-(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator-(T scalar, tmat2x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m1, tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x2 operator-(tmat2x2 const & m1, tmat2x2 const & m2); template - GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator*(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator*(T scalar, tmat2x2 const & m); template GLM_FUNC_DECL typename tmat2x2::col_type operator*(tmat2x2 const & m, typename tmat2x2::row_type const & v); @@ -199,7 +175,7 @@ namespace glm GLM_FUNC_DECL typename tmat2x2::row_type operator*(typename tmat2x2::col_type const & v, tmat2x2 const & m); template - GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m1, tmat2x2 const & m2); + GLM_FUNC_DECL tmat2x2 operator*(tmat2x2 const & m1, tmat2x2 const & m2); template GLM_FUNC_DECL tmat3x2 operator*(tmat2x2 const & m1, tmat3x2 const & m2); @@ -208,10 +184,10 @@ namespace glm GLM_FUNC_DECL tmat4x2 operator*(tmat2x2 const & m1, tmat4x2 const & m2); template - GLM_FUNC_DECL tmat2x2 operator/(tmat2x2 const & m, T const & s); + GLM_FUNC_DECL tmat2x2 operator/(tmat2x2 const & m, T scalar); template - GLM_FUNC_DECL tmat2x2 operator/(T const & s, tmat2x2 const & m); + GLM_FUNC_DECL tmat2x2 operator/(T scalar, tmat2x2 const & m); template GLM_FUNC_DECL typename tmat2x2::col_type operator/(tmat2x2 const & m, typename tmat2x2::row_type const & v); @@ -229,16 +205,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x2 const & m1, tmat2x2 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; } //namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 3f215e3f..db4758fa 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -50,13 +50,6 @@ namespace detail } }//namespace detail -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat2x2 tmat2x2::ZERO(static_cast(0)); - - template - const tmat2x2 tmat2x2::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -92,10 +85,10 @@ namespace detail {} template - GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(T const & s) + GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(T scalar) { - this->value[0] = col_type(s, 0); - this->value[1] = col_type(0, s); + this->value[0] = col_type(scalar, 0); + this->value[1] = col_type(0, scalar); } template @@ -271,10 +264,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator+=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator+=(U scalar) { - this->value[0] += s; - this->value[1] += s; + this->value[0] += scalar; + this->value[1] += scalar; return *this; } @@ -289,10 +282,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator-=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator-=(U scalar) { - this->value[0] -= s; - this->value[1] -= s; + this->value[0] -= scalar; + this->value[1] -= scalar; return *this; } @@ -307,10 +300,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator*=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator*=(U scalar) { - this->value[0] *= s; - this->value[1] *= s; + this->value[0] *= scalar; + this->value[1] *= scalar; return *this; } @@ -323,10 +316,10 @@ namespace detail template template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator/=(U s) + GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator/=(U scalar) { - this->value[0] /= s; - this->value[1] /= s; + this->value[0] /= scalar; + this->value[1] /= scalar; return *this; } @@ -390,19 +383,19 @@ namespace detail // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tmat2x2 operator+(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator+(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] + s, - m[1] + s); + m[0] + scalar, + m[1] + scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator+(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator+(T scalar, tmat2x2 const & m) { return tmat2x2( - m[0] + s, - m[1] + s); + m[0] + scalar, + m[1] + scalar); } template @@ -414,19 +407,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2 operator-(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator-(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] - s, - m[1] - s); + m[0] - scalar, + m[1] - scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator-(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator-(T scalar, tmat2x2 const & m) { return tmat2x2( - s - m[0], - s - m[1]); + scalar - m[0], + scalar - m[1]); } template @@ -438,19 +431,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2 operator*(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator*(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator*(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator*(T scalar, tmat2x2 const & m) { return tmat2x2( - m[0] * s, - m[1] * s); + m[0] * scalar, + m[1] * scalar); } template @@ -514,19 +507,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER tmat2x2 operator/(tmat2x2 const & m, T const & s) + GLM_FUNC_QUALIFIER tmat2x2 operator/(tmat2x2 const & m, T scalar) { return tmat2x2( - m[0] / s, - m[1] / s); + m[0] / scalar, + m[1] / scalar); } template - GLM_FUNC_QUALIFIER tmat2x2 operator/(T const & s, tmat2x2 const & m) + GLM_FUNC_QUALIFIER tmat2x2 operator/(T scalar, tmat2x2 const & m) { return tmat2x2( - s / m[0], - s / m[1]); + scalar / m[0], + scalar / m[1]); } template diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 493548f4..da412319 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -50,18 +50,6 @@ namespace glm typedef tmat3x2 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR length_t cols = 2; - static GLM_RELAXED_CONSTEXPR length_t rows = 3; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - private: col_type value[2]; @@ -99,30 +87,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x3 const & m); - GLM_FUNC_DECL explicit tmat2x3(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat2x3(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -207,16 +187,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x3 const & m1, tmat2x3 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index e7cabb72..76c00f50 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -32,13 +32,6 @@ namespace glm { -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat2x3 tmat2x3::ZERO(static_cast(0)); - - template - const tmat2x3 tmat2x3::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index e15714ca..45dfe142 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -50,18 +50,6 @@ namespace glm typedef tmat4x2 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR length_t cols = 2; - static GLM_RELAXED_CONSTEXPR length_t rows = 4; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - private: col_type value[2]; @@ -101,30 +89,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x4 const & m); - GLM_FUNC_DECL explicit tmat2x4(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat2x4(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -197,10 +177,10 @@ namespace glm GLM_FUNC_DECL tmat3x4 operator*(tmat2x4 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T s); + GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T const & s); template - GLM_FUNC_DECL tmat2x4 operator/(T s, tmat2x4 const & m); + GLM_FUNC_DECL tmat2x4 operator/(T const & s, tmat2x4 const & m); // -- Boolean operators -- @@ -209,16 +189,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat2x4 const & m1, tmat2x4 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 4399e0be..8d6f824e 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -32,13 +32,6 @@ namespace glm { -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat2x4 tmat2x4::ZERO(static_cast(0)); - - template - const tmat2x4 tmat2x4::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -500,7 +493,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T s) + GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T const & s) { return tmat2x4( m[0] / s, @@ -508,7 +501,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(T s, tmat2x4 const & m) + GLM_FUNC_QUALIFIER tmat2x4 operator/(T const & s, tmat2x4 const & m) { return tmat2x4( s / m[0], diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 63e0a659..06922b6b 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -50,18 +50,6 @@ namespace glm typedef tmat2x3 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 3; - static GLM_RELAXED_CONSTEXPR length_t cols = 3; - static GLM_RELAXED_CONSTEXPR length_t rows = 2; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - private: col_type value[3]; @@ -106,30 +94,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x2 const & m); - GLM_FUNC_DECL explicit tmat3x2(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat3x2(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -215,15 +195,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x2 const & m1, tmat3x2 const & m2); - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 24079cfe..f497e395 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -32,13 +32,6 @@ namespace glm { -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat3x2 tmat3x2::ZERO(static_cast(0)); - - template - const tmat3x2 tmat3x2::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 799d645d..3b90536b 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -49,23 +49,6 @@ namespace glm typedef tmat3x3 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 3; - static GLM_RELAXED_CONSTEXPR length_t cols = 3; - static GLM_RELAXED_CONSTEXPR length_t rows = 3; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - - template - friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); - template - friend tvec3 operator/(tvec3 const & v, tmat3x3 const & m); - private: col_type value[3]; @@ -110,30 +93,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x3 const & m); - GLM_FUNC_DECL explicit tmat3x3(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat3x3(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -237,16 +212,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x3 const & m1, tmat3x3 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index c3b07108..9ee0111e 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -56,14 +56,6 @@ namespace detail } }//namespace detail -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat3x3 tmat3x3::ZERO(static_cast(0)); - - template - const tmat3x3 tmat3x3::IDENTITY(static_cast(1)); -# endif - // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 7453673b..445340ec 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -50,18 +50,6 @@ namespace glm typedef tmat4x3 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 3; - static GLM_RELAXED_CONSTEXPR length_t cols = 3; - static GLM_RELAXED_CONSTEXPR length_t rows = 4; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - private: col_type value[3]; @@ -106,30 +94,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x4 const & m); - GLM_FUNC_DECL explicit tmat3x4(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat3x4(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -214,16 +194,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat3x4 const & m1, tmat3x4 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index dd1f0563..3991d95d 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -32,13 +32,6 @@ namespace glm { -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat3x4 tmat3x4::ZERO(static_cast(0)); - - template - const tmat3x4 tmat3x4::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 8cb7d70e..ad66ed19 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -50,18 +50,6 @@ namespace glm typedef tmat2x4 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR length_t cols = 4; - static GLM_RELAXED_CONSTEXPR length_t rows = 2; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - private: col_type value[4]; @@ -111,30 +99,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x2 const & m); - GLM_FUNC_DECL explicit tmat4x2(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat4x3 const & x); - GLM_FUNC_DECL explicit tmat4x2(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x4 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -197,15 +177,15 @@ namespace glm template GLM_FUNC_DECL typename tmat4x2::row_type operator*(typename tmat4x2::col_type const & v, tmat4x2 const & m); + template + GLM_FUNC_DECL tmat2x2 operator*(tmat4x2 const & m1, tmat2x4 const & m2); + template GLM_FUNC_DECL tmat3x2 operator*(tmat4x2 const & m1, tmat3x4 const & m2); template GLM_FUNC_DECL tmat4x2 operator*(tmat4x2 const & m1, tmat4x4 const & m2); - template - GLM_FUNC_DECL tmat2x3 operator*(tmat4x3 const & m1, tmat2x4 const & m2); - template GLM_FUNC_DECL tmat4x2 operator/(tmat4x2 const & m, T const & s); @@ -219,16 +199,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x2 const & m1, tmat4x2 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 0a5de95b..22d772c2 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -50,18 +50,6 @@ namespace glm typedef tmat3x4 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR length_t cols = 4; - static GLM_RELAXED_CONSTEXPR length_t rows = 3; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - private: col_type value[4]; @@ -111,30 +99,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x3 const & m); - GLM_FUNC_DECL explicit tmat4x3(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat4x4 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat4x3(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x4 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -219,16 +199,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x3 const & m1, tmat4x3 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index 58eeb6f9..c2979782 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -32,13 +32,6 @@ namespace glm { -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat4x3 tmat4x3::ZERO(static_cast(0)); - - template - const tmat4x3 tmat4x3::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index a90a5978..c210f396 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -49,23 +49,6 @@ namespace glm typedef tmat4x4 transpose_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR length_t cols = 4; - static GLM_RELAXED_CONSTEXPR length_t rows = 4; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - - template - friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); - template - friend tvec4 operator/(tvec4 const & v, tmat4x4 const & m); - private: col_type value[4]; @@ -115,30 +98,22 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x4 const & m); - GLM_FUNC_DECL explicit tmat4x4(tmat2x2 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat3x3 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat2x3 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat3x2 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat2x4 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat4x2 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat3x4 const & x); - GLM_FUNC_DECL explicit tmat4x4(tmat4x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x3 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x2 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x4 const & x); + GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x3 const & x); // -- Accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const; + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL col_type & operator[](size_type i); - GLM_FUNC_DECL col_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL col_type & operator[](length_type i); - GLM_FUNC_DECL col_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL col_type & operator[](length_type i); + GLM_FUNC_DECL col_type const & operator[](length_type i) const; // -- Unary arithmetic operators -- @@ -230,7 +205,7 @@ namespace glm GLM_FUNC_DECL typename tmat4x4::col_type operator/(tmat4x4 const & m, typename tmat4x4::row_type const & v); template - GLM_FUNC_DECL typename tmat4x4::row_type operator/(typename tmat4x4::col_type & v, tmat4x4 const & m); + GLM_FUNC_DECL typename tmat4x4::row_type operator/(typename tmat4x4::col_type const & v, tmat4x4 const & m); template GLM_FUNC_DECL tmat4x4 operator/(tmat4x4 const & m1, tmat4x4 const & m2); @@ -242,16 +217,6 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tmat4x4 const & m1, tmat4x4 const & m2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = true; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index acfa318c..319325a7 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -92,13 +92,6 @@ namespace detail } }//namespace detail -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tmat4x4 tmat4x4::ZERO(static_cast(0)); - - template - const tmat4x4 tmat4x4::IDENTITY(static_cast(1)); -# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 833468d8..c9708111 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -54,15 +54,6 @@ namespace glm typedef tvec1 bool_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 1; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type X; -# endif // -- Data -- # if GLM_HAS_ANONYMOUS_UNION @@ -94,21 +85,12 @@ namespace glm // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - /// Return the count of components of the vector - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const; + /// Return the count of components of the vector + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL T & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; -# else - /// Return the count of components of the vector - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL T & operator[](length_type i); - GLM_FUNC_DECL T const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL T & operator[](length_type i); + GLM_FUNC_DECL T const & operator[](length_type i) const; // -- Implicit basic constructors -- @@ -120,19 +102,19 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tvec1(ctor); - GLM_FUNC_DECL explicit tvec1(T const & scalar); + GLM_FUNC_DECL explicit tvec1(T scalar); // -- Conversion vector constructors -- /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec1(tvec2 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec2 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec1(tvec3 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec3 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec1(tvec4 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -155,19 +137,19 @@ namespace glm template GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator+=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator+=(U scalar); template GLM_FUNC_DECL tvec1 & operator+=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator-=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator-=(U scalar); template GLM_FUNC_DECL tvec1 & operator-=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator*=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator*=(U scalar); template GLM_FUNC_DECL tvec1 & operator*=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator/=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator/=(U scalar); template GLM_FUNC_DECL tvec1 & operator/=(tvec1 const & v); @@ -181,27 +163,27 @@ namespace glm // -- Unary bit operators -- template - GLM_FUNC_DECL tvec1 & operator%=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator%=(U scalar); template GLM_FUNC_DECL tvec1 & operator%=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator&=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator&=(U scalar); template GLM_FUNC_DECL tvec1 & operator&=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator|=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator|=(U scalar); template GLM_FUNC_DECL tvec1 & operator|=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator^=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator^=(U scalar); template GLM_FUNC_DECL tvec1 & operator^=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator<<=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator<<=(U scalar); template GLM_FUNC_DECL tvec1 & operator<<=(tvec1 const & v); template - GLM_FUNC_DECL tvec1 & operator>>=(U const & scalar); + GLM_FUNC_DECL tvec1 & operator>>=(U scalar); template GLM_FUNC_DECL tvec1 & operator>>=(tvec1 const & v); }; @@ -217,91 +199,91 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tvec1 operator+(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator+(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator+(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator+(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator+(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator-(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator-(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator-(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator-(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator- (tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator*(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator*(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator*(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator*(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator*(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator/(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator/(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator/(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator/(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator/(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator%(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator%(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator%(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator%(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator%(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator&(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator&(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator&(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator&(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator&(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator|(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator|(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator|(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator|(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator|(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator^(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator^(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator^(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator^(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator^(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator<<(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator<<(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator<<(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator<<(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator<<(tvec1 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec1 operator>>(tvec1 const & v, T const & scalar); + GLM_FUNC_DECL tvec1 operator>>(tvec1 const & v, T scalar); template - GLM_FUNC_DECL tvec1 operator>>(T const & scalar, tvec1 const & v); + GLM_FUNC_DECL tvec1 operator>>(T scalar, tvec1 const & v); template GLM_FUNC_DECL tvec1 operator>>(tvec1 const & v1, tvec1 const & v2); @@ -322,16 +304,6 @@ namespace glm template GLM_FUNC_DECL tvec1 operator||(tvec1 const & v1, tvec1 const & v2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = true; - static bool const is_mat = false; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 9d397d64..5b4fa422 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -32,13 +32,6 @@ namespace glm { -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tvec1 tvec1::X(static_cast(1)); - - template - const tvec1 tvec1::ZERO(static_cast(0)); -# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -70,7 +63,7 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec1::tvec1(T const & scalar) + GLM_FUNC_QUALIFIER tvec1::tvec1(T scalar) : x(scalar) {} @@ -102,47 +95,25 @@ namespace glm // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1::size_type tvec1::size() const - { - return 1; - } + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1::length_type tvec1::length() const + { + return 1; + } - template - GLM_FUNC_QUALIFIER T & tvec1::operator[](typename tvec1::size_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER T & tvec1::operator[](typename tvec1::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER T const & tvec1::operator[](typename tvec1::size_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1::length_type tvec1::length() const - { - return 1; - } - - template - GLM_FUNC_QUALIFIER T & tvec1::operator[](typename tvec1::length_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec1::operator[](typename tvec1::length_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# endif//GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER T const & tvec1::operator[](typename tvec1::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } // -- Unary arithmetic operators -- @@ -165,7 +136,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator+=(U scalar) { this->x += static_cast(scalar); return *this; @@ -181,7 +152,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator-=(U scalar) { this->x -= static_cast(scalar); return *this; @@ -197,7 +168,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator*=(U scalar) { this->x *= static_cast(scalar); return *this; @@ -213,7 +184,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator/=(U scalar) { this->x /= static_cast(scalar); return *this; @@ -263,7 +234,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator%=(U scalar) { this->x %= static_cast(scalar); return *this; @@ -279,7 +250,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator&=(U scalar) { this->x &= static_cast(scalar); return *this; @@ -295,7 +266,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator|=(U scalar) { this->x |= static_cast(scalar); return *this; @@ -311,7 +282,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator^=(U scalar) { this->x ^= static_cast(scalar); return *this; @@ -327,7 +298,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator<<=(U scalar) { this->x <<= static_cast(scalar); return *this; @@ -343,7 +314,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>=(U const & scalar) + GLM_FUNC_QUALIFIER tvec1 & tvec1::operator>>=(U scalar) { this->x >>= static_cast(scalar); return *this; @@ -375,14 +346,14 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec1 operator+(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator+(tvec1 const & v, T scalar) { return tvec1( v.x + scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator+(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator+(T scalar, tvec1 const & v) { return tvec1( scalar + v.x); @@ -397,14 +368,14 @@ namespace glm //operator- template - GLM_FUNC_QUALIFIER tvec1 operator-(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator-(tvec1 const & v, T scalar) { return tvec1( v.x - scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator-(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator-(T scalar, tvec1 const & v) { return tvec1( scalar - v.x); @@ -418,14 +389,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator*(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator*(tvec1 const & v, T scalar) { return tvec1( v.x * scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator*(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator*(T scalar, tvec1 const & v) { return tvec1( scalar * v.x); @@ -439,14 +410,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator/(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator/(tvec1 const & v, T scalar) { return tvec1( v.x / scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator/(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator/(T scalar, tvec1 const & v) { return tvec1( scalar / v.x); @@ -462,14 +433,14 @@ namespace glm // -- Binary bit operators -- template - GLM_FUNC_QUALIFIER tvec1 operator%(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator%(tvec1 const & v, T scalar) { return tvec1( v.x % scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator%(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator%(T scalar, tvec1 const & v) { return tvec1( scalar % v.x); @@ -483,14 +454,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator&(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator&(tvec1 const & v, T scalar) { return tvec1( v.x & scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator&(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator&(T scalar, tvec1 const & v) { return tvec1( scalar & v.x); @@ -504,14 +475,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator|(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator|(tvec1 const & v, T scalar) { return tvec1( v.x | scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator|(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator|(T scalar, tvec1 const & v) { return tvec1( scalar | v.x); @@ -525,14 +496,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator^(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator^(tvec1 const & v, T scalar) { return tvec1( v.x ^ scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator^(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator^(T scalar, tvec1 const & v) { return tvec1( scalar ^ v.x); @@ -546,14 +517,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator<<(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator<<(tvec1 const & v, T scalar) { return tvec1( v.x << scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator<<(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator<<(T scalar, tvec1 const & v) { return tvec1( scalar << v.x); @@ -567,14 +538,14 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec1 operator>>(tvec1 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec1 operator>>(tvec1 const & v, T scalar) { return tvec1( v.x >> scalar); } template - GLM_FUNC_QUALIFIER tvec1 operator>>(T const & scalar, tvec1 const & v) + GLM_FUNC_QUALIFIER tvec1 operator>>(T scalar, tvec1 const & v) { return tvec1( scalar >> v.x); diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 1d857ac7..4d9b8c70 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -49,21 +49,9 @@ namespace glm { // -- Implementation detail -- + typedef T value_type; typedef tvec2 type; typedef tvec2 bool_type; - typedef T value_type; - -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type X; - static const type Y; - static const type XY; -# endif // -- Data -- @@ -97,21 +85,12 @@ namespace glm // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - /// Return the count of components of the vector - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const; + /// Return the count of components of the vector + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL T & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; -# else - /// Return the count of components of the vector - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL T & operator[](length_type i); - GLM_FUNC_DECL T const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL T & operator[](length_type i); + GLM_FUNC_DECL T const & operator[](length_type i) const; // -- Implicit basic constructors -- @@ -123,14 +102,14 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tvec2(ctor); - GLM_FUNC_DECL explicit tvec2(T const & scalar); - GLM_FUNC_DECL tvec2(T const & s1, T const & s2); + GLM_FUNC_DECL explicit tvec2(T scalar); + GLM_FUNC_DECL tvec2(T s1, T s2); // -- Conversion constructors -- /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec2(A const & x, B const & y); + GLM_FUNC_DECL tvec2(A x, B y); template GLM_FUNC_DECL tvec2(tvec1 const & v1, tvec1 const & v2); @@ -138,10 +117,10 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec2(tvec3 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec3 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec2(tvec4 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -246,13 +225,13 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tvec2 operator+(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator+(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator+(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator+(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator+(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator+(tvec1 const & v1, tvec2 const & v2); @@ -261,13 +240,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator+(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator-(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator-(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator-(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator-(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator-(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator-(tvec1 const & v1, tvec2 const & v2); @@ -276,13 +255,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator-(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator*(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator*(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator*(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator*(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator*(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator*(tvec1 const & v1, tvec2 const & v2); @@ -291,13 +270,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator*(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator/(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator/(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator/(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator/(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator/(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator/(tvec1 const & v1, tvec2 const & v2); @@ -306,16 +285,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator/(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator-(tvec2 const & v); - - template - GLM_FUNC_DECL tvec2 operator%(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator%(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator%(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator%(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator%(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator%(tvec1 const & v1, tvec2 const & v2); @@ -324,13 +300,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator%(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator&(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator&(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator&(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator&(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator&(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator&(tvec1 const & v1, tvec2 const & v2); @@ -339,13 +315,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator&(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator|(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator|(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator|(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator|(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator|(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator|(tvec1 const & v1, tvec2 const & v2); @@ -354,13 +330,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator|(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator^(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator^(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator^(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator^(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator^(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator^(tvec1 const & v1, tvec2 const & v2); @@ -369,13 +345,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator^(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator<<(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator<<(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator<<(tvec1 const & v1, tvec2 const & v2); @@ -384,13 +360,13 @@ namespace glm GLM_FUNC_DECL tvec2 operator<<(tvec2 const & v1, tvec2 const & v2); template - GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v, T const & scalar); + GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v, T scalar); template GLM_FUNC_DECL tvec2 operator>>(tvec2 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec2 operator>>(T const & scalar, tvec2 const & v); + GLM_FUNC_DECL tvec2 operator>>(T scalar, tvec2 const & v); template GLM_FUNC_DECL tvec2 operator>>(tvec1 const & v1, tvec2 const & v2); @@ -414,16 +390,6 @@ namespace glm template GLM_FUNC_DECL tvec2 operator||(tvec2 const & v1, tvec2 const & v2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = true; - static bool const is_mat = false; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index dfb3a33a..f23563f5 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -72,12 +72,12 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec2::tvec2(T const & scalar) + GLM_FUNC_QUALIFIER tvec2::tvec2(T scalar) : x(scalar), y(scalar) {} template - GLM_FUNC_QUALIFIER tvec2::tvec2(T const & s1, T const & s2) + GLM_FUNC_QUALIFIER tvec2::tvec2(T s1, T s2) : x(s1), y(s2) {} @@ -85,7 +85,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec2::tvec2(A const & a, B const & b) + GLM_FUNC_QUALIFIER tvec2::tvec2(A a, B b) : x(static_cast(a)) , y(static_cast(b)) {} @@ -510,7 +510,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator+(tvec2 const & v, T scalar) { return tvec2( v.x + scalar, @@ -526,7 +526,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator+(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator+(T scalar, tvec2 const & v) { return tvec2( scalar + v.x, @@ -550,7 +550,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator-(tvec2 const & v, T scalar) { return tvec2( v.x - scalar, @@ -566,7 +566,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator-(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator-(T scalar, tvec2 const & v) { return tvec2( scalar - v.x, @@ -590,11 +590,11 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v1, T const & v2) + GLM_FUNC_QUALIFIER tvec2 operator*(tvec2 const & v, T scalar) { return tvec2( - v1.x * v2, - v1.y * v2); + v.x * scalar, + v.y * scalar); } template @@ -606,7 +606,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator*(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator*(T scalar, tvec2 const & v) { return tvec2( scalar * v.x, @@ -630,7 +630,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator/(tvec2 const & v, T scalar) { return tvec2( v.x / scalar, @@ -646,7 +646,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator/(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator/(T scalar, tvec2 const & v) { return tvec2( scalar / v.x, @@ -672,7 +672,7 @@ namespace glm // -- Binary bit operators -- template - GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator%(tvec2 const & v, T scalar) { return tvec2( v.x % scalar, @@ -688,7 +688,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator%(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator%(T scalar, tvec2 const & v) { return tvec2( scalar % v.x, @@ -712,7 +712,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator&(tvec2 const & v, T scalar) { return tvec2( v.x & scalar, @@ -728,7 +728,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator&(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator&(T scalar, tvec2 const & v) { return tvec2( scalar & v.x, @@ -752,7 +752,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator|(tvec2 const & v, T scalar) { return tvec2( v.x | scalar, @@ -768,7 +768,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator|(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator|(T scalar, tvec2 const & v) { return tvec2( scalar | v.x, @@ -792,7 +792,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator^(tvec2 const & v, T scalar) { return tvec2( v.x ^ scalar, @@ -808,7 +808,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator^(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator^(T scalar, tvec2 const & v) { return tvec2( scalar ^ v.x, @@ -832,7 +832,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator<<(tvec2 const & v, T scalar) { return tvec2( v.x << scalar, @@ -848,7 +848,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator<<(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator<<(T scalar, tvec2 const & v) { return tvec2( scalar << v.x, @@ -872,7 +872,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec2 operator>>(tvec2 const & v, T scalar) { return tvec2( v.x >> scalar, @@ -888,7 +888,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec2 operator>>(T const & scalar, tvec2 const & v) + GLM_FUNC_QUALIFIER tvec2 operator>>(T scalar, tvec2 const & v) { return tvec2( scalar >> v.x, diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index d4d8ff6a..8280a219 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -53,22 +53,6 @@ namespace glm typedef tvec3 bool_type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 3; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type X; - static const type Y; - static const type Z; - static const type XY; - static const type XZ; - static const type YZ; - static const type XYZ; -# endif - // -- Data -- # if GLM_HAS_ANONYMOUS_UNION @@ -102,21 +86,12 @@ namespace glm // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - /// Return the count of components of the vector - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const; + /// Return the count of components of the vector + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL T & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; -# else - /// Return the count of components of the vector - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL T & operator[](length_type i); - GLM_FUNC_DECL T const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL T & operator[](length_type i); + GLM_FUNC_DECL T const & operator[](length_type i) const; // -- Implicit basic constructors -- @@ -128,14 +103,14 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tvec3(ctor); - GLM_FUNC_DECL explicit tvec3(T const & scalar); - GLM_FUNC_DECL tvec3(T const & a, T const & b, T const & c); + GLM_FUNC_DECL explicit tvec3(T scalar); + GLM_FUNC_DECL tvec3(T a, T b, T c); // -- Conversion scalar constructors -- /// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL tvec3(A const & a, B const & b, C const & c); + GLM_FUNC_DECL tvec3(A a, B b, C c); template GLM_FUNC_DECL tvec3(tvec1 const & a, tvec1 const & b, tvec1 const & c); @@ -143,19 +118,19 @@ namespace glm /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec2 const & a, B const & b); + GLM_FUNC_DECL tvec3(tvec2 const & a, B b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec2 const & a, tvec1 const & b); + GLM_FUNC_DECL tvec3(tvec2 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(A const & a, tvec2 const & b); + GLM_FUNC_DECL tvec3(A a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec1 const & a, tvec2 const & b); + GLM_FUNC_DECL tvec3(tvec1 const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec4 const & v); + GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec4 const & v); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -272,151 +247,151 @@ namespace glm // -- Binary operators -- template - GLM_FUNC_DECL tvec3 operator+(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator+(tvec3 const & v, T scalar); template GLM_FUNC_DECL tvec3 operator+(tvec3 const & v, tvec1 const & scalar); template - GLM_FUNC_DECL tvec3 operator+(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator+(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator+(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator+(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator+(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator-(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator-(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator-(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator-(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator-(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator-(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator-(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator-(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator-(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator*(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator*(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator*(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator*(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator*(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator*(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator/(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator/(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator/(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator/(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator/(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator/(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator/(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator/(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator/(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator%(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator%(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator%(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator%(tvec3 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec3 operator%(T const & scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator%(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator%(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator%(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator&(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator&(tvec3 const & v1, T scalar); template - GLM_FUNC_DECL tvec3 operator&(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator&(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator&(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator&(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator&(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator&(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator&(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator|(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator|(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator|(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator|(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator|(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator|(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator|(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator|(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator|(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator^(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator^(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator^(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator^(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator^(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator^(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator^(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator^(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator^(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator<<(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator<<(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator<<(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator<<(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator<<(tvec3 const & v1, tvec3 const & v2); template - GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v, T const & scalar); + GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v, T scalar); template - GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v1, tvec1 const & v2); template - GLM_FUNC_DECL tvec3 operator>>(T const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator>>(T scalar, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator>>(tvec1 const & scalar, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator>>(tvec1 const & v1, tvec3 const & v2); template GLM_FUNC_DECL tvec3 operator>>(tvec3 const & v1, tvec3 const & v2); @@ -437,16 +412,6 @@ namespace glm template GLM_FUNC_DECL tvec3 operator||(tvec3 const & v1, tvec3 const & v2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = true; - static bool const is_mat = false; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 38104a3a..f8e95a30 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -89,12 +89,12 @@ namespace glm {} template - GLM_FUNC_QUALIFIER tvec3::tvec3(T const & scalar) + GLM_FUNC_QUALIFIER tvec3::tvec3(T scalar) : x(scalar), y(scalar), z(scalar) {} template - GLM_FUNC_QUALIFIER tvec3::tvec3(T const & a, T const & b, T const & c) + GLM_FUNC_QUALIFIER tvec3::tvec3(T a, T b, T c) : x(a), y(b), z(c) {} @@ -102,7 +102,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec3::tvec3(A const & a, B const & b, C const & c) : + GLM_FUNC_QUALIFIER tvec3::tvec3(A a, B b, C c) : x(static_cast(a)), y(static_cast(b)), z(static_cast(c)) @@ -120,7 +120,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec3::tvec3(tvec2 const & a, B const & b) : + GLM_FUNC_QUALIFIER tvec3::tvec3(tvec2 const & a, B b) : x(static_cast(a.x)), y(static_cast(a.y)), z(static_cast(b)) @@ -136,7 +136,7 @@ namespace glm template template - GLM_FUNC_QUALIFIER tvec3::tvec3(A const & a, tvec2 const & b) : + GLM_FUNC_QUALIFIER tvec3::tvec3(A a, tvec2 const & b) : x(static_cast(a)), y(static_cast(b.x)), z(static_cast(b.y)) @@ -591,7 +591,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec3 operator+(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator+(tvec3 const & v, T scalar) { return tvec3( v.x + scalar, @@ -609,7 +609,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator+(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator+(T scalar, tvec3 const & v) { return tvec3( scalar + v.x, @@ -636,7 +636,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator-(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator-(tvec3 const & v, T scalar) { return tvec3( v.x - scalar, @@ -654,7 +654,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator-(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator-(T scalar, tvec3 const & v) { return tvec3( scalar - v.x, @@ -681,7 +681,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator*(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator*(tvec3 const & v, T scalar) { return tvec3( v.x * scalar, @@ -699,7 +699,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator*(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator*(T scalar, tvec3 const & v) { return tvec3( scalar * v.x, @@ -726,7 +726,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator/(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator/(tvec3 const & v, T scalar) { return tvec3( v.x / scalar, @@ -744,7 +744,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator/(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator/(T scalar, tvec3 const & v) { return tvec3( scalar / v.x, @@ -773,7 +773,7 @@ namespace glm // -- Binary bit operators -- template - GLM_FUNC_QUALIFIER tvec3 operator%(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator%(tvec3 const & v, T scalar) { return tvec3( v.x % scalar, @@ -791,7 +791,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator%(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator%(T scalar, tvec3 const & v) { return tvec3( scalar % v.x, @@ -818,7 +818,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator&(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator&(tvec3 const & v, T scalar) { return tvec3( v.x & scalar, @@ -836,7 +836,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator&(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator&(T scalar, tvec3 const & v) { return tvec3( scalar & v.x, @@ -863,7 +863,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator|(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator|(tvec3 const & v, T scalar) { return tvec3( v.x | scalar, @@ -881,7 +881,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator|(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator|(T scalar, tvec3 const & v) { return tvec3( scalar | v.x, @@ -908,7 +908,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator^(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator^(tvec3 const & v, T scalar) { return tvec3( v.x ^ scalar, @@ -926,7 +926,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator^(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator^(T scalar, tvec3 const & v) { return tvec3( scalar ^ v.x, @@ -953,7 +953,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator<<(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator<<(tvec3 const & v, T scalar) { return tvec3( v.x << scalar, @@ -971,7 +971,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator<<(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator<<(T scalar, tvec3 const & v) { return tvec3( scalar << v.x, @@ -998,7 +998,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator>>(tvec3 const & v, T const & scalar) + GLM_FUNC_QUALIFIER tvec3 operator>>(tvec3 const & v, T scalar) { return tvec3( v.x >> scalar, @@ -1016,7 +1016,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec3 operator>>(T const & scalar, tvec3 const & v) + GLM_FUNC_QUALIFIER tvec3 operator>>(T scalar, tvec3 const & v) { return tvec3( scalar >> v.x, diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index f26350c6..624bcf8f 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -103,33 +103,9 @@ namespace detail { // -- Implementation detail -- + typedef T value_type; typedef tvec4 type; typedef tvec4 bool_type; - typedef T value_type; - -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type X; - static const type Y; - static const type Z; - static const type W; - static const type XY; - static const type XZ; - static const type XW; - static const type YZ; - static const type YW; - static const type ZW; - static const type XYZ; - static const type XYW; - static const type XZW; - static const type YZW; - static const type XYZW; -# endif // -- Data -- @@ -167,21 +143,12 @@ namespace detail // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - /// Return the count of components of the vector - typedef size_t size_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const; + /// Return the count of components of the vector + typedef length_t length_type; + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL T & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; -# else - /// Return the count of components of the vector - typedef length_t length_type; - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL T & operator[](length_type i); - GLM_FUNC_DECL T const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL T & operator[](length_type i); + GLM_FUNC_DECL T const & operator[](length_type i) const; // -- Implicit basic constructors -- @@ -208,37 +175,37 @@ namespace detail /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec2 const & a, B b, C c); + GLM_FUNC_DECL tvec4(tvec2 const & a, B b, C c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c); + GLM_FUNC_DECL tvec4(tvec2 const & a, tvec1 const & b, tvec1 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(A a, tvec2 const & b, C c); + GLM_FUNC_DECL tvec4(A a, tvec2 const & b, C c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c); + GLM_FUNC_DECL tvec4(tvec1 const & a, tvec2 const & b, tvec1 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(A a, B b, tvec2 const & c); + GLM_FUNC_DECL tvec4(A a, B b, tvec2 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c); + GLM_FUNC_DECL tvec4(tvec1 const & a, tvec1 const & b, tvec2 const & c); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec3 const & a, B b); + GLM_FUNC_DECL tvec4(tvec3 const & a, B b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec3 const & a, tvec1 const & b); + GLM_FUNC_DECL tvec4(tvec3 const & a, tvec1 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(A a, tvec3 const & b); + GLM_FUNC_DECL tvec4(A a, tvec3 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec1 const & a, tvec3 const & b); + GLM_FUNC_DECL tvec4(tvec1 const & a, tvec3 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec4(tvec2 const & a, tvec2 const & b); + GLM_FUNC_DECL tvec4(tvec2 const & a, tvec2 const & b); /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template @@ -382,13 +349,13 @@ namespace detail GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, T scalar); template - GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec4 operator+(T scalar, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator+(tvec1 const & scalar, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator+(tvec1 const & v1, tvec4 const & v2); template GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec4 const & v2); @@ -397,13 +364,13 @@ namespace detail GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, T scalar); template - GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec4 operator-(tvec4 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec4 operator-(T scalar, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator-(tvec1 const & scalar, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator-(tvec1 const & v1, tvec4 const & v2); template GLM_FUNC_DECL tvec4 operator-(tvec4 const & v1, tvec4 const & v2); @@ -412,13 +379,13 @@ namespace detail GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, T scalar); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec4 operator*(T scalar, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator*(tvec1 const & scalar, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator*(tvec1 const & v1, tvec4 const & v2); template GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec4 const & v2); @@ -427,23 +394,17 @@ namespace detail GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, T scalar); template - GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, tvec1 const & scalar); + GLM_FUNC_DECL tvec4 operator/(tvec4 const & v1, tvec1 const & v2); template GLM_FUNC_DECL tvec4 operator/(T scalar, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator/(tvec1 const & scalar, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator/(tvec1 const & v1, tvec4 const & v2); template GLM_FUNC_DECL tvec4 operator/(tvec4 const & v1, tvec4 const & v2); - template - GLM_FUNC_DECL bool operator==(tvec4 const & v1, tvec4 const & v2); - - template - GLM_FUNC_DECL bool operator!=(tvec4 const & v1, tvec4 const & v2); - template GLM_FUNC_DECL tvec4 operator%(tvec4 const & v, T scalar); @@ -550,16 +511,6 @@ namespace detail template GLM_FUNC_DECL tvec4 operator||(tvec4 const & v1, tvec4 const & v2); - - // -- Is type -- - - template - struct type - { - static bool const is_vec = true; - static bool const is_mat = false; - static bool const is_quat = false; - }; }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index a650e494..29b78bf5 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -32,72 +32,6 @@ namespace glm { - -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tvec4 tvec4::ZERO - (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); - - template - const tvec4 tvec4::X - (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); - - template - const tvec4 tvec4::Y - (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); - - template - const tvec4 tvec4::Z - (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); - - template - const tvec4 tvec4::W - (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); - - template - const tvec4 tvec4::XY - (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); - - template - const tvec4 tvec4::XZ - (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); - - template - const tvec4 tvec4::XW - (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); - - template - const tvec4 tvec4::YZ - (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); - - template - const tvec4 tvec4::YW - (static_cast(0), static_cast(1), static_cast(0), static_cast(1)); - - template - const tvec4 tvec4::ZW - (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); - - template - const tvec4 tvec4::XYZ - (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); - - template - const tvec4 tvec4::XYW - (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); - - template - const tvec4 tvec4::XZW - (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); - - template - const tvec4 tvec4::YZW - (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); - - template - const tvec4 tvec4::XYZW - (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); -# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) @@ -270,47 +204,25 @@ namespace glm // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4::size_type tvec4::size() const - { - return 4; - } + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4::length_type tvec4::length() const + { + return 4; + } - template - GLM_FUNC_QUALIFIER T & tvec4::operator[](typename tvec4::size_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER T & tvec4::operator[](typename tvec4::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER T const & tvec4::operator[](typename tvec4::size_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4::length_type tvec4::length() const - { - return 4; - } - - template - GLM_FUNC_QUALIFIER T & tvec4::operator[](typename tvec4::length_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tvec4::operator[](typename tvec4::length_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# endif//GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER T const & tvec4::operator[](typename tvec4::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } // -- Unary arithmetic operators -- @@ -739,6 +651,16 @@ namespace glm v.w + scalar); } + template + GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v1, tvec1 const & v2) + { + return tvec4( + v1.x + v2.x, + v1.y + v2.x, + v1.z + v2.x, + v1.w + v2.x); + } + template GLM_FUNC_QUALIFIER tvec4 operator+(T scalar, tvec4 const & v) { @@ -749,6 +671,16 @@ namespace glm scalar + v.w); } + template + GLM_FUNC_QUALIFIER tvec4 operator+(tvec1 const & v1, tvec4 const & v2) + { + return tvec4( + v1.x + v2.x, + v1.x + v2.y, + v1.x + v2.z, + v1.x + v2.w); + } + template GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v1, tvec4 const & v2) { @@ -769,6 +701,16 @@ namespace glm v.w - scalar); } + template + GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v1, tvec1 const & v2) + { + return tvec4( + v1.x - v2.x, + v1.y - v2.x, + v1.z - v2.x, + v1.w - v2.x); + } + template GLM_FUNC_QUALIFIER tvec4 operator-(T scalar, tvec4 const & v) { @@ -779,6 +721,16 @@ namespace glm scalar - v.w); } + template + GLM_FUNC_DECL tvec4 operator-(tvec1 const & v1, tvec4 const & v2) + { + return tvec4( + v1.x - v2.x, + v1.x - v2.y, + v1.x - v2.z, + v1.x - v2.w); + } + template GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v1, tvec4 const & v2) { @@ -799,6 +751,16 @@ namespace glm v.w * scalar); } + template + GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v1, tvec1 const & v2) + { + return tvec4( + v1.x * v2.x, + v1.y * v2.x, + v1.z * v2.x, + v1.w * v2.x); + } + template GLM_FUNC_QUALIFIER tvec4 operator*(T scalar, tvec4 const & v) { @@ -809,6 +771,16 @@ namespace glm scalar * v.w); } + template + GLM_FUNC_DECL tvec4 operator*(tvec1 const & v1, tvec4 const & v2) + { + return tvec4( + v1.x * v2.x, + v1.x * v2.y, + v1.x * v2.z, + v1.x * v2.w); + } + template GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v1, tvec4 const & v2) { @@ -829,6 +801,16 @@ namespace glm v.w / scalar); } + template + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v1, tvec1 const & v2) + { + return tvec4( + v1.x / v2.x, + v1.y / v2.x, + v1.z / v2.x, + v1.w / v2.x); + } + template GLM_FUNC_QUALIFIER tvec4 operator/(T scalar, tvec4 const & v) { @@ -839,6 +821,16 @@ namespace glm scalar / v.w); } + template + GLM_FUNC_DECL tvec4 operator/(tvec1 const & v1, tvec4 const & v2) + { + return tvec4( + v1.x / v2.x, + v1.x / v2.y, + v1.x / v2.z, + v1.x / v2.w); + } + template GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v1, tvec4 const & v2) { diff --git a/glm/gtc/bitfield.inl b/glm/gtc/bitfield.inl index 11702627..a5ef69be 100644 --- a/glm/gtc/bitfield.inl +++ b/glm/gtc/bitfield.inl @@ -87,20 +87,20 @@ namespace detail glm::uint64 REG1(x); glm::uint64 REG2(y); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF); + REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFFull); + REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF); + REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FFull); + REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FFull); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F); + REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0Full); + REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0Full); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333); + REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333ull); + REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333ull); - REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555); - REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555); + REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555ull); + REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555ull); return REG1 | (REG2 << 1); } @@ -138,25 +138,25 @@ namespace detail glm::uint64 REG2(y); glm::uint64 REG3(z); - REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF); - REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF); - REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF); + REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull); + REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull); + REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF); - REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF); + REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull); + REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull); + REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F); - REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F); + REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full); + REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full); + REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3); - REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3); + REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull); + REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull); + REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249); - REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249); + REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull); + REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull); + REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull); return REG1 | (REG2 << 1) | (REG3 << 2); } @@ -168,25 +168,25 @@ namespace detail glm::uint64 REG2(y); glm::uint64 REG3(z); - REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF); - REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF); - REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF); + REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull); + REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull); + REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF); - REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF); + REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull); + REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull); + REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F); - REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F); + REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full); + REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full); + REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3); - REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3); + REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull); + REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull); + REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249); - REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249); + REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull); + REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull); + REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull); return REG1 | (REG2 << 1) | (REG3 << 2); } @@ -225,25 +225,25 @@ namespace detail glm::uint64 REG3(z); glm::uint64 REG4(w); - REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FF); - REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FF); - REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FF); - REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FF); + REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FFull); + REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FFull); + REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FFull); + REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FFull); - REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000F); - REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000F); - REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000F); - REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000F); + REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000Full); + REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000Full); + REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000Full); + REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000Full); - REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303); - REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303); - REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303); - REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303); + REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303ull); + REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303ull); + REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303ull); + REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303ull); - REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111); - REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111); - REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111); - REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111); + REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111ull); + REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111ull); + REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111ull); + REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111ull); return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3); } diff --git a/glm/gtc/integer.hpp b/glm/gtc/integer.hpp index 96c19348..714e4c5a 100644 --- a/glm/gtc/integer.hpp +++ b/glm/gtc/integer.hpp @@ -99,6 +99,32 @@ namespace glm template class vecType> GLM_FUNC_DECL vecType mod(vecType const & x, vecType const & y); + /// Returns a value equal to the nearest integer to x. + /// The fraction 0.5 will round in a direction chosen by the + /// implementation, presumably the direction that is fastest. + /// + /// @param x The values of the argument must be greater or equal to zero. + /// @tparam T floating point scalar types. + /// @tparam vecType vector types. + /// + /// @see GLSL round man page + /// @see gtc_integer + template class vecType> + GLM_FUNC_DECL vecType iround(vecType const & x); + + /// Returns a value equal to the nearest integer to x. + /// The fraction 0.5 will round in a direction chosen by the + /// implementation, presumably the direction that is fastest. + /// + /// @param x The values of the argument must be greater or equal to zero. + /// @tparam T floating point scalar types. + /// @tparam vecType vector types. + /// + /// @see GLSL round man page + /// @see gtc_integer + template class vecType> + GLM_FUNC_DECL vecType uround(vecType const & x); + /// @} } //namespace glm diff --git a/glm/gtc/integer.inl b/glm/gtc/integer.inl index 8ddf1238..2c4d7c40 100644 --- a/glm/gtc/integer.inl +++ b/glm/gtc/integer.inl @@ -62,4 +62,39 @@ namespace detail }; # endif//GLM_HAS_BITSCAN_WINDOWS }//namespace detail + template + GLM_FUNC_QUALIFIER int iround(genType x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); + assert(static_cast(0.0) <= x); + + return static_cast(x + static_cast(0.5)); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType iround(vecType const& x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); + assert(all(lessThanEqual(vecType(0), x))); + + return vecType(x + static_cast(0.5)); + } + + template + GLM_FUNC_QUALIFIER uint uround(genType x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); + assert(static_cast(0.0) <= x); + + return static_cast(x + static_cast(0.5)); + } + + template class vecType> + GLM_FUNC_QUALIFIER vecType uround(vecType const& x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); + assert(all(lessThanEqual(vecType(0), x))); + + return vecType(x + static_cast(0.5)); + } }//namespace glm diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 7e2c05bc..d8929c81 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -150,30 +150,24 @@ namespace glm template GLM_FUNC_QUALIFIER tmat4x4 ortho ( - T left, - T right, - T bottom, - T top, - T zNear, - T zFar + T left, T right, + T bottom, T top, + T zNear, T zFar ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return orthoLH(left, right, bottom, top, zNear, zFar); - #else +# else return orthoRH(left, right, bottom, top, zNear, zFar); - #endif +# endif } template GLM_FUNC_QUALIFIER tmat4x4 orthoLH ( - T left, - T right, - T bottom, - T top, - T zNear, - T zFar + T left, T right, + T bottom, T top, + T zNear, T zFar ) { tmat4x4 Result(1); @@ -182,25 +176,23 @@ namespace glm Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = static_cast(1) / (zFar - zNear); - Result[3][2] = - zNear / (zFar - zNear); -#else - Result[2][2] = static_cast(2) / (zFar - zNear); - Result[3][2] = - (zFar + zNear) / (zFar - zNear); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = static_cast(1) / (zFar - zNear); + Result[3][2] = - zNear / (zFar - zNear); +# else + Result[2][2] = static_cast(2) / (zFar - zNear); + Result[3][2] = - (zFar + zNear) / (zFar - zNear); +# endif + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 orthoRH ( - T left, - T right, - T bottom, - T top, - T zNear, - T zFar + T left, T right, + T bottom, T top, + T zNear, T zFar ) { tmat4x4 Result(1); @@ -209,61 +201,54 @@ namespace glm Result[3][0] = - (right + left) / (right - left); Result[3][1] = - (top + bottom) / (top - bottom); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = - static_cast(1) / (zFar - zNear); - Result[3][2] = - zNear / (zFar - zNear); -#else - Result[2][2] = - static_cast(2) / (zFar - zNear); - Result[3][2] = - (zFar + zNear) / (zFar - zNear); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = - static_cast(1) / (zFar - zNear); + Result[3][2] = - zNear / (zFar - zNear); +# else + Result[2][2] = - static_cast(2) / (zFar - zNear); + Result[3][2] = - (zFar + zNear) / (zFar - zNear); +# endif + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 ortho ( - T left, - T right, - T bottom, - T top + T left, T right, + T bottom, T top ) { - tmat4x4 Result(1); - Result[0][0] = static_cast(2) / (right - left); - Result[1][1] = static_cast(2) / (top - bottom); - Result[2][2] = - static_cast(1); - Result[3][0] = - (right + left) / (right - left); - Result[3][1] = - (top + bottom) / (top - bottom); - return Result; + tmat4x4 Result(1); + Result[0][0] = static_cast(2) / (right - left); + Result[1][1] = static_cast(2) / (top - bottom); + Result[2][2] = - static_cast(1); + Result[3][0] = - (right + left) / (right - left); + Result[3][1] = - (top + bottom) / (top - bottom); + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 frustum ( - T left, - T right, - T bottom, - T top, - T nearVal, - T farVal + T left, T right, + T bottom, T top, + T nearVal, T farVal ) { -#ifdef GLM_LEFT_HANDED - return frustumLH(left, right, bottom, top, nearVal, farVal); -#else - return frustumRH(left, right, bottom, top, nearVal, farVal); -#endif +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED + return frustumLH(left, right, bottom, top, nearVal, farVal); +# else + return frustumRH(left, right, bottom, top, nearVal, farVal); +# endif } template GLM_FUNC_QUALIFIER tmat4x4 frustumLH ( - T left, - T right, - T bottom, - T top, - T nearVal, - T farVal + T left, T right, + T bottom, T top, + T nearVal, T farVal ) { tmat4x4 Result(0); @@ -273,25 +258,23 @@ namespace glm Result[2][1] = (top + bottom) / (top - bottom); Result[2][3] = static_cast(1); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = farVal / (zFar - nearVal); - Result[3][2] = -(farVal * nearVal) / (zFar - nearVal); -#else - Result[2][2] = (farVal + nearVal) / (farVal - nearVal); - Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = farVal / (farVal - nearVal); + Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); +# else + Result[2][2] = (farVal + nearVal) / (farVal - nearVal); + Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); +# endif + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 frustumRH ( - T left, - T right, - T bottom, - T top, - T nearVal, - T farVal + T left, T right, + T bottom, T top, + T nearVal, T farVal ) { tmat4x4 Result(0); @@ -301,13 +284,14 @@ namespace glm Result[2][1] = (top + bottom) / (top - bottom); Result[2][3] = static_cast(-1); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = farVal / (nearVal - farVal); - Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); -#else - Result[2][2] = - (farVal + nearVal) / (farVal - nearVal); - Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = farVal / (nearVal - farVal); + Result[3][2] = -(farVal * nearVal) / (farVal - nearVal); +# else + Result[2][2] = - (farVal + nearVal) / (farVal - nearVal); + Result[3][2] = - (static_cast(2) * farVal * nearVal) / (farVal - nearVal); +# endif + return Result; } @@ -320,11 +304,11 @@ namespace glm T zFar ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return perspectiveLH(fovy, aspect, zNear, zFar); - #else +# else return perspectiveRH(fovy, aspect, zNear, zFar); - #endif +# endif } template @@ -332,8 +316,7 @@ namespace glm ( T fovy, T aspect, - T zNear, - T zFar + T zNear, T zFar ) { assert(abs(aspect - std::numeric_limits::epsilon()) > static_cast(0)); @@ -345,24 +328,24 @@ namespace glm Result[1][1] = static_cast(1) / (tanHalfFovy); Result[2][3] = - static_cast(1); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = zFar / (zNear - zFar); - Result[3][2] = -(zFar * zNear) / (zFar - zNear); -#else - Result[2][2] = - (zFar + zNear) / (zFar - zNear); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zNear - zFar); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = - (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } template GLM_FUNC_QUALIFIER tmat4x4 perspectiveLH - ( + ( T fovy, T aspect, - T zNear, - T zFar - ) + T zNear, T zFar + ) { assert(abs(aspect - std::numeric_limits::epsilon()) > static_cast(0)); @@ -373,13 +356,14 @@ namespace glm Result[1][1] = static_cast(1) / (tanHalfFovy); Result[2][3] = static_cast(1); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = zFar / (zFar - zNear); - Result[3][2] = -(zFar * zNear) / (zFar - zNear); -#else - Result[2][2] = (zFar + zNear) / (zFar - zNear); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zFar - zNear); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } @@ -387,27 +371,23 @@ namespace glm GLM_FUNC_QUALIFIER tmat4x4 perspectiveFov ( T fov, - T width, - T height, - T zNear, - T zFar + T width, T height, + T zNear, T zFar ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return perspectiveFovLH(fov, width, height, zNear, zFar); - #else +# else return perspectiveFovRH(fov, width, height, zNear, zFar); - #endif +# endif } template GLM_FUNC_QUALIFIER tmat4x4 perspectiveFovRH ( T fov, - T width, - T height, - T zNear, - T zFar + T width, T height, + T zNear, T zFar ) { assert(width > static_cast(0)); @@ -423,13 +403,14 @@ namespace glm Result[1][1] = h; Result[2][3] = - static_cast(1); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = zFar / (zNear - zFar); - Result[3][2] = -(zFar * zNear) / (zFar - zNear); -#else - Result[2][2] = - (zFar + zNear) / (zFar - zNear); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zNear - zFar); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = - (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif + return Result; } @@ -437,10 +418,8 @@ namespace glm GLM_FUNC_QUALIFIER tmat4x4 perspectiveFovLH ( T fov, - T width, - T height, - T zNear, - T zFar + T width, T height, + T zNear, T zFar ) { assert(width > static_cast(0)); @@ -456,13 +435,13 @@ namespace glm Result[1][1] = h; Result[2][3] = static_cast(1); -#ifdef GLM_DEPTH_ZERO_TO_ONE - Result[2][2] = zFar / (zFar - zNear); - Result[3][2] = -(zFar * zNear) / (zFar - zNear); -#else - Result[2][2] = (zFar + zNear) / (zFar - zNear); - Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); -#endif +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + Result[2][2] = zFar / (zFar - zNear); + Result[3][2] = -(zFar * zNear) / (zFar - zNear); +# else + Result[2][2] = (zFar + zNear) / (zFar - zNear); + Result[3][2] = - (static_cast(2) * zFar * zNear) / (zFar - zNear); +# endif return Result; } @@ -475,11 +454,11 @@ namespace glm T zNear ) { -#ifdef GLM_LEFT_HANDED - return infinitePerspectiveLH(fovy, aspect, zNear); -#else - return infinitePerspectiveRH(fovy, aspect, zNear); -#endif +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED + return infinitePerspectiveLH(fovy, aspect, zNear); +# else + return infinitePerspectiveRH(fovy, aspect, zNear); +# endif } template @@ -578,7 +557,12 @@ namespace glm tmp = proj * tmp; tmp /= tmp.w; - tmp = tmp * T(0.5) + T(0.5); +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + tmp.x = tmp.x * T(0.5) + T(0.5); + tmp.y = tmp.y * T(0.5) + T(0.5); +# else + tmp = tmp * T(0.5) + T(0.5); +# endif tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]); tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]); @@ -599,7 +583,12 @@ namespace glm tvec4 tmp = tvec4(win, T(1)); tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]); tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]); - tmp = tmp * T(2) - T(1); +# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE + tmp.x = tmp.x * T(2) - T(1); + tmp.y = tmp.y * T(2) - T(1); +# else + tmp = tmp * T(2) - T(1); +# endif tvec4 obj = Inverse * tmp; obj /= obj.w; @@ -639,11 +628,11 @@ namespace glm tvec3 const & up ) { - #ifdef GLM_LEFT_HANDED +# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED return lookAtLH(eye, center, up); - #else +# else return lookAtRH(eye, center, up); - #endif +# endif } template diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index daf9cc19..0832f7f3 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -67,52 +67,18 @@ namespace glm typedef tquat type; typedef T value_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - // -- Data -- T x, y, z, w; -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; - static const type X; - static const type Y; - static const type Z; - static const type W; - static const type XY; - static const type XZ; - static const type XW; - static const type YZ; - static const type YW; - static const type ZW; - static const type XYZ; - static const type XYW; - static const type XZW; - static const type YZW; - static const type XYZW; -# endif - // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - /// Return the count of components of a quaternion - GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const; + typedef length_t length_type; + /// Return the count of components of a quaternion + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL T & operator[](size_type i); - GLM_FUNC_DECL T const & operator[](size_type i) const; -# else - typedef length_t length_type; - /// Return the count of components of a quaternion - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL T & operator[](length_type i); - GLM_FUNC_DECL T const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL T & operator[](length_type i); + GLM_FUNC_DECL T const & operator[](length_type i) const; // -- Implicit basic constructors -- @@ -124,7 +90,7 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tquat(ctor); - GLM_FUNC_DECL explicit tquat(T const & s, tvec3 const & v); + GLM_FUNC_DECL tquat(T const & s, tvec3 const & v); GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z); // -- Conversion constructors -- @@ -144,12 +110,12 @@ namespace glm /// @param v A second normalized axis /// @see gtc_quaternion /// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors - GLM_FUNC_DECL explicit tquat(tvec3 const & u, tvec3 const & v); + GLM_FUNC_DECL tquat(tvec3 const & u, tvec3 const & v); /// Build a quaternion from euler angles (pitch, yaw, roll), in radians. - GLM_FUNC_DECL explicit tquat(tvec3 const & eulerAngles); - GLM_FUNC_DECL explicit tquat(tmat3x3 const & m); - GLM_FUNC_DECL explicit tquat(tmat4x4 const & m); + GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3 const & eulerAngles); + GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3 const & m); + GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4 const & m); // -- Unary arithmetic operators -- @@ -204,6 +170,14 @@ namespace glm template GLM_FUNC_DECL tquat operator/(tquat const & q, T const & s); + // -- Boolean operators -- + + template + GLM_FUNC_DECL bool operator==(tquat const & q1, tquat const & q2); + + template + GLM_FUNC_DECL bool operator!=(tquat const & q1, tquat const & q2); + /// Returns the length of the quaternion. /// /// @see gtc_quaternion @@ -279,7 +253,7 @@ namespace glm template GLM_FUNC_DECL tquat rotate(tquat const & q, T const & angle, tvec3 const & axis); - /// Returns euler angles, yitch as x, yaw as y, roll as z. + /// Returns euler angles, pitch as x, yaw as y, roll as z. /// The result is expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. /// /// @see gtc_quaternion @@ -397,16 +371,6 @@ namespace glm template GLM_FUNC_DECL tvec4 notEqual(tquat const & x, tquat const & y); /// @} - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = false; - static bool const is_quat = true; - }; } //namespace glm #include "quaternion.inl" diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index e5fe5505..ff4c2d68 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -49,116 +49,27 @@ namespace detail }; }//namespace detail -# ifdef GLM_STATIC_CONST_MEMBERS - template - const tquat tquat::ZERO - (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); - - template const tquat tquat::IDENTITY; - - template - const tquat tquat::X - (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); - - template - const tquat tquat::Y - (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); - - template - const tquat tquat::Z - (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); - - template - const tquat tquat::W - (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); - - template - const tquat tquat::XY - (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); - - template - const tquat tquat::XZ - (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); - - template - const tquat tquat::XW - (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); - - template - const tquat tquat::YZ - (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); - - template - const tquat tquat::YW - (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); - - template - const tquat tquat::ZW - (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); - - template - const tquat tquat::XYZ - (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); - - template - const tquat tquat::XYW - (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); - - template - const tquat tquat::XZW - (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); - - template - const tquat tquat::YZW - (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); - - template - const tquat tquat::XYZW - (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); -# endif // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat::size_type tquat::size() const - { - return 4; - } + template + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat::length_type tquat::length() const + { + return 4; + } - template - GLM_FUNC_QUALIFIER T & tquat::operator[](typename tquat::size_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } + template + GLM_FUNC_QUALIFIER T & tquat::operator[](typename tquat::length_type i) + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } - template - GLM_FUNC_QUALIFIER T const & tquat::operator[](typename tquat::size_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# else - template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat::length_type tquat::length() const - { - return 4; - } - - template - GLM_FUNC_QUALIFIER T & tquat::operator[](typename tquat::length_type i) - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER T const & tquat::operator[](typename tquat::length_type i) const - { - assert(i >= 0 && static_cast(i) < detail::component_count(*this)); - return (&x)[i]; - } -# endif//GLM_FORCE_SIZE_FUNC + template + GLM_FUNC_QUALIFIER T const & tquat::operator[](typename tquat::length_type i) const + { + assert(i >= 0 && static_cast(i) < detail::component_count(*this)); + return (&x)[i]; + } // -- Implicit basic constructors -- @@ -664,7 +575,7 @@ namespace detail template GLM_FUNC_QUALIFIER T yaw(tquat const & q) { - return asin(T(-2) * (q.x * q.z - q.w * q.y)); + return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1))); } template diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index c62fcda4..cddf1fe6 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -66,32 +66,18 @@ namespace glm typedef T value_type; typedef glm::tquat part_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR precision prec = P; -# endif//GLM_META_PROG_HELPERS - // -- Data -- glm::tquat real, dual; // -- Component accesses -- -# ifdef GLM_FORCE_SIZE_FUNC - typedef size_t size_type; - /// Return the count of components of a dual quaternion - GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const; + typedef length_t length_type; + /// Return the count of components of a dual quaternion + GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - GLM_FUNC_DECL part_type & operator[](size_type i); - GLM_FUNC_DECL part_type const & operator[](size_type i) const; -# else - typedef length_t length_type; - /// Return the count of components of a dual quaternion - GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const; - - GLM_FUNC_DECL part_type & operator[](length_type i); - GLM_FUNC_DECL part_type const & operator[](length_type i) const; -# endif//GLM_FORCE_SIZE_FUNC + GLM_FUNC_DECL part_type & operator[](length_type i); + GLM_FUNC_DECL part_type const & operator[](length_type i) const; // -- Implicit basic constructors -- @@ -103,7 +89,7 @@ namespace glm // -- Explicit basic constructors -- GLM_FUNC_DECL explicit tdualquat(ctor); - GLM_FUNC_DECL explicit tdualquat(tquat const & real); + GLM_FUNC_DECL tdualquat(tquat const & real); GLM_FUNC_DECL tdualquat(tquat const & orientation, tvec3 const & translation); GLM_FUNC_DECL tdualquat(tquat const & real, tquat const & dual); @@ -112,8 +98,8 @@ namespace glm template GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tdualquat const & q); - GLM_FUNC_DECL explicit tdualquat(tmat2x4 const & holder_mat); - GLM_FUNC_DECL explicit tdualquat(tmat3x4 const & aug_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4 const & holder_mat); + GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4 const & aug_mat); // -- Unary arithmetic operators -- @@ -144,16 +130,16 @@ namespace glm GLM_FUNC_DECL tdualquat operator*(tdualquat const & q, tdualquat const & p); template - GLM_FUNC_DECL tvec3 operator*(tquat const & q, tvec3 const & v); + GLM_FUNC_DECL tvec3 operator*(tdualquat const & q, tvec3 const & v); template - GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tquat const & q); + GLM_FUNC_DECL tvec3 operator*(tvec3 const & v, tdualquat const & q); template - GLM_FUNC_DECL tvec4 operator*(tquat const & q, tvec4 const & v); + GLM_FUNC_DECL tvec4 operator*(tdualquat const & q, tvec4 const & v); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tquat const & q); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tdualquat const & q); template GLM_FUNC_DECL tdualquat operator*(tdualquat const & q, T const & s); @@ -164,6 +150,14 @@ namespace glm template GLM_FUNC_DECL tdualquat operator/(tdualquat const & q, T const & s); + // -- Boolean operators -- + + template + GLM_FUNC_DECL bool operator==(tdualquat const & q1, tdualquat const & q2); + + template + GLM_FUNC_DECL bool operator!=(tdualquat const & q1, tdualquat const & q2); + /// Returns the normalized quaternion. /// /// @see gtx_dual_quaternion @@ -295,16 +289,6 @@ namespace glm #endif /// @} - - // -- Is type -- - - template - struct type - { - static bool const is_vec = false; - static bool const is_mat = false; - static bool const is_quat = true; - }; } //namespace glm #include "dual_quaternion.inl" diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 961dd1ca..fd41dcdc 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -194,11 +194,17 @@ namespace glm // -- Unary bit operators -- template - GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) + GLM_FUNC_QUALIFIER tdualquat operator+(tdualquat const & q) { return q; } + template + GLM_FUNC_QUALIFIER tdualquat operator-(tdualquat const & q) + { + return tdualquat(-q.real, -q.dual); + } + // -- Binary operators -- template diff --git a/glm/gtx/intersect.hpp b/glm/gtx/intersect.hpp index d35b4c54..3bce7081 100644 --- a/glm/gtx/intersect.hpp +++ b/glm/gtx/intersect.hpp @@ -43,8 +43,12 @@ #pragma once // Dependency: +#include +#include #include "../glm.hpp" +#include "../geometric.hpp" #include "../gtx/closest_point.hpp" +#include "../gtx/vector_query.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) # pragma message("GLM: GLM_GTX_closest_point extension included") diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl index 6b94d5bc..ac6304e0 100644 --- a/glm/gtx/intersect.inl +++ b/glm/gtx/intersect.inl @@ -7,10 +7,6 @@ // File : glm/gtx/intersect.inl /////////////////////////////////////////////////////////////////////////////////////////////////// -#include "../geometric.hpp" -#include -#include - namespace glm { template diff --git a/glm/gtx/log_base.hpp b/glm/gtx/log_base.hpp index 94d03472..e6c89ea2 100644 --- a/glm/gtx/log_base.hpp +++ b/glm/gtx/log_base.hpp @@ -53,15 +53,15 @@ namespace glm /// @addtogroup gtx_log_base /// @{ - //! Logarithm for any base. - //! From GLM_GTX_log_base. + /// Logarithm for any base. + /// From GLM_GTX_log_base. template GLM_FUNC_DECL genType log( - genType x, - genType base); + genType const & x, + genType const & base); - //! Logarithm for any base. - //! From GLM_GTX_log_base. + /// Logarithm for any base. + /// From GLM_GTX_log_base. template class vecType> GLM_FUNC_DECL vecType sign( vecType const & x, diff --git a/glm/gtx/matrix_decompose.hpp b/glm/gtx/matrix_decompose.hpp index e7fc83e2..e68ab498 100644 --- a/glm/gtx/matrix_decompose.hpp +++ b/glm/gtx/matrix_decompose.hpp @@ -45,6 +45,7 @@ #include "../mat4x4.hpp" #include "../vec3.hpp" #include "../vec4.hpp" +#include "../geometric.hpp" #include "../gtc/quaternion.hpp" #include "../gtc/matrix_transform.hpp" diff --git a/glm/gtx/matrix_decompose.inl b/glm/gtx/matrix_decompose.inl index dec79572..47986660 100644 --- a/glm/gtx/matrix_decompose.inl +++ b/glm/gtx/matrix_decompose.inl @@ -30,7 +30,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { /// Make a linear combination of two vectors and return the result. // result = (a * ascl) + (b * bscl) @@ -44,24 +45,15 @@ namespace glm } template - GLM_FUNC_QUALIFIER void v3Scale(tvec3 & v, T desiredLength) + GLM_FUNC_QUALIFIER tvec3 scale(tvec3 const& v, T desiredLength) { - T len = glm::length(v); - if(len != 0) - { - T l = desiredLength / len; - v[0] *= l; - v[1] *= l; - v[2] *= l; - } + return v * desiredLength / length(v); } +}//namespace detail - /** - * Matrix decompose - * http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp - * Decomposes the mode matrix to translations,rotation scale components - * - */ + // Matrix decompose + // http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp + // Decomposes the mode matrix to translations,rotation scale components template GLM_FUNC_QUALIFIER bool decompose(tmat4x4 const & ModelMatrix, tvec3 & Scale, tquat & Orientation, tvec3 & Translation, tvec3 & Skew, tvec4 & Perspective) @@ -131,26 +123,26 @@ namespace glm // Compute X scale factor and normalize first row. Scale.x = length(Row[0]);// v3Length(Row[0]); - v3Scale(Row[0], static_cast(1)); + Row[0] = detail::scale(Row[0], static_cast(1)); // Compute XY shear factor and make 2nd row orthogonal to 1st. Skew.z = dot(Row[0], Row[1]); - Row[1] = combine(Row[1], Row[0], static_cast(1), -Skew.z); + Row[1] = detail::combine(Row[1], Row[0], static_cast(1), -Skew.z); // Now, compute Y scale and normalize 2nd row. Scale.y = length(Row[1]); - v3Scale(Row[1], static_cast(1)); + Row[1] = detail::scale(Row[1], static_cast(1)); Skew.z /= Scale.y; // Compute XZ and YZ shears, orthogonalize 3rd row. Skew.y = glm::dot(Row[0], Row[2]); - Row[2] = combine(Row[2], Row[0], static_cast(1), -Skew.y); + Row[2] = detail::combine(Row[2], Row[0], static_cast(1), -Skew.y); Skew.x = glm::dot(Row[1], Row[2]); - Row[2] = combine(Row[2], Row[1], static_cast(1), -Skew.x); + Row[2] = detail::combine(Row[2], Row[1], static_cast(1), -Skew.x); // Next, get Z scale and normalize 3rd row. Scale.z = length(Row[2]); - v3Scale(Row[2], static_cast(1)); + Row[2] = detail::scale(Row[2], static_cast(1)); Skew.y /= Scale.z; Skew.x /= Scale.z; diff --git a/glm/gtx/polar_coordinates.inl b/glm/gtx/polar_coordinates.inl index d1afbb23..9d7f6aea 100644 --- a/glm/gtx/polar_coordinates.inl +++ b/glm/gtx/polar_coordinates.inl @@ -43,7 +43,7 @@ namespace glm T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); return tvec3( - atan(xz_dist, tmp.y), // latitude + asin(tmp.y), // latitude atan(tmp.x, tmp.z), // longitude xz_dist); // xz distance } diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index e1567610..ae5790ae 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -76,18 +76,6 @@ namespace detail typedef tvec4 pure_col_type; typedef tmat4x4 pure_transpose_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR length_t cols = 4; - static GLM_RELAXED_CONSTEXPR length_t rows = 4; - static GLM_RELAXED_CONSTEXPR precision prec = defaultp; -# endif//GLM_META_PROG_HELPERS - -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; -# endif - GLM_FUNC_DECL length_t length() const; fvec4SIMD Data[4]; diff --git a/glm/gtx/simd_mat4.inl b/glm/gtx/simd_mat4.inl index c436ab1f..13dcb20f 100644 --- a/glm/gtx/simd_mat4.inl +++ b/glm/gtx/simd_mat4.inl @@ -61,11 +61,6 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[] return this->Data[i]; } -#ifdef GLM_STATIC_CONST_MEMBERS - const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast(0)); - const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast(1)); -#endif - ////////////////////////////////////////////////////////////// // Constructors diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 16782081..d06093eb 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -76,11 +76,6 @@ namespace detail typedef tquat bool_type; typedef tquat pure_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR precision prec = defaultp; -# endif//GLM_META_PROG_HELPERS - #ifdef GLM_SIMD_ENABLE_XYZW_UNION union { @@ -91,26 +86,6 @@ namespace detail __m128 Data; #endif -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type IDENTITY; - static const type X; - static const type Y; - static const type Z; - static const type W; - static const type XY; - static const type XZ; - static const type XW; - static const type YZ; - static const type YW; - static const type ZW; - static const type XYZ; - static const type XYW; - static const type XZW; - static const type YZW; - static const type XYZW; -# endif - ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index c301988a..1fe9c93f 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -51,26 +51,6 @@ void print(const fvec4SIMD &v) } #endif -# ifdef GLM_STATIC_CONST_MEMBERS - const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0); - const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0); - const fquatSIMD fquatSIMD::X(0, 1, 0, 0); - const fquatSIMD fquatSIMD::Y(0, 0, 1, 0); - const fquatSIMD fquatSIMD::Z(0, 0, 0, 1); - const fquatSIMD fquatSIMD::W(1, 0, 0, 0); - const fquatSIMD fquatSIMD::XY(0, 1, 1, 0); - const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1); - const fquatSIMD fquatSIMD::XW(1, 1, 0, 0); - const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1); - const fquatSIMD fquatSIMD::YW(1, 0, 1, 0); - const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1); - const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1); - const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0); - const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1); - const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1); - const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1); -# endif - ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 3877f821..8e61311c 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -99,11 +99,6 @@ namespace detail typedef tvec4 pure_type; typedef tvec4 bool_type; -# ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR precision prec = defaultp; -# endif//GLM_META_PROG_HELPERS - #ifdef GLM_SIMD_ENABLE_XYZW_UNION union { @@ -114,25 +109,6 @@ namespace detail __m128 Data; #endif -# ifdef GLM_STATIC_CONST_MEMBERS - static const type ZERO; - static const type X; - static const type Y; - static const type Z; - static const type W; - static const type XY; - static const type XZ; - static const type XW; - static const type YZ; - static const type YW; - static const type ZW; - static const type XYZ; - static const type XYW; - static const type XZW; - static const type YZW; - static const type XYZW; -# endif - ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index b1413eea..6271d0cf 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -16,25 +16,6 @@ struct shuffle_mask enum{value = Value}; }; -# ifdef GLM_STATIC_CONST_MEMBERS - const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0); - const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0); - const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0); - const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0); - const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1); - const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0); - const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0); - const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1); - const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0); - const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1); - const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1); - const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0); - const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1); - const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1); - const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1); - const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1); -# endif - ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/transform.hpp b/glm/gtx/transform.hpp index 7e6a4a73..5d22fba5 100644 --- a/glm/gtx/transform.hpp +++ b/glm/gtx/transform.hpp @@ -64,7 +64,7 @@ namespace glm GLM_FUNC_DECL tmat4x4 translate( tvec3 const & v); - /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. + /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. /// @see gtc_matrix_transform /// @see gtx_transform template diff --git a/glm/gtx/type_trait.hpp b/glm/gtx/type_trait.hpp new file mode 100644 index 00000000..1875b1a0 --- /dev/null +++ b/glm/gtx/type_trait.hpp @@ -0,0 +1,224 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2016 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref gtx_type_info +/// @file glm/gtx/type_info.hpp +/// @date 2016-03-12 / 2016-03-12 +/// @author Christophe Riccio +/// +/// @see core (dependence) +/// +/// @defgroup gtx_type_info GLM_GTX_type_info +/// @ingroup gtx +/// +/// @brief Defines aligned types. +/// +/// need to be included to use these functionalities. +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +// Dependency: +#include "../detail/precision.hpp" +#include "../detail/setup.hpp" + +#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) +# pragma message("GLM: GLM_GTX_type_info extension included") +#endif + +namespace glm +{ + /// @addtogroup gtx_type_info + /// @{ + + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + template struct tquat; + template struct tdualquat; + + template