diff --git a/CMakeLists.txt b/CMakeLists.txt index 58d77043..6971a678 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,70 +11,91 @@ if(NOT GLM_TEST_ENABLE) message(FATAL_ERROR "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") endif() -option(GLM_USE_INTEL "Use Intel Compiler" OFF) +if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX)) + option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF) + option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF) + option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF) + option(GLM_TEST_ENABLE_CXX_1Y "Enable C++ 1y" OFF) + option(GLM_TEST_ENABLE_CXX_PEDANTIC "Pedantic" ON) -option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF) -if(GLM_TEST_ENABLE_CXX_11) - if(GLM_USE_INTEL) - add_definitions(/Qstd=c++0x) - endif() - - if(CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-std=c++0x) - endif() -elseif(NOT GLM_TEST_ENABLE_CXX_11) - if(CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-std=c++98) - endif() -endif() - -option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF) -if(GLM_TEST_ENABLE_LANG_EXTENSIONS) - if(GLM_USE_INTEL) - add_definitions(/Qintel-extensions) - add_definitions(-intel-extensions) - endif() - - if(CMAKE_COMPILER_IS_GNUCXX) - #Doesn't seem to work... - #add_definitions(-fms-extensions) - #add_definitions(-D_MSC_EXTENSIONS) - endif() - -elseif(NOT GLM_TEST_ENABLE_LANG_EXTENSIONS) - if(GLM_USE_INTEL) - add_definitions(/Qintel-extensions-) - add_definitions(-no-intel-extensions) - endif() - - if(CMAKE_COMPILER_IS_GNUCXX) + if(GLM_TEST_ENABLE_CXX_PEDANTIC) add_definitions(-pedantic) endif() - if(MSVC) - add_definitions(/Za) + if(GLM_TEST_ENABLE_CXX_1Y) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++1y") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_CXX_FLAGS "-std=c++1y") + elseif(GLM_TEST_ENABLE_CXX_11) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_CXX_FLAGS "-std=c++11") + elseif(GLM_TEST_ENABLE_CXX_0X) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_CXX_FLAGS "-std=c++0x") + elseif(GLM_TEST_ENABLE_CXX_98) + 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") endif() endif() -#set(GLM_SIMD_INSTRUCTION_SET "" CACHE STRING "Instruction set. Possible values are SSE1, SSE2") +if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32)) + option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF) -option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF) -if(GLM_TEST_ENABLE_SIMD) - if(CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-msse2) - elseif(GLM_USE_INTEL) - add_definitions(/QxAVX) - elseif(MSVC10) - add_definitions(/arch:AVX) - elseif(MSVC) - add_definitions(/arch:SSE2) + if(NOT GLM_TEST_ENABLE_MS_EXTENSIONS) + add_definitions(/Za) endif() -elseif(NOT GLM_TEST_ENABLE_SIMD) - +endif() + +option(GLM_TEST_ENABLE_SIMD_SSE2 "Enable SSE2 optimizations" OFF) +option(GLM_TEST_ENABLE_SIMD_SSE3 "Enable SSE3 optimizations" OFF) +option(GLM_TEST_ENABLE_SIMD_AVX "Enable AVX optimizations" OFF) +option(GLM_TEST_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF) +option(GLM_TEST_FORCE_PURE "Force 'pure' instructions" OFF) + +if(GLM_TEST_FORCE_PURE) add_definitions(-DGLM_FORCE_PURE) if(CMAKE_COMPILER_IS_GNUCXX) add_definitions(-mfpmath=387) + elseif(MSVC) + add_definitions(/arch:IA32) + endif() +elseif(GLM_TEST_ENABLE_AVX2) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-mavx2) + elseif(GLM_USE_INTEL) + add_definitions(/QxAVX2) + elseif(MSVC) + add_definitions(/arch:AVX2) + endif() +elseif(GLM_TEST_ENABLE_AVX) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-mavx) + elseif(GLM_USE_INTEL) + add_definitions(/QxAVX) + elseif(MSVC) + add_definitions(/arch:AVX) + endif() +elseif(GLM_TEST_ENABLE_SSE3) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-msse3) + elseif(GLM_USE_INTEL) + add_definitions(/QxSSE3) + elseif(MSVC) + add_definitions(/arch:SSE2) # VC doesn't support /arch:SSE3 + endif() +elseif(GLM_TEST_ENABLE_SSE2) + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-msse2) + elseif(GLM_USE_INTEL) + add_definitions(/QxSSE2) + elseif(MSVC) + if(NOT CMAKE_CL_64) + add_definitions(/arch:SSE2) + endif() endif() endif() diff --git a/doc/glm.docx b/doc/glm.docx index 0c7acad6..c0c55fef 100644 Binary files a/doc/glm.docx and b/doc/glm.docx differ diff --git a/doc/glm.pdf b/doc/glm.pdf index 79ce7496..730b2e55 100644 Binary files a/doc/glm.pdf and b/doc/glm.pdf differ diff --git a/doc/~$glm.docx b/doc/~$glm.docx new file mode 100644 index 00000000..db258f22 Binary files /dev/null and b/doc/~$glm.docx differ diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt index 1b9ac8e1..79a46074 100644 --- a/glm/CMakeLists.txt +++ b/glm/CMakeLists.txt @@ -5,9 +5,9 @@ file(GLOB ROOT_INLINE *.inl) file(GLOB ROOT_HEADER *.hpp) file(GLOB ROOT_TEXT ../*.txt) -file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp) -file(GLOB_RECURSE CORE_INLINE ./core/*.inl) -file(GLOB_RECURSE CORE_HEADER ./core/*.hpp) +file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) +file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) +file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) @@ -17,10 +17,6 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) -file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp) -file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl) -file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp) - source_group("Text Files" FILES ${ROOT_TEXT}) source_group("Core Files" FILES ${CORE_SOURCE}) source_group("Core Files" FILES ${CORE_INLINE}) @@ -31,9 +27,6 @@ source_group("GTC Files" FILES ${GTC_HEADER}) source_group("GTX Files" FILES ${GTX_SOURCE}) source_group("GTX Files" FILES ${GTX_INLINE}) source_group("GTX Files" FILES ${GTX_HEADER}) -source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) -source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) -source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) @@ -41,8 +34,7 @@ add_executable(${NAME} ${ROOT_TEXT} ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} - ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} - ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) -add_library(glm STATIC glm.cpp) -add_library(glm_shared SHARED glm.cpp) +#add_library(glm STATIC glm.cpp) +#add_library(glm_shared SHARED glm.cpp) diff --git a/glm/common.hpp b/glm/common.hpp new file mode 100644 index 00000000..db2547ce --- /dev/null +++ b/glm/common.hpp @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// 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. +/// +/// 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 core +/// @file glm/common.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_COMMON_INCLUDED +#define GLM_COMMON_INCLUDED + +#include "detail/func_common.hpp" + +#endif//GLM_COMMON_INCLUDED diff --git a/glm/core/func_matrix.inl b/glm/core/func_matrix.inl deleted file mode 100644 index bcbcecc8..00000000 --- a/glm/core/func_matrix.inl +++ /dev/null @@ -1,582 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// 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. -/// -/// 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 core -/// @file glm/core/func_matrix.inl -/// @date 2008-03-08 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - // matrixCompMult - template - GLM_FUNC_QUALIFIER matType matrixCompMult - ( - matType const & x, - matType const & y - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'matrixCompMult' only accept floating-point inputs"); - - matType result(matType::_null); - for(typename matType::size_type i = 0; i < matType::row_size(); ++i) - result[i] = x[i] * y[i]; - return result; - } - - // outerProduct - template - GLM_FUNC_QUALIFIER detail::tmat2x2 outerProduct - ( - detail::tvec2 const & c, - detail::tvec2 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat2x2 m(detail::tmat2x2::null); - m[0][0] = c[0] * r[0]; - m[0][1] = c[1] * r[0]; - m[1][0] = c[0] * r[1]; - m[1][1] = c[1] * r[1]; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x3 outerProduct - ( - detail::tvec3 const & c, - detail::tvec3 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat3x3 m(detail::tmat3x3::null); - for(typename detail::tmat3x3::size_type i(0); i < m.length(); ++i) - m[i] = c * r[i]; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 outerProduct - ( - detail::tvec4 const & c, - detail::tvec4 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat4x4 m(detail::tmat4x4::null); - for(typename detail::tmat4x4::size_type i(0); i < m.length(); ++i) - m[i] = c * r[i]; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x3 outerProduct - ( - detail::tvec3 const & c, - detail::tvec2 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat2x3 m(detail::tmat2x3::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x2 outerProduct - ( - detail::tvec2 const & c, - detail::tvec3 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat3x2 m(detail::tmat3x2::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x4 outerProduct - ( - detail::tvec4 const & c, - detail::tvec2 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat2x4 m(detail::tmat2x4::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[0][3] = c.w * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[1][3] = c.w * r.y; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x2 outerProduct - ( - detail::tvec2 const & c, - detail::tvec4 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat4x2 m(detail::tmat4x2::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[3][0] = c.x * r.w; - m[3][1] = c.y * r.w; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x4 outerProduct - ( - detail::tvec4 const & c, - detail::tvec3 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat3x4 m(detail::tmat3x4::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[0][3] = c.w * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[1][3] = c.w * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[2][2] = c.z * r.z; - m[2][3] = c.w * r.z; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x3 outerProduct - ( - detail::tvec3 const & c, - detail::tvec4 const & r - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); - - detail::tmat4x3 m(detail::tmat4x3::null); - m[0][0] = c.x * r.x; - m[0][1] = c.y * r.x; - m[0][2] = c.z * r.x; - m[1][0] = c.x * r.y; - m[1][1] = c.y * r.y; - m[1][2] = c.z * r.y; - m[2][0] = c.x * r.z; - m[2][1] = c.y * r.z; - m[2][2] = c.z * r.z; - m[3][0] = c.x * r.w; - m[3][1] = c.y * r.w; - m[3][2] = c.z * r.w; - return m; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x2 transpose - ( - detail::tmat2x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat2x2 result(detail::tmat2x2::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x3 transpose - ( - detail::tmat3x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat3x3 result(detail::tmat3x3::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 transpose - ( - detail::tmat4x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat4x4 result(detail::tmat4x4::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; - - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; - - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[2][3] = m[3][2]; - - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - result[3][2] = m[2][3]; - result[3][3] = m[3][3]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x3 transpose - ( - detail::tmat3x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat2x3 result(detail::tmat2x3::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x2 transpose - ( - detail::tmat2x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat3x2 result(detail::tmat3x2::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x4 transpose - ( - detail::tmat4x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat2x4 result(detail::tmat2x4::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x2 transpose - ( - detail::tmat2x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat4x2 result(detail::tmat4x2::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x4 transpose - ( - detail::tmat4x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat3x4 result(detail::tmat3x4::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[2][3] = m[3][2]; - return result; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x3 transpose - ( - detail::tmat3x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - - detail::tmat4x3 result(detail::tmat4x3::_null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - result[3][2] = m[2][3]; - return result; - } - - template - GLM_FUNC_QUALIFIER typename detail::tmat2x2::value_type determinant - ( - detail::tmat2x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); - - return m[0][0] * m[1][1] - m[1][0] * m[0][1]; - } - - template - GLM_FUNC_QUALIFIER typename detail::tmat3x3::value_type determinant - ( - detail::tmat3x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); - - return - + m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) - - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) - + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); - } - - template - GLM_FUNC_QUALIFIER typename detail::tmat4x4::value_type determinant - ( - detail::tmat4x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'determinant' only accept floating-point inputs"); - - T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; - T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; - T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; - T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; - T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; - T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; - - detail::tvec4 DetCof( - + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02), - - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04), - + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05), - - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05)); - - return m[0][0] * DetCof[0] - + m[0][1] * DetCof[1] - + m[0][2] * DetCof[2] - + m[0][3] * DetCof[3]; - } - - template - GLM_FUNC_QUALIFIER detail::tmat2x2 inverse - ( - detail::tmat2x2 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); - - //valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; - T Determinant = determinant(m); - - detail::tmat2x2 Inverse( - + m[1][1] / Determinant, - - m[0][1] / Determinant, - - m[1][0] / Determinant, - + m[0][0] / Determinant); - - return Inverse; - } - - template - GLM_FUNC_QUALIFIER detail::tmat3x3 inverse - ( - detail::tmat3x3 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); - - //valType Determinant = m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) - // - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) - // + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); - - T Determinant = determinant(m); - - detail::tmat3x3 Inverse(detail::tmat3x3::_null); - Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]); - Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]); - Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]); - Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]); - Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]); - Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]); - Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]); - Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]); - Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]); - Inverse /= Determinant; - - return Inverse; - } - - template - GLM_FUNC_QUALIFIER detail::tmat4x4 inverse - ( - detail::tmat4x4 const & m - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'inverse' only accept floating-point inputs"); - - T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; - T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; - T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; - - T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; - T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; - T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; - - T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; - T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; - T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; - - T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; - T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; - T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; - - T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; - T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; - T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; - - T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; - T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; - T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; - - detail::tvec4 const SignA(+1, -1, +1, -1); - detail::tvec4 const SignB(-1, +1, -1, +1); - - detail::tvec4 Fac0(Coef00, Coef00, Coef02, Coef03); - detail::tvec4 Fac1(Coef04, Coef04, Coef06, Coef07); - detail::tvec4 Fac2(Coef08, Coef08, Coef10, Coef11); - detail::tvec4 Fac3(Coef12, Coef12, Coef14, Coef15); - detail::tvec4 Fac4(Coef16, Coef16, Coef18, Coef19); - detail::tvec4 Fac5(Coef20, Coef20, Coef22, Coef23); - - detail::tvec4 Vec0(m[1][0], m[0][0], m[0][0], m[0][0]); - detail::tvec4 Vec1(m[1][1], m[0][1], m[0][1], m[0][1]); - detail::tvec4 Vec2(m[1][2], m[0][2], m[0][2], m[0][2]); - detail::tvec4 Vec3(m[1][3], m[0][3], m[0][3], m[0][3]); - - detail::tvec4 Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2); - detail::tvec4 Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4); - detail::tvec4 Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5); - detail::tvec4 Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5); - - detail::tmat4x4 Inverse(Inv0, Inv1, Inv2, Inv3); - - detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); - - T Determinant = glm::dot(m[0], Row0); - - Inverse /= Determinant; - - return Inverse; - } -}//namespace glm diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl deleted file mode 100644 index ce22d4e9..00000000 --- a/glm/core/func_packing.inl +++ /dev/null @@ -1,208 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// 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. -/// -/// 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 core -/// @file glm/core/func_packing.inl -/// @date 2010-03-17 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - GLM_FUNC_QUALIFIER uint32 packUnorm2x16(vec2 const & v) - { - uint16 A(uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f))); - uint16 B(uint16(round(clamp(v.y, 0.0f, 1.0f) * 65535.0f))); - return uint32((B << 16) | A); - } - - GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint32 const & p) - { - uint32 Mask16((1 << 16) - 1); - uint32 A((p >> 0) & Mask16); - uint32 B((p >> 16) & Mask16); - return vec2( - A * 1.0f / 65535.0f, - B * 1.0f / 65535.0f); - } - - GLM_FUNC_QUALIFIER uint32 packSnorm2x16(vec2 const & v) - { - union iu - { - int16 i; - uint16 u; - } A, B; - - vec2 Unpack = clamp(v ,-1.0f, 1.0f) * 32767.0f; - A.i = detail::int16(round(Unpack.x)); - B.i = detail::int16(round(Unpack.y)); - uint32 Pack = (uint32(B.u) << 16) | (uint32(A.u) << 0); - return Pack; - } - - GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint32 const & p) - { - union iu - { - int16 i; - uint16 u; - } A, B; - - uint32 Mask16((1 << 16) - 1); - A.u = uint16((p >> 0) & Mask16); - B.u = uint16((p >> 16) & Mask16); - glm::vec2 Pack(A.i, B.i); - - return clamp(Pack * 1.0f / 32767.0f, -1.0f, 1.0f); - } - - GLM_FUNC_QUALIFIER uint32 packUnorm4x8(vec4 const & v) - { - uint8 A((uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); - uint8 B((uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); - uint8 C((uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); - uint8 D((uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); - return uint32((D << 24) | (C << 16) | (B << 8) | A); - } - - GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint32 const & p) - { - uint32 Mask8((1 << 8) - 1); - uint32 A((p >> 0) & Mask8); - uint32 B((p >> 8) & Mask8); - uint32 C((p >> 16) & Mask8); - uint32 D((p >> 24) & Mask8); - return glm::vec4( - A * 1.0f / 255.0f, - B * 1.0f / 255.0f, - C * 1.0f / 255.0f, - D * 1.0f / 255.0f); - } - - GLM_FUNC_QUALIFIER uint32 packSnorm4x8(vec4 const & v) - { - union iu - { - int8 i; - uint8 u; - } A, B, C, D; - - glm::vec4 Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f; - A.i = int8(round(Unpack.x)); - B.i = int8(round(Unpack.y)); - C.i = int8(round(Unpack.z)); - D.i = int8(round(Unpack.w)); - uint32 Pack = (uint32(D.u) << 24) | (uint32(C.u) << 16) | (uint32(B.u) << 8) | (uint32(A.u) << 0); - return Pack; - } - - GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint32 const & p) - { - union iu - { - int8 i; - uint8 u; - } A, B, C, D; - - uint32 Mask8((1 << 8) - 1); - A.u = uint8((p >> 0) & Mask8); - B.u = uint8((p >> 8) & Mask8); - C.u = uint8((p >> 16) & Mask8); - D.u = uint8((p >> 24) & Mask8); - glm::vec4 Pack(A.i, B.i, C.i, D.i); - - return clamp(Pack * 1.0f / 127.0f, -1.0f, 1.0f); - } - - GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v) - { - struct uint32_pair - { - uint32 x; - uint32 y; - }; - - union helper - { - uint32_pair input; - double output; - } Helper; - - Helper.input.x = v.x; - Helper.input.y = v.y; - - return Helper.output; - //return *(double*)&v; - } - - GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v) - { - struct uint32_pair - { - uint32 x; - uint32 y; - }; - - union helper - { - double input; - uint32_pair output; - } Helper; - - Helper.input = v; - - return uvec2(Helper.output.x, Helper.output.y); - } - - GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v) - { - union helper - { - uint other; - struct - { - detail::hdata a, b; - } orig; - } Pack; - - Pack.orig.a = detail::toFloat16(v.x); - Pack.orig.b = detail::toFloat16(v.y); - return Pack.other; - } - - GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) - { - union helper - { - uint other; - struct - { - detail::hdata a, b; - } orig; - } Unpack; - Unpack.other = v; - - return vec2(detail::toFloat32(Unpack.orig.a), detail::toFloat32(Unpack.orig.b)); - } -}//namespace glm - diff --git a/glm/core/type_half.hpp b/glm/core/type_half.hpp deleted file mode 100644 index 88f75e05..00000000 --- a/glm/core/type_half.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// 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. -/// -/// 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 core -/// @file glm/core/type_half.hpp -/// @date 2008-08-17 / 2011-09-20 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_type_half -#define glm_core_type_half - -#include "setup.hpp" - -namespace glm{ -namespace detail -{ - typedef short hdata; - - GLM_FUNC_DECL float toFloat32(hdata value); - GLM_FUNC_DECL hdata toFloat16(float const & value); - - class half - { - public: - // Constructors - GLM_FUNC_DECL half(); - GLM_FUNC_DECL half(half const & s); - - template - GLM_FUNC_DECL explicit half(U const & s); - - // Cast - //template - //GLM_FUNC_DECL operator U() const; - GLM_FUNC_DECL operator float() const; - - // Unary updatable operators - GLM_FUNC_DECL half& operator= (half const & s); - GLM_FUNC_DECL half& operator+=(half const & s); - GLM_FUNC_DECL half& operator-=(half const & s); - GLM_FUNC_DECL half& operator*=(half const & s); - GLM_FUNC_DECL half& operator/=(half const & s); - GLM_FUNC_DECL half& operator++(); - GLM_FUNC_DECL half& operator--(); - - GLM_FUNC_DECL float toFloat() const{return toFloat32(data);} - - GLM_FUNC_DECL hdata _data() const{return data;} - - private: - hdata data; - }; - - GLM_FUNC_DECL half operator+ (half const & s1, half const & s2); - - GLM_FUNC_DECL half operator- (half const & s1, half const & s2); - - GLM_FUNC_DECL half operator* (half const & s1, half const & s2); - - GLM_FUNC_DECL half operator/ (half const & s1, half const & s2); - - // Unary constant operators - GLM_FUNC_DECL half operator- (half const & s); - - GLM_FUNC_DECL half operator-- (half const & s, int); - - GLM_FUNC_DECL half operator++ (half const & s, int); - - GLM_FUNC_DECL bool operator==( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator!=( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator<( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator<=( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator>( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator>=( - detail::half const & x, - detail::half const & y); - -}//namespace detail - - /// Low half-precision floating-point numbers. - typedef detail::half lowp_half; - - /// Medium half-precision floating-point numbers. - typedef detail::half mediump_half; - - /// High half-precision floating-point numbers. - typedef detail::half highp_half; - -#if(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef highp_half half_t; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef mediump_half half_t; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF)) - typedef lowp_half half_t; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - /// Default half-precision floating-point numbers. - typedef highp_half half_t; -#else -# error "GLM error: Multiple default precisions requested for half-precision floating-point types" -#endif - -}//namespace glm - -#include "type_half.inl" - -#endif//glm_core_type_half diff --git a/glm/core/_features.hpp b/glm/detail/_features.hpp similarity index 100% rename from glm/core/_features.hpp rename to glm/detail/_features.hpp diff --git a/glm/core/_fixes.hpp b/glm/detail/_fixes.hpp similarity index 100% rename from glm/core/_fixes.hpp rename to glm/detail/_fixes.hpp diff --git a/glm/core/_literals.hpp b/glm/detail/_literals.hpp similarity index 100% rename from glm/core/_literals.hpp rename to glm/detail/_literals.hpp diff --git a/glm/detail/_noise.hpp b/glm/detail/_noise.hpp new file mode 100644 index 00000000..f678a3db --- /dev/null +++ b/glm/detail/_noise.hpp @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// 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. +/// +/// 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 core +/// @file glm/detail/_noise.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_DETAIL_NOISE_INCLUDED +#define GLM_DETAIL_NOISE_INCLUDED + +namespace glm{ +namespace detail +{ + template + GLM_FUNC_QUALIFIER T mod289(T const & x) + { + return x - floor(x * T(1.0 / 289.0)) * T(289.0); + } + + template + GLM_FUNC_QUALIFIER T permute(T const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType permute(vecType const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } +*/ + template + GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 taylorInvSqrt(detail::tvec2 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 taylorInvSqrt(detail::tvec3 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 taylorInvSqrt(detail::tvec4 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +*/ + + template + GLM_FUNC_QUALIFIER detail::tvec2 fade(detail::tvec2 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 fade(detail::tvec3 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 fade(detail::tvec4 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType fade(vecType const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +*/ +}//namespace detail +}//namespace glm + +#endif//GLM_DETAIL_NOISE_INCLUDED + diff --git a/glm/core/_swizzle.hpp b/glm/detail/_swizzle.hpp similarity index 90% rename from glm/core/_swizzle.hpp rename to glm/detail/_swizzle.hpp index d97de67b..8cd16cf0 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/detail/_swizzle.hpp @@ -29,27 +29,6 @@ #ifndef glm_core_swizzle #define glm_core_swizzle -#include "_swizzle_func.hpp" - -namespace glm -{ - enum comp - { - X = 0, - R = 0, - S = 0, - Y = 1, - G = 1, - T = 1, - Z = 2, - B = 2, - P = 2, - W = 3, - A = 3, - Q = 3 - }; -}//namespace glm - namespace glm{ namespace detail { @@ -60,8 +39,8 @@ namespace detail typedef T value_type; protected: - value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } + GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. // The size 1 buffer is assumed to aligned to the actual members so that the @@ -77,19 +56,19 @@ namespace detail template struct _swizzle_base1 : public _swizzle_base0 { - V operator ()() const { return V(this->elem(E0), this->elem(E1)); } + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); } }; template struct _swizzle_base1 : public _swizzle_base0 { - V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } }; template struct _swizzle_base1 : public _swizzle_base0 { - V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } }; // Internal class for implementing swizzle operators @@ -110,67 +89,73 @@ namespace detail typedef VecType vec_type; typedef ValueType value_type; - _swizzle_base2& operator= (const ValueType& t) + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t) { for (int i = 0; i < N; ++i) (*this)[i] = t; return *this; } - _swizzle_base2& operator= (const VecType& that) + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e = t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; } }; _apply_op(that, op()); return *this; } - void operator -= (const VecType& that) + GLM_FUNC_QUALIFIER void operator -= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e -= t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; } }; _apply_op(that, op()); } - void operator += (const VecType& that) + GLM_FUNC_QUALIFIER void operator += (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e += t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; } }; _apply_op(that, op()); } - void operator *= (const VecType& that) + GLM_FUNC_QUALIFIER void operator *= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e *= t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; } }; _apply_op(that, op()); } - void operator /= (const VecType& that) + GLM_FUNC_QUALIFIER void operator /= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e /= t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; } }; _apply_op(that, op()); } - value_type& operator[] (size_t i) + GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } - value_type operator[] (size_t i) const + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } protected: template - void _apply_op(const VecType& that, T op) + GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) { // Make a copy of the data in this == &that. // The copier should optimize out the copy in cases where the function is @@ -191,11 +176,14 @@ namespace detail typedef ValueType value_type; struct Stub {}; - _swizzle_base2& operator= (Stub const &) {} + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; } - value_type operator[] (size_t i) const + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } }; @@ -207,7 +195,7 @@ namespace detail using base_type::operator=; - operator VecType () const { return (*this)(); } + GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); } }; // @@ -223,17 +211,17 @@ namespace detail // #define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ _GLM_SWIZZLE_TEMPLATE2 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ { \ return a() OPERAND b(); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ { \ return a() OPERAND b; \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return a OPERAND b(); \ } @@ -243,12 +231,12 @@ namespace detail // #define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ { \ return a() OPERAND b; \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return a OPERAND b(); \ } @@ -258,7 +246,7 @@ namespace detail // #define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ { \ return FUNCTION(a()); \ } @@ -268,22 +256,22 @@ namespace detail // #define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ _GLM_SWIZZLE_TEMPLATE2 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ { \ return FUNCTION(a(), b()); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return FUNCTION(a(), b()); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ { \ return FUNCTION(a(), b); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return FUNCTION(a, b()); \ } @@ -293,22 +281,22 @@ namespace detail // #define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ _GLM_SWIZZLE_TEMPLATE2 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ { \ return FUNCTION(a(), b(), c); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ { \ return FUNCTION(a(), b(), c); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ { \ return FUNCTION(a(), b, c); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ { \ return FUNCTION(a, b(), c); \ } @@ -640,6 +628,22 @@ namespace glm struct { _swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ struct { _swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ struct { _swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ + struct { _swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ + struct { _swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ + struct { _swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ + struct { _swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ + struct { _swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ + struct { _swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ + struct { _swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ + struct { _swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ + struct { _swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ + struct { _swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ + struct { _swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ + struct { _swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ + struct { _swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ + struct { _swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ + struct { _swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ + struct { _swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ struct { _swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ struct { _swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ struct { _swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ @@ -831,6 +835,6 @@ namespace glm struct { _swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ struct { _swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ struct { _swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; + struct { _swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; #endif//glm_core_swizzle diff --git a/glm/core/_swizzle_func.hpp b/glm/detail/_swizzle_func.hpp similarity index 91% rename from glm/core/_swizzle_func.hpp rename to glm/detail/_swizzle_func.hpp index eba83830..293bba9b 100644 --- a/glm/core/_swizzle_func.hpp +++ b/glm/detail/_swizzle_func.hpp @@ -104,7 +104,7 @@ #define GLM_SWIZZLE_GEN_REF_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE) \ GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, x, y, z) \ GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, q) + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, p) //GLM_SWIZZLE_GEN_REF_FROM_VEC3(valType, detail::vec3, detail::ref2, detail::ref3) @@ -182,7 +182,7 @@ #define GLM_SWIZZLE_GEN_REF_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, q, p) + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) //GLM_SWIZZLE_GEN_REF_FROM_VEC4(valType, detail::vec4, detail::ref2, detail::ref3, detail::ref4) @@ -300,15 +300,6 @@ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ @@ -336,15 +327,6 @@ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ @@ -371,52 +353,7 @@ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) #define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) \ GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) \ @@ -426,7 +363,7 @@ #define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z) \ GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, q) + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p) //GLM_SWIZZLE_GEN_VEC_FROM_VEC3(valType, detail::vec3, detail::vec2, detail::vec3, detail::vec4) @@ -780,7 +717,7 @@ #define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, q, p) + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) //GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) diff --git a/glm/core/_vectorize.hpp b/glm/detail/_vectorize.hpp similarity index 97% rename from glm/core/_vectorize.hpp rename to glm/detail/_vectorize.hpp index 0e2ff1ad..3b9bdb9e 100644 --- a/glm/core/_vectorize.hpp +++ b/glm/detail/_vectorize.hpp @@ -29,6 +29,10 @@ #ifndef GLM_CORE_DETAIL_INCLUDED #define GLM_CORE_DETAIL_INCLUDED +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + #define VECTORIZE2_VEC(func) \ template \ GLM_FUNC_QUALIFIER detail::tvec2 func( \ @@ -72,7 +76,7 @@ GLM_FUNC_QUALIFIER detail::tvec2 func \ ( \ detail::tvec2 const & x, \ - typename detail::tvec2::value_type const & y \ + T const & y \ ) \ { \ return detail::tvec2( \ @@ -85,7 +89,7 @@ GLM_FUNC_QUALIFIER detail::tvec3 func \ ( \ detail::tvec3 const & x, \ - typename detail::tvec3::value_type const & y \ + T const & y \ ) \ { \ return detail::tvec3( \ @@ -99,7 +103,7 @@ GLM_FUNC_QUALIFIER detail::tvec4 func \ ( \ detail::tvec4 const & x, \ - typename detail::tvec4::value_type const & y \ + T const & y \ ) \ { \ return detail::tvec4( \ diff --git a/glm/core/dummy.cpp b/glm/detail/dummy.cpp similarity index 95% rename from glm/core/dummy.cpp rename to glm/detail/dummy.cpp index add3fbb2..c7c6ed39 100644 --- a/glm/core/dummy.cpp +++ b/glm/detail/dummy.cpp @@ -32,6 +32,10 @@ #define GLM_MESSAGES #include "../glm.hpp" +#include +/* +#if(GLM_ARCH & GLM_ARCH_SSE2) + #include #include #include @@ -39,7 +43,7 @@ #include #include -class base +struct float4 { public: typedef void (base::*method)() const; @@ -330,6 +334,28 @@ int main() mask = mask<<1; } } +#endif//GLM_ARCH +*/ + +template +class C; + +template +class C +{ +public: + T value; +}; + +int main() +{ +/* +# if(GLM_ARCH & GLM_ARCH_SSE2) + test_simd(); +# endif +*/ + + C<> c; return 0; } diff --git a/glm/core/func_common.hpp b/glm/detail/func_common.hpp similarity index 79% rename from glm/core/func_common.hpp rename to glm/detail/func_common.hpp index bcc589f3..9ba6e74a 100644 --- a/glm/core/func_common.hpp +++ b/glm/detail/func_common.hpp @@ -33,8 +33,8 @@ /// These all operate component-wise. The description is per component. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_func_common -#define GLM_CORE_func_common GLM_VERSION +#ifndef GLM_FUNC_COMMON_INCLUDED +#define GLM_FUNC_COMMON_INCLUDED #include "setup.hpp" #include "_fixes.hpp" @@ -51,7 +51,7 @@ namespace glm /// @see GLSL abs man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType abs(genType const & x); + GLM_FUNC_DECL genType abs(genType const & x); /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. /// @@ -60,8 +60,8 @@ namespace glm /// @see GLSL sign man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType sign(genType const & x); - + GLM_FUNC_DECL genType sign(genType const & x); + /// Returns a value equal to the nearest integer that is less then or equal to x. /// /// @tparam genType Floating-point scalar or vector types. @@ -69,7 +69,7 @@ namespace glm /// @see GLSL floor man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType floor(genType const & x); + GLM_FUNC_DECL genType floor(genType const & x); /// Returns a value equal to the nearest integer to x /// whose absolute value is not larger than the absolute value of x. @@ -79,7 +79,7 @@ namespace glm /// @see GLSL trunc man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType trunc(genType const & x); + GLM_FUNC_DECL genType trunc(genType const & x); /// Returns a value equal to the nearest integer to x. /// The fraction 0.5 will round in a direction chosen by the @@ -92,8 +92,8 @@ namespace glm /// @see GLSL round man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType round(genType const & x); - + GLM_FUNC_DECL genType round(genType const & x); + /// Returns a value equal to the nearest integer to x. /// A fractional part of 0.5 will round toward the nearest even /// integer. (Both 3.5 and 4.5 for x will return 4.0.) @@ -104,7 +104,7 @@ namespace glm /// @see GLSL 4.20.8 specification, section 8.3 Common Functions /// @see New round to even technique template - genType roundEven(genType const & x); + GLM_FUNC_DECL genType roundEven(genType const & x); /// Returns a value equal to the nearest integer /// that is greater than or equal to x. @@ -114,7 +114,7 @@ namespace glm /// @see GLSL ceil man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType ceil(genType const & x); + GLM_FUNC_DECL genType ceil(genType const & x); /// Return x - floor(x). /// @@ -123,7 +123,7 @@ namespace glm /// @see GLSL fract man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType fract(genType const & x); + GLM_FUNC_DECL genType fract(genType const & x); /// Modulus. Returns x - y * floor(x / y) /// for each component in x using the floating point value y. @@ -133,7 +133,7 @@ namespace glm /// @see GLSL mod man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType mod( + GLM_FUNC_DECL genType mod( genType const & x, genType const & y); @@ -145,7 +145,7 @@ namespace glm /// @see GLSL mod man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType mod( + GLM_FUNC_DECL genType mod( genType const & x, typename genType::value_type const & y); @@ -159,7 +159,7 @@ namespace glm /// @see GLSL modf man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType modf( + GLM_FUNC_DECL genType modf( genType const & x, genType & i); @@ -168,14 +168,14 @@ namespace glm /// @tparam genType Floating-point or integer; scalar or vector types. /// /// @see GLSL min man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions<<<<<<< HEAD template - genType min( + GLM_FUNC_DECL genType min( genType const & x, genType const & y); template - genType min( + GLM_FUNC_DECL genType min( genType const & x, typename genType::value_type const & y); @@ -186,12 +186,12 @@ namespace glm /// @see GLSL max man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType max( + GLM_FUNC_DECL genType max( genType const & x, genType const & y); template - genType max( + GLM_FUNC_DECL genType max( genType const & x, typename genType::value_type const & y); @@ -203,13 +203,13 @@ namespace glm /// @see GLSL clamp man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType clamp( + GLM_FUNC_DECL genType clamp( genType const & x, genType const & minVal, genType const & maxVal); template - genType clamp( + GLM_FUNC_DECL genType clamp( genType const & x, typename genType::value_type const & minVal, typename genType::value_type const & maxVal); @@ -257,21 +257,28 @@ namespace glm /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. /// @endcode template - genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a); + GLM_FUNC_DECL genTypeT mix( + genTypeT const & x, + genTypeT const & y, + genTypeU const & a); - //! Returns 0.0 if x < edge, otherwise it returns 1.0. - //! + /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType. + /// /// @see GLSL step man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType step( + GLM_FUNC_DECL genType step( genType const & edge, genType const & x); - template - genType step( - typename genType::value_type const & edge, - genType const & x); + /// Returns 0.0 if x < edge, otherwise it returns 1.0. + /// + /// @see GLSL step man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template