This commit is contained in:
Christophe Riccio 2013-12-25 23:36:11 +01:00
commit e9d7e8e00b
325 changed files with 10705 additions and 14159 deletions

View File

@ -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)
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()
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)
if(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
add_definitions(/Za)
endif()
endif()
#set(GLM_SIMD_INSTRUCTION_SET "" CACHE STRING "Instruction set. Possible values are SSE1, SSE2")
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)
endif()
elseif(NOT GLM_TEST_ENABLE_SIMD)
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()

Binary file not shown.

Binary file not shown.

BIN
doc/~$glm.docx Normal file

Binary file not shown.

View File

@ -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)

34
glm/common.hpp Normal file
View File

@ -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

View File

@ -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 <typename matType>
GLM_FUNC_QUALIFIER matType matrixCompMult
(
matType const & x,
matType const & y
)
{
GLM_STATIC_ASSERT(detail::type<typename matType::value_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> outerProduct
(
detail::tvec2<T, P> const & c,
detail::tvec2<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> outerProduct
(
detail::tvec3<T, P> const & c,
detail::tvec3<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null);
for(typename detail::tmat3x3<T, P>::size_type i(0); i < m.length(); ++i)
m[i] = c * r[i];
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> outerProduct
(
detail::tvec4<T, P> const & c,
detail::tvec4<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null);
for(typename detail::tmat4x4<T, P>::size_type i(0); i < m.length(); ++i)
m[i] = c * r[i];
return m;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x3<T, P> outerProduct
(
detail::tvec3<T, P> const & c,
detail::tvec2<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x2<T, P> outerProduct
(
detail::tvec2<T, P> const & c,
detail::tvec3<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x4<T, P> outerProduct
(
detail::tvec4<T, P> const & c,
detail::tvec2<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x2<T, P> outerProduct
(
detail::tvec2<T, P> const & c,
detail::tvec4<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x4<T, P> outerProduct
(
detail::tvec4<T, P> const & c,
detail::tvec3<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x3<T, P> outerProduct
(
detail::tvec3<T, P> const & c,
detail::tvec4<T, P> const & r
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'outerProduct' only accept floating-point inputs");
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> transpose
(
detail::tmat2x2<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> transpose
(
detail::tmat3x3<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> transpose
(
detail::tmat4x4<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x3<T, P> transpose
(
detail::tmat3x2<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x2<T, P> transpose
(
detail::tmat2x3<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x4<T, P> transpose
(
detail::tmat4x2<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x2<T, P> transpose
(
detail::tmat2x4<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x4<T, P> transpose
(
detail::tmat4x3<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x3<T, P> transpose
(
detail::tmat3x4<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'transpose' only accept floating-point inputs");
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tmat2x2<T, P>::value_type determinant
(
detail::tmat2x2<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'determinant' only accept floating-point inputs");
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tmat3x3<T, P>::value_type determinant
(
detail::tmat3x3<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::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 <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tmat4x4<T, P>::value_type determinant
(
detail::tmat4x4<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::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<T, P> 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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat2x2<T, P> inverse
(
detail::tmat2x2<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::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<T, P> Inverse(
+ m[1][1] / Determinant,
- m[0][1] / Determinant,
- m[1][0] / Determinant,
+ m[0][0] / Determinant);
return Inverse;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> inverse
(
detail::tmat3x3<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::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<T, P> Inverse(detail::tmat3x3<T, P>::_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 <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> inverse
(
detail::tmat4x4<T, P> const & m
)
{
GLM_STATIC_ASSERT(detail::type<T>::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<T, P> const SignA(+1, -1, +1, -1);
detail::tvec4<T, P> const SignB(-1, +1, -1, +1);
detail::tvec4<T, P> Fac0(Coef00, Coef00, Coef02, Coef03);
detail::tvec4<T, P> Fac1(Coef04, Coef04, Coef06, Coef07);
detail::tvec4<T, P> Fac2(Coef08, Coef08, Coef10, Coef11);
detail::tvec4<T, P> Fac3(Coef12, Coef12, Coef14, Coef15);
detail::tvec4<T, P> Fac4(Coef16, Coef16, Coef18, Coef19);
detail::tvec4<T, P> Fac5(Coef20, Coef20, Coef22, Coef23);
detail::tvec4<T, P> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
detail::tvec4<T, P> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
detail::tvec4<T, P> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
detail::tvec4<T, P> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
detail::tvec4<T, P> Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
detail::tvec4<T, P> Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
detail::tvec4<T, P> Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
detail::tvec4<T, P> Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
detail::tmat4x4<T, P> Inverse(Inv0, Inv1, Inv2, Inv3);
detail::tvec4<T, P> 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

View File

@ -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

View File

@ -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 <typename U>
GLM_FUNC_DECL explicit half(U const & s);
// Cast
//template <typename U>
//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

130
glm/detail/_noise.hpp Normal file
View File

@ -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 <typename T>
GLM_FUNC_QUALIFIER T mod289(T const & x)
{
return x - floor(x * T(1.0 / 289.0)) * T(289.0);
}
template <typename T>
GLM_FUNC_QUALIFIER T permute(T const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
*/
template <typename T>
GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
*/
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
/*
template <typename T, precision P, template <typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
*/
}//namespace detail
}//namespace glm
#endif//GLM_DETAIL_NOISE_INCLUDED

View File

@ -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<value_type*>(_buffer))[i]; }
const value_type& elem (size_t i) const { return (reinterpret_cast<const value_type*>(_buffer))[i]; }
GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast<value_type*>(_buffer))[i]; }
GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast<const value_type*>(_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 <typename T, precision P, typename V, int E0, int E1>
struct _swizzle_base1<T, P, V,E0,E1,-1,-2,2> : public _swizzle_base0<T, 2>
{
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 <typename T, precision P, typename V, int E0, int E1, int E2>
struct _swizzle_base1<T, P, V,E0,E1,E2,-1,3> : public _swizzle_base0<T, 3>
{
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 <typename T, precision P, typename V, int E0, int E1, int E2, int E3>
struct _swizzle_base1<T, P, V,E0,E1,E2,E3,4> : public _swizzle_base0<T, 4>
{
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 <typename T>
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<T, P>, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \
struct { _swizzle<4, T, P, V<T, P>, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \
struct { _swizzle<4, T, P, V<T, P>, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \
struct { _swizzle<4, T, P, V<T, P>, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \
struct { _swizzle<4, T, P, V<T, P>, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \

View File

@ -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)

View File

@ -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 <typename T, precision P> \
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \
@ -72,7 +76,7 @@
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
( \
detail::tvec2<T, P> const & x, \
typename detail::tvec2<T, P>::value_type const & y \
T const & y \
) \
{ \
return detail::tvec2<T, P>( \
@ -85,7 +89,7 @@
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
( \
detail::tvec3<T, P> const & x, \
typename detail::tvec3<T, P>::value_type const & y \
T const & y \
) \
{ \
return detail::tvec3<T, P>( \
@ -99,7 +103,7 @@
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
( \
detail::tvec4<T, P> const & x, \
typename detail::tvec4<T, P>::value_type const & y \
T const & y \
) \
{ \
return detail::tvec4<T, P>( \

View File

@ -32,6 +32,10 @@
#define GLM_MESSAGES
#include "../glm.hpp"
#include <limits>
/*
#if(GLM_ARCH & GLM_ARCH_SSE2)
#include <vector>
#include <array>
#include <cstdio>
@ -39,7 +43,7 @@
#include <thread>
#include <mutex>
class base
struct float4
{
public:
typedef void (base::*method)() const;
@ -330,6 +334,28 @@ int main()
mask = mask<<1;
}
}
#endif//GLM_ARCH
*/
template <class T = int>
class C;
template <class T>
class C
{
public:
T value;
};
int main()
{
/*
# if(GLM_ARCH & GLM_ARCH_SSE2)
test_simd();
# endif
*/
C<> c;
return 0;
}

View File

@ -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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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,7 +60,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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.
///
@ -69,7 +69,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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,7 +92,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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
@ -104,7 +104,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType ceil(genType const & x);
GLM_FUNC_DECL genType ceil(genType const & x);
/// Return x - floor(x).
///
@ -123,7 +123,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType mod(
GLM_FUNC_DECL genType mod(
genType const & x,
genType const & y);
@ -145,7 +145,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType mod(
GLM_FUNC_DECL genType mod(
genType const & x,
typename genType::value_type const & y);
@ -159,7 +159,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a><<<<<<< HEAD
template <typename genType>
genType min(
GLM_FUNC_DECL genType min(
genType const & x,
genType const & y);
template <typename genType>
genType min(
GLM_FUNC_DECL genType min(
genType const & x,
typename genType::value_type const & y);
@ -186,12 +186,12 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType max(
GLM_FUNC_DECL genType max(
genType const & x,
genType const & y);
template <typename genType>
genType max(
GLM_FUNC_DECL genType max(
genType const & x,
typename genType::value_type const & y);
@ -203,13 +203,13 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType clamp(
GLM_FUNC_DECL genType clamp(
genType const & x,
genType const & minVal,
genType const & maxVal);
template <typename genType, precision P>
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 <typename genTypeT, typename genTypeU>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType step(
GLM_FUNC_DECL genType step(
genType const & edge,
genType const & x);
template <typename genType>
genType step(
typename genType::value_type const & edge,
genType const & x);
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <template <typename, precision> class vecType, typename T, precision P>
GLM_FUNC_DECL vecType<T, P> step(
T const & edge,
vecType<T, P> const & x);
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
/// performs smooth Hermite interpolation between 0 and 1
@ -288,13 +295,13 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType smoothstep(
GLM_FUNC_DECL genType smoothstep(
genType const & edge0,
genType const & edge1,
genType const & x);
template <typename genType>
genType smoothstep(
GLM_FUNC_DECL genType smoothstep(
typename genType::value_type const & edge0,
typename genType::value_type const & edge1,
genType const & x);
@ -312,7 +319,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
typename genType::bool_type isnan(genType const & x);
GLM_FUNC_DECL typename genType::bool_type isnan(genType const & x);
/// Returns true if x holds a positive infinity or negative
/// infinity representation in the underlying implementation's
@ -325,31 +332,41 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
typename genType::bool_type isinf(genType const & x);
GLM_FUNC_DECL typename genType::bool_type isinf(genType const & x);
/// Returns a signed integer value representing
/// the encoding of a floating-point value. The floating-point
/// value's bit-level representation is preserved.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
GLM_FUNC_DECL int floatBitsToInt(float const & v);
/// Returns a signed integer value representing
/// the encoding of a floating-point value. The floatingpoint
/// value's bit-level representation is preserved.
///
/// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genIType Signed integer scalar or vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
genIType floatBitsToInt(genType const & value);
template <template <typename, precision> class vecType, precision P>
GLM_FUNC_DECL vecType<int, P> floatBitsToInt(vecType<float, P> const & v);
/// Returns a unsigned integer value representing
/// the encoding of a floating-point value. The floatingpoint
/// value's bit-level representation is preserved.
///
/// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genUType Unsigned integer scalar or vector types.
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
GLM_FUNC_DECL uint floatBitsToUint(float const & v);
/// Returns a unsigned integer value representing
/// the encoding of a floating-point value. The floatingpoint
/// value's bit-level representation is preserved.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genUType>
genUType floatBitsToUint(genType const & value);
template <template <typename, precision> class vecType, precision P>
GLM_FUNC_DECL vecType<uint, P> floatBitsToUint(vecType<float, P> const & v);
/// Returns a floating-point value corresponding to a signed
/// integer encoding of a floating-point value.
@ -357,15 +374,20 @@ namespace glm
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genIType Signed integer scalar or vector types.
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
GLM_FUNC_DECL float intBitsToFloat(int const & v);
/// Returns a floating-point value corresponding to a signed
/// integer encoding of a floating-point value.
/// If an inf or NaN is passed in, it will not signal, and the
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
///
/// @todo Clarify this declaration, we don't need to actually specify the return type
template <typename genType, typename genIType>
genType intBitsToFloat(genIType const & value);
template <template <typename, precision> class vecType, precision P>
GLM_FUNC_DECL vecType<float, P> intBitsToFloat(vecType<int, P> const & v);
/// Returns a floating-point value corresponding to a
/// unsigned integer encoding of a floating-point value.
@ -373,15 +395,20 @@ namespace glm
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @tparam genType Single-precision floating-point scalar or vector types.
/// @tparam genUType Unsigned integer scalar or vector types.
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
GLM_FUNC_DECL float uintBitsToFloat(uint const & v);
/// Returns a floating-point value corresponding to a
/// unsigned integer encoding of a floating-point value.
/// If an inf or NaN is passed in, it will not signal, and the
/// resulting floating point value is unspecified. Otherwise,
/// the bit-level representation is preserved.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
///
/// @todo Clarify this declaration, we don't need to actually specify the return type
template <typename genType, typename genUType>
genType uintBitsToFloat(genUType const & value);
template <template <typename, precision> class vecType, precision P>
GLM_FUNC_DECL vecType<float, P> uintBitsToFloat(vecType<uint, P> const & v);
/// Computes and returns a * b + c.
///
@ -390,7 +417,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType fma(genType const & a, genType const & b, genType const & c);
GLM_FUNC_DECL genType fma(genType const & a, genType const & b, genType const & c);
/// Splits x into a floating-point significand in the range
/// [0.5, 1.0) and an integral exponent of two, such that:
@ -407,7 +434,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
genType frexp(genType const & x, genIType & exp);
GLM_FUNC_DECL genType frexp(genType const & x, genIType & exp);
/// Builds a floating-point number from x and the
/// corresponding integral exponent of two in exp, returning:
@ -421,11 +448,11 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
genType ldexp(genType const & x, genIType const & exp);
GLM_FUNC_DECL genType ldexp(genType const & x, genIType const & exp);
/// @}
}//namespace glm
#include "func_common.inl"
#endif//GLM_CORE_func_common
#endif//GLM_FUNC_COMMON_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,13 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_exponential
#define glm_core_func_exponential GLM_VERSION
#define glm_core_func_exponential
#include "type_vec1.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include <cmath>
namespace glm
{
@ -50,7 +56,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType pow(genType const & base, genType const & exponent);
GLM_FUNC_DECL genType pow(genType const & base, genType const & exponent);
/// Returns the natural exponentiation of x, i.e., e^x.
///
@ -60,7 +66,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType exp(genType const & x);
GLM_FUNC_DECL genType exp(genType const & x);
/// Returns the natural logarithm of x, i.e.,
/// returns the value y which satisfies the equation x = e^y.
@ -72,7 +78,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType log(genType const & x);
GLM_FUNC_DECL genType log(genType const & x);
/// Returns 2 raised to the x power.
///
@ -82,7 +88,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType exp2(genType const & x);
GLM_FUNC_DECL genType exp2(genType const & x);
/// Returns the base 2 log of x, i.e., returns the value y,
/// which satisfies the equation x = 2 ^ y.
@ -93,7 +99,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType log2(genType const & x);
GLM_FUNC_DECL genType log2(genType const & x);
/// Returns the positive square root of x.
///
@ -103,7 +109,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType sqrt(genType const & x);
GLM_FUNC_DECL genType sqrt(genType const & x);
/// Returns the reciprocal of the positive square root of x.
///
@ -113,7 +119,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
template <typename genType>
genType inversesqrt(genType const & x);
GLM_FUNC_DECL genType inversesqrt(genType const & x);
/// @}
}//namespace glm

View File

@ -26,6 +26,11 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "func_vector_relational.hpp"
#include "_vectorize.hpp"
#include <limits>
#include <cassert>
namespace glm
{
// pow
@ -36,9 +41,11 @@ namespace glm
genType const & y
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input");
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'pow' only accept floating-point inputs");
return genType(::std::pow(x, y));
return std::pow(x, y);
}
VECTORIZE_VEC_VEC(pow)
@ -50,9 +57,11 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input");
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'exp' only accept floating-point inputs");
return genType(::std::exp(x));
return std::exp(x);
}
VECTORIZE_VEC(exp)
@ -64,9 +73,11 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input");
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'log' only accept floating-point inputs");
return genType(::std::log(x));
return std::log(x);
}
VECTORIZE_VEC(log)
@ -78,39 +89,35 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input");
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'exp2' only accept floating-point inputs");
return genType(::std::exp(genType(0.69314718055994530941723212145818) * x));
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
}
VECTORIZE_VEC(exp2)
namespace _detail
namespace detail
{
template <int _PATH = detail::float_or_int_value::GLM_ERROR>
struct _compute_log2
template <bool isFloat>
struct compute_log2
{
template <typename T>
T operator() (T const & Value) const;
/*
{
GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include <glm/gtx/integer.hpp> for integer types support. Others types are not supported.");
return Value;
}
*/
};
template <>
struct _compute_log2<detail::float_or_int_value::GLM_FLOAT>
struct compute_log2<true>
{
template <typename T>
T operator() (T const & Value) const
{
return T(::std::log(Value)) / T(0.69314718055994530941723212145818);
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
}
};
}//namespace _detail
}//namespace detail
// log2, ln2 = 0.69314718055994530941723212145818f
template <typename genType>
@ -119,8 +126,11 @@ namespace _detail
genType const & x
)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
"GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support.");
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
return _detail::_compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
return detail::compute_log2<std::numeric_limits<genType>::is_iec559>()(x);
}
VECTORIZE_VEC(log2)
@ -132,9 +142,13 @@ namespace _detail
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input");
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'sqrt' only accept floating-point inputs");
return genType(::std::sqrt(x));
assert(x >= genType(0));
return std::sqrt(x);
}
VECTORIZE_VEC(sqrt)
@ -145,11 +159,62 @@ namespace _detail
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input");
GLM_STATIC_ASSERT(
std::numeric_limits<genType>::is_iec559,
"'inversesqrt' only accept floating-point inputs");
return genType(1) / ::std::sqrt(x);
assert(x > genType(0));
return genType(1) / std::sqrt(x);
}
VECTORIZE_VEC(inversesqrt)
namespace detail
{
template <typename genType, typename genUType>
genType fastInversesqrt(genType const & v)
{
genType tmp(v);
genType xhalf(tmp * genType(0.5f));
genUType i = *reinterpret_cast<genUType*>(const_cast<genType*>(&v));
i = genUType(0x5f375a86) - (i >> genUType(1));
tmp = *reinterpret_cast<genType*>(&i);
tmp = tmp * (genType(1.5f) - xhalf * tmp * tmp);
return tmp;
}
}
template <>
GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v)
{
assert(glm::all(glm::greaterThan(v, lowp_vec1(0))));
return detail::fastInversesqrt<lowp_vec1, uint>(v);
}
template <>
GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v)
{
assert(glm::all(glm::greaterThan(v, lowp_vec2(0))));
return detail::fastInversesqrt<lowp_vec2, lowp_uvec2>(v);
}
template <>
GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v)
{
assert(glm::all(glm::greaterThan(v, lowp_vec3(0))));
return detail::fastInversesqrt<lowp_vec3, lowp_uvec3>(v);
}
template <>
GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v)
{
assert(glm::all(glm::greaterThan(v, lowp_vec4(0))));
return detail::fastInversesqrt<lowp_vec4, lowp_uvec4>(v);
}
}//namespace glm

View File

@ -34,7 +34,9 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_geometric
#define glm_core_func_geometric GLM_VERSION
#define glm_core_func_geometric
#include "type_vec3.hpp"
namespace glm
{
@ -48,7 +50,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
typename genType::value_type length(
GLM_FUNC_DECL typename genType::value_type length(
genType const & x);
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
@ -58,10 +60,21 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
typename genType::value_type distance(
GLM_FUNC_DECL typename genType::value_type distance(
genType const & p0,
genType const & p1);
/// Returns the dot product of x and y, i.e., result = x * y.
///
/// @tparam genType Floating-point vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL T dot(
vecType<T, P> const & x,
vecType<T, P> const & y);
/*
/// Returns the dot product of x and y, i.e., result = x * y.
///
/// @tparam genType Floating-point vector types.
@ -69,10 +82,10 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
typename genType::value_type dot(
GLM_FUNC_DECL genType dot(
genType const & x,
genType const & y);
*/
/// Returns the cross product of x and y.
///
/// @tparam valType Floating-point scalar types.
@ -80,7 +93,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename T, precision P>
detail::tvec3<T, P> cross(
GLM_FUNC_DECL detail::tvec3<T, P> cross(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y);
@ -89,7 +102,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType normalize(
GLM_FUNC_DECL genType normalize(
genType const & x);
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
@ -99,7 +112,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType faceforward(
GLM_FUNC_DECL genType faceforward(
genType const & N,
genType const & I,
genType const & Nref);
@ -112,7 +125,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType reflect(
GLM_FUNC_DECL genType reflect(
genType const & I,
genType const & N);
@ -124,11 +137,11 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
template <typename genType>
genType refract(
genType const & I,
genType const & N,
typename genType::value_type const & eta);
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> refract(
vecType<T, P> const & I,
vecType<T, P> const & N,
T const & eta);
/// @}
}//namespace glm

View File

@ -26,8 +26,49 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
namespace glm
#include "func_exponential.hpp"
#include "func_common.hpp"
#include "type_vec2.hpp"
#include "type_vec4.hpp"
#include "type_float.hpp"
namespace glm{
namespace detail
{
template <template <class, precision> class vecType, typename T, precision P>
struct compute_dot{};
template <typename T, precision P>
struct compute_dot<detail::tvec2, T, P>
{
static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y)
{
detail::tvec2<T, P> tmp(x * y);
return tmp.x + tmp.y;
}
};
template <typename T, precision P>
struct compute_dot<detail::tvec3, T, P>
{
static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y)
{
detail::tvec3<T, P> tmp(x * y);
return tmp.x + tmp.y + tmp.z;
}
};
template <typename T, precision P>
struct compute_dot<detail::tvec4, T, P>
{
static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y)
{
detail::tvec4<T, P> tmp(x * y);
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
}
};
}//namespace detail
// length
template <typename genType>
GLM_FUNC_QUALIFIER genType length
@ -35,7 +76,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'length' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
genType sqr = x * x;
return sqrt(sqr);
@ -44,27 +85,27 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_QUALIFIER T length(detail::tvec2<T, P> const & v)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
typename detail::tvec2<T, P>::value_type sqr = v.x * v.x + v.y * v.y;
T sqr = v.x * v.x + v.y * v.y;
return sqrt(sqr);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T length(detail::tvec3<T, P> const & v)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
typename detail::tvec3<T, P>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z;
T sqr = v.x * v.x + v.y * v.y + v.z * v.z;
return sqrt(sqr);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T length(detail::tvec4<T, P> const & v)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
typename detail::tvec4<T, P>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
T sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
return sqrt(sqr);
}
@ -76,83 +117,77 @@ namespace glm
genType const & p1
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'distance' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' only accept floating-point inputs");
return length(p1 - p0);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::value_type distance
GLM_FUNC_QUALIFIER T distance
(
detail::tvec2<T, P> const & p0,
detail::tvec2<T, P> const & p1
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
return length(p1 - p0);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::value_type distance
GLM_FUNC_QUALIFIER T distance
(
detail::tvec3<T, P> const & p0,
detail::tvec3<T, P> const & p1
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
return length(p1 - p0);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::value_type distance
GLM_FUNC_QUALIFIER T distance
(
detail::tvec4<T, P> const & p0,
detail::tvec4<T, P> const & p1
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'distance' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
return length(p1 - p0);
}
// dot
template <typename genType>
GLM_FUNC_QUALIFIER genType dot
GLM_FUNC_QUALIFIER float dot
(
genType const & x,
genType const & y
float const & x,
float const & y
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'dot' only accept floating-point inputs");
return x * y;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::value_type dot
GLM_FUNC_QUALIFIER double dot
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y
double const & x,
double const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
return x.x * y.x + x.y * y.y;
return x * y;
}
template <typename T, precision P>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T dot
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y
vecType<T, P> const & x,
vecType<T, P> const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
return x.x * y.x + x.y * y.y + x.z * y.z;
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
return detail::compute_dot<vecType, T, P>::call(x, y);
}
/* // SSE3
GLM_FUNC_QUALIFIER float dot(const tvec4<float>& x, const tvec4<float>& y)
{
@ -170,18 +205,6 @@ namespace glm
return Result;
}
*/
template <typename T, precision P>
GLM_FUNC_QUALIFIER T dot
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w;
}
// cross
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> cross
@ -190,7 +213,7 @@ namespace glm
detail::tvec3<T, P> const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'cross' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' only accept floating-point inputs");
return detail::tvec3<T, P>(
x.y * y.z - y.y * x.z,
@ -205,7 +228,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'normalize' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
return x < genType(0) ? genType(-1) : genType(1);
}
@ -217,9 +240,9 @@ namespace glm
detail::tvec2<T, P> const & x
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
typename detail::tvec2<T, P>::value_type sqr = x.x * x.x + x.y * x.y;
T sqr = x.x * x.x + x.y * x.y;
return x * inversesqrt(sqr);
}
@ -229,9 +252,9 @@ namespace glm
detail::tvec3<T, P> const & x
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
typename detail::tvec3<T, P>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
T sqr = x.x * x.x + x.y * x.y + x.z * x.z;
return x * inversesqrt(sqr);
}
@ -241,9 +264,9 @@ namespace glm
detail::tvec4<T, P> const & x
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
typename detail::tvec4<T, P>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
T sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
return x * inversesqrt(sqr);
}
@ -279,8 +302,7 @@ namespace glm
genType const & eta
)
{
//It could be a vector
//GLM_STATIC_ASSERT(detail::type<genType>::is_float);
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' only accept floating-point inputs");
genType dotValue = dot(N, I);
genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue);
@ -290,23 +312,22 @@ namespace glm
return eta * I - (eta * dotValue + sqrt(k)) * N;
}
template <typename genType>
GLM_FUNC_QUALIFIER genType refract
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> refract
(
genType const & I,
genType const & N,
typename genType::value_type const & eta
vecType<T, P> const & I,
vecType<T, P> const & N,
T const & eta
)
{
//It could be a vector
//GLM_STATIC_ASSERT(detail::type<genType>::is_float);
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' only accept floating-point inputs");
typename genType::value_type dotValue = dot(N, I);
typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue);
if(k < typename genType::value_type(0))
return genType(0);
T dotValue = dot(N, I);
T k = T(1) - eta * eta * (T(1) - dotValue * dotValue);
if(k < T(0))
return vecType<T, P>(0);
else
return eta * I - (eta * dotValue + sqrt(k)) * N;
return eta * I - (eta * dotValue + std::sqrt(k)) * N;
}
}//namespace glm

View File

@ -36,7 +36,9 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_integer
#define glm_core_func_integer GLM_VERSION
#define glm_core_func_integer
#include "setup.hpp"
namespace glm
{
@ -52,7 +54,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genUType>
genUType uaddCarry(
GLM_FUNC_DECL genUType uaddCarry(
genUType const & x,
genUType const & y,
genUType & carry);
@ -66,7 +68,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genUType>
genUType usubBorrow(
GLM_FUNC_DECL genUType usubBorrow(
genUType const & x,
genUType const & y,
genUType & borrow);
@ -80,7 +82,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genUType>
void umulExtended(
GLM_FUNC_DECL void umulExtended(
genUType const & x,
genUType const & y,
genUType & msb,
@ -95,7 +97,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIType>
void imulExtended(
GLM_FUNC_DECL void imulExtended(
genIType const & x,
genIType const & y,
genIType & msb,
@ -117,7 +119,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIUType>
genIUType bitfieldExtract(
GLM_FUNC_DECL genIUType bitfieldExtract(
genIUType const & Value,
int const & Offset,
int const & Bits);
@ -137,7 +139,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIUType>
genIUType bitfieldInsert(
GLM_FUNC_DECL genIUType bitfieldInsert(
genIUType const & Base,
genIUType const & Insert,
int const & Offset,
@ -152,7 +154,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
template <typename genIUType>
genIUType bitfieldReverse(genIUType const & Value);
GLM_FUNC_DECL genIUType bitfieldReverse(genIUType const & Value);
/// Returns the number of bits set to 1 in the binary representation of value.
///
@ -163,7 +165,7 @@ namespace glm
///
/// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType>
typename genIUType<T>::signed_type bitCount(genIUType<T> const & Value);
GLM_FUNC_DECL typename genIUType<T>::signed_type bitCount(genIUType<T> const & Value);
/// Returns the bit number of the least significant bit set to
/// 1 in the binary representation of value.
@ -176,7 +178,7 @@ namespace glm
///
/// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType>
typename genIUType<T>::signed_type findLSB(genIUType<T> const & Value);
GLM_FUNC_DECL typename genIUType<T>::signed_type findLSB(genIUType<T> const & Value);
/// Returns the bit number of the most significant bit in the binary representation of value.
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
@ -190,7 +192,7 @@ namespace glm
///
/// @todo Clarify the declaration to specify that scalars are suported.
template <typename T, template <typename> class genIUType>
typename genIUType<T>::signed_type findMSB(genIUType<T> const & Value);
GLM_FUNC_DECL typename genIUType<T>::signed_type findMSB(genIUType<T> const & Value);
/// @}
}//namespace glm

View File

@ -26,64 +26,72 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include "type_int.hpp"
#include "_vectorize.hpp"
#if(GLM_ARCH != GLM_ARCH_PURE)
#if(GLM_COMPILER & GLM_COMPILER_VC)
#include <intrin.h>
#pragma intrinsic(_BitScanReverse)
#endif
# include <intrin.h>
# pragma intrinsic(_BitScanReverse)
#endif//(GLM_COMPILER & GLM_COMPILER_VC)
#endif//(GLM_ARCH != GLM_ARCH_PURE)
#include <limits>
namespace glm
{
// uaddCarry
template <typename genUType>
GLM_FUNC_QUALIFIER genUType uaddCarry
template <>
GLM_FUNC_QUALIFIER uint uaddCarry
(
genUType const & x,
genUType const & y,
genUType & Carry
uint const & x,
uint const & y,
uint & Carry
)
{
detail::highp_uint_t Value64 = detail::highp_uint_t(x) + detail::highp_uint_t(y);
genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32)));
Carry = (Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))) > 1 ? 1 : 0;
uint64 Value64 = static_cast<uint64>(x) + static_cast<uint64>(y);
uint32 Result = static_cast<uint32>(Value64 % (static_cast<uint64>(1) << static_cast<uint64>(32)));
Carry = (Value64 % (static_cast<uint64>(1) << static_cast<uint64>(32))) > 1 ? static_cast<uint32>(1) : static_cast<uint32>(0);
return Result;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> uaddCarry
template <>
GLM_FUNC_QUALIFIER uvec2 uaddCarry
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
detail::tvec2<T, P> & Carry
uvec2 const & x,
uvec2 const & y,
uvec2 & Carry
)
{
return detail::tvec2<T, P>(
return uvec2(
uaddCarry(x[0], y[0], Carry[0]),
uaddCarry(x[1], y[1], Carry[1]));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> uaddCarry
template <>
GLM_FUNC_QUALIFIER uvec3 uaddCarry
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
detail::tvec3<T, P> & Carry
uvec3 const & x,
uvec3 const & y,
uvec3 & Carry
)
{
return detail::tvec3<T, P>(
return uvec3(
uaddCarry(x[0], y[0], Carry[0]),
uaddCarry(x[1], y[1], Carry[1]),
uaddCarry(x[2], y[2], Carry[2]));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> uaddCarry
template <>
GLM_FUNC_QUALIFIER uvec4 uaddCarry
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
detail::tvec4<T, P> & Carry
uvec4 const & x,
uvec4 const & y,
uvec4 & Carry
)
{
return detail::tvec4<T, P>(
return uvec4(
uaddCarry(x[0], y[0], Carry[0]),
uaddCarry(x[1], y[1], Carry[1]),
uaddCarry(x[2], y[2], Carry[2]),
@ -91,57 +99,59 @@ namespace glm
}
// usubBorrow
template <typename genUType>
GLM_FUNC_QUALIFIER genUType usubBorrow
template <>
GLM_FUNC_QUALIFIER uint usubBorrow
(
genUType const & x,
genUType const & y,
genUType & Borrow
uint const & x,
uint const & y,
uint & Borrow
)
{
Borrow = x >= y ? 0 : 1;
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1);
if(x > y)
return genUType(detail::highp_int_t(x) - detail::highp_int_t(y));
return static_cast<uint32>(static_cast<int64>(x) -static_cast<int64>(y));
else
return genUType((detail::highp_int_t(1) << detail::highp_int_t(32)) + detail::highp_int_t(x) - detail::highp_int_t(y));
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + static_cast<int64>(x) - static_cast<int64>(y));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> usubBorrow
template <>
GLM_FUNC_QUALIFIER uvec2 usubBorrow
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
detail::tvec2<T, P> & Borrow
uvec2 const & x,
uvec2 const & y,
uvec2 & Borrow
)
{
return detail::tvec2<T, P>(
return uvec2(
usubBorrow(x[0], y[0], Borrow[0]),
usubBorrow(x[1], y[1], Borrow[1]));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> usubBorrow
template <>
GLM_FUNC_QUALIFIER uvec3 usubBorrow
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
detail::tvec3<T, P> & Borrow
uvec3 const & x,
uvec3 const & y,
uvec3 & Borrow
)
{
return detail::tvec3<T, P>(
return uvec3(
usubBorrow(x[0], y[0], Borrow[0]),
usubBorrow(x[1], y[1], Borrow[1]),
usubBorrow(x[2], y[2], Borrow[2]));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> usubBorrow
template <>
GLM_FUNC_QUALIFIER uvec4 usubBorrow
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
detail::tvec4<T, P> & Borrow
uvec4 const & x,
uvec4 const & y,
uvec4 & Borrow
)
{
return detail::tvec4<T, P>(
return uvec4(
usubBorrow(x[0], y[0], Borrow[0]),
usubBorrow(x[1], y[1], Borrow[1]),
usubBorrow(x[2], y[2], Borrow[2]),
@ -149,127 +159,121 @@ namespace glm
}
// umulExtended
template <typename genUType>
template <>
GLM_FUNC_QUALIFIER void umulExtended
(
genUType const & x,
genUType const & y,
genUType & msb,
genUType & lsb
uint const & x,
uint const & y,
uint & msb,
uint & lsb
)
{
detail::highp_uint_t ValueX64 = x;
detail::highp_uint_t ValueY64 = y;
detail::highp_uint_t Value64 = ValueX64 * ValueY64;
msb = *(genUType*)&genUType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1)));
lsb = *(genUType*)&genUType(Value64 >> detail::highp_uint_t(32));
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
msb = *(reinterpret_cast<uint32*>(&Value64) + 1);
lsb = reinterpret_cast<uint32&>(Value64);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> umulExtended
template <>
GLM_FUNC_QUALIFIER void umulExtended
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
detail::tvec2<T, P> & msb,
detail::tvec2<T, P> & lsb
uvec2 const & x,
uvec2 const & y,
uvec2 & msb,
uvec2 & lsb
)
{
return detail::tvec2<T, P>(
umulExtended(x[0], y[0], msb, lsb),
umulExtended(x[1], y[1], msb, lsb));
umulExtended(x[0], y[0], msb[0], lsb[0]);
umulExtended(x[1], y[1], msb[1], lsb[1]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> umulExtended
template <>
GLM_FUNC_QUALIFIER void umulExtended
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
detail::tvec3<T, P> & msb,
detail::tvec3<T, P> & lsb
uvec3 const & x,
uvec3 const & y,
uvec3 & msb,
uvec3 & lsb
)
{
return detail::tvec3<T, P>(
umulExtended(x[0], y[0], msb, lsb),
umulExtended(x[1], y[1], msb, lsb),
umulExtended(x[2], y[2], msb, lsb));
umulExtended(x[0], y[0], msb[0], lsb[0]);
umulExtended(x[1], y[1], msb[1], lsb[1]);
umulExtended(x[2], y[2], msb[2], lsb[2]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> umulExtended
template <>
GLM_FUNC_QUALIFIER void umulExtended
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
detail::tvec4<T, P> & msb,
detail::tvec4<T, P> & lsb
uvec4 const & x,
uvec4 const & y,
uvec4 & msb,
uvec4 & lsb
)
{
return detail::tvec4<T, P>(
umulExtended(x[0], y[0], msb, lsb),
umulExtended(x[1], y[1], msb, lsb),
umulExtended(x[2], y[2], msb, lsb),
umulExtended(x[3], y[3], msb, lsb));
umulExtended(x[0], y[0], msb[0], lsb[0]);
umulExtended(x[1], y[1], msb[1], lsb[1]);
umulExtended(x[2], y[2], msb[2], lsb[2]);
umulExtended(x[3], y[3], msb[3], lsb[3]);
}
// imulExtended
template <typename genIType>
template <>
GLM_FUNC_QUALIFIER void imulExtended
(
genIType const & x,
genIType const & y,
genIType & msb,
genIType & lsb
int const & x,
int const & y,
int & msb,
int & lsb
)
{
detail::highp_int_t ValueX64 = x;
detail::highp_int_t ValueY64 = y;
detail::highp_int_t Value64 = ValueX64 * ValueY64;
msb = *(genIType*)&genIType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1)));
lsb = *(genIType*)&genIType(Value64 >> detail::highp_uint_t(32));
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
msb = *(reinterpret_cast<int32*>(&Value64) + 1);
lsb = reinterpret_cast<int32&>(Value64);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> imulExtended
template <>
GLM_FUNC_QUALIFIER void imulExtended
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
detail::tvec2<T, P> & msb,
detail::tvec2<T, P> & lsb
ivec2 const & x,
ivec2 const & y,
ivec2 & msb,
ivec2 & lsb
)
{
return detail::tvec2<T, P>(
imulExtended(x[0], y[0], msb, lsb),
imulExtended(x[1], y[1], msb, lsb));
imulExtended(x[0], y[0], msb[0], lsb[0]),
imulExtended(x[1], y[1], msb[1], lsb[1]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> imulExtended
template <>
GLM_FUNC_QUALIFIER void imulExtended
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
detail::tvec3<T, P> & msb,
detail::tvec3<T, P> & lsb
ivec3 const & x,
ivec3 const & y,
ivec3 & msb,
ivec3 & lsb
)
{
return detail::tvec3<T, P>(
imulExtended(x[0], y[0], msb, lsb),
imulExtended(x[1], y[1], msb, lsb),
imulExtended(x[2], y[2], msb, lsb));
imulExtended(x[0], y[0], msb[0], lsb[0]),
imulExtended(x[1], y[1], msb[1], lsb[1]);
imulExtended(x[2], y[2], msb[2], lsb[2]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> imulExtended
template <>
GLM_FUNC_QUALIFIER void imulExtended
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
detail::tvec4<T, P> & msb,
detail::tvec4<T, P> & lsb
ivec4 const & x,
ivec4 const & y,
ivec4 & msb,
ivec4 & lsb
)
{
return detail::tvec4<T, P>(
imulExtended(x[0], y[0], msb, lsb),
imulExtended(x[1], y[1], msb, lsb),
imulExtended(x[2], y[2], msb, lsb),
imulExtended(x[3], y[3], msb, lsb));
imulExtended(x[0], y[0], msb[0], lsb[0]),
imulExtended(x[1], y[1], msb[1], lsb[1]);
imulExtended(x[2], y[2], msb[2], lsb[2]);
imulExtended(x[3], y[3], msb[3], lsb[3]);
}
// bitfieldExtract
@ -521,7 +525,6 @@ namespace glm
}
// findMSB
/*
#if((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_VC))
template <typename genIUType>
@ -538,7 +541,7 @@ namespace glm
_BitScanReverse(&Result, Value);
return int(Result);
}
/*
// __builtin_clz seems to be buggy as it crasks for some values, from 0x00200000 to 80000000
#elif((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC40))
@ -560,8 +563,9 @@ namespace glm
//
return 31 - __builtin_clzl(Value);
}
#else
*/
#else
/* SSE implementation idea
__m128i const Zero = _mm_set_epi32( 0, 0, 0, 0);
@ -606,7 +610,7 @@ namespace glm
return MostSignificantBit;
}
}
//#endif//(GLM_COMPILER)
#endif//(GLM_COMPILER)
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<int, P> findMSB

View File

@ -38,7 +38,11 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_matrix
#define GLM_CORE_func_matrix GLM_VERSION
#define GLM_CORE_func_matrix
// Dependencies
#include "../detail/precision.hpp"
#include "../detail/setup.hpp"
namespace glm
{
@ -52,10 +56,8 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename matType>
matType matrixCompMult(
matType const & x,
matType const & y);
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_DECL matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y);
/// Treats the first parameter c as a column vector
/// and the second parameter r as a row vector
@ -67,10 +69,8 @@ namespace glm
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
///
/// @todo Clarify the declaration to specify that matType doesn't have to be provided when used.
template <typename vecType, typename matType>
matType outerProduct(
vecType const & c,
vecType const & r);
template <typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
GLM_FUNC_DECL void outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r);
/// Returns the transposed matrix of x
///
@ -78,69 +78,28 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename matType>
typename matType::transpose_type transpose(
matType const & x);
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
# endif
/// Return the determinant of a mat2 matrix.
/// Return the determinant of a squared matrix.
///
/// @tparam valType Floating-point scalar types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename T, precision P>
typename detail::tmat2x2<T, P>::value_type determinant(
detail::tmat2x2<T, P> const & m);
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_DECL T determinant(matType<T, P> const & m);
/// Return the determinant of a mat3 matrix.
///
/// @tparam valType Floating-point scalar types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename T, precision P>
typename detail::tmat3x3<T, P>::value_type determinant(
detail::tmat3x3<T, P> const & m);
/// Return the determinant of a mat4 matrix.
///
/// @tparam valType Floating-point scalar types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename T, precision P>
typename detail::tmat4x4<T, P>::value_type determinant(
detail::tmat4x4<T, P> const & m);
/// Return the inverse of a mat2 matrix.
/// Return the inverse of a squared matrix.
///
/// @tparam valType Floating-point scalar types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename T, precision P>
detail::tmat2x2<T, P> inverse(
detail::tmat2x2<T, P> const & m);
/// Return the inverse of a mat3 matrix.
///
/// @tparam valType Floating-point scalar types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename T, precision P>
detail::tmat3x3<T, P> inverse(
detail::tmat3x3<T, P> const & m);
/// Return the inverse of a mat4 matrix.
///
/// @tparam valType Floating-point scalar types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template <typename T, precision P>
detail::tmat4x4<T, P> inverse(
detail::tmat4x4<T, P> const & m);
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_DECL matType<T, P> inverse(matType<T, P> const & m);
/// @}
}//namespace glm

595
glm/detail/func_matrix.inl Normal file
View File

@ -0,0 +1,595 @@
///////////////////////////////////////////////////////////////////////////////////
/// 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
///////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "type_mat2x2.hpp"
#include "type_mat2x3.hpp"
#include "type_mat2x4.hpp"
#include "type_mat3x2.hpp"
#include "type_mat3x3.hpp"
#include "type_mat3x4.hpp"
#include "type_mat4x2.hpp"
#include "type_mat4x3.hpp"
#include "type_mat4x4.hpp"
#include <limits>
namespace glm{
namespace detail
{
template
<
template <class, precision> class vecTypeA,
template <class, precision> class vecTypeB,
typename T, precision P
>
struct compute_outerProduct{};
template <typename T, precision P>
struct compute_outerProduct<detail::tvec2, detail::tvec2, T, P>
{
typedef detail::tmat2x2<T, P> return_type;
static return_type call(detail::tvec2<T, P> const & c, detail::tvec2<T, P> const & r)
{
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::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 <typename T, precision P>
struct compute_outerProduct<detail::tvec3, detail::tvec3, T, P>
{
typedef detail::tmat3x3<T, P> return_type;
static return_type call(detail::tvec3<T, P> const & c, detail::tvec3<T, P> const & r)
{
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null);
for(length_t i(0); i < m.length(); ++i)
m[i] = c * r[i];
return m;
}
};
template <typename T, precision P>
struct compute_outerProduct<detail::tvec4, detail::tvec4, T, P>
{
typedef detail::tmat4x4<T, P> return_type;
static return_type call(detail::tvec4<T, P> const & c, detail::tvec4<T, P> const & r)
{
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null);
for(length_t i(0); i < m.length(); ++i)
m[i] = c * r[i];
return m;
}
};
template <typename T, precision P>
struct compute_outerProduct<detail::tvec3, detail::tvec2, T, P>
{
typedef detail::tmat2x3<T, P> return_type;
static return_type call(detail::tvec3<T, P> const & c, detail::tvec2<T, P> const & r)
{
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::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 <typename T, precision P>
struct compute_outerProduct<detail::tvec2, detail::tvec3, T, P>
{
typedef detail::tmat3x2<T, P> return_type;
static return_type call(detail::tvec2<T, P> const & c, detail::tvec3<T, P> const & r)
{
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::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 <typename T, precision P>
struct compute_outerProduct<detail::tvec4, detail::tvec2, T, P>
{
typedef detail::tmat2x4<T, P> return_type;
static return_type call(detail::tvec4<T, P> const & c, detail::tvec2<T, P> const & r)
{
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::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 <typename T, precision P>
struct compute_outerProduct<detail::tvec2, detail::tvec4, T, P>
{
typedef detail::tmat4x2<T, P> return_type;
static return_type call(detail::tvec2<T, P> const & c, detail::tvec4<T, P> const & r)
{
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::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 <typename T, precision P>
struct compute_outerProduct<detail::tvec4, detail::tvec3, T, P>
{
typedef detail::tmat3x4<T, P> return_type;
static return_type call(detail::tvec4<T, P> const & c, detail::tvec3<T, P> const & r)
{
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::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 <typename T, precision P>
struct compute_outerProduct<detail::tvec3, detail::tvec4, T, P>
{
typedef detail::tmat4x3<T, P> return_type;
static return_type call(detail::tvec3<T, P> const & c, detail::tvec4<T, P> const & r)
{
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::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 <template <class, precision> class matType, typename T, precision P>
struct compute_transpose{};
template <typename T, precision P>
struct compute_transpose<detail::tmat2x2, T, P>
{
static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
{
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat2x3, T, P>
{
static detail::tmat3x2<T, P> call(detail::tmat2x3<T, P> const & m)
{
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat2x4, T, P>
{
static detail::tmat4x2<T, P> call(detail::tmat2x4<T, P> const & m)
{
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat3x2, T, P>
{
static detail::tmat2x3<T, P> call(detail::tmat3x2<T, P> const & m)
{
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat3x3, T, P>
{
static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
{
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat3x4, T, P>
{
static detail::tmat4x3<T, P> call(detail::tmat3x4<T, P> const & m)
{
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat4x2, T, P>
{
static detail::tmat2x4<T, P> call(detail::tmat4x2<T, P> const & m)
{
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat4x3, T, P>
{
static detail::tmat3x4<T, P> call(detail::tmat4x3<T, P> const & m)
{
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_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 <typename T, precision P>
struct compute_transpose<detail::tmat4x4, T, P>
{
static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
{
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_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 <template <class, precision> class matType, typename T, precision P>
struct compute_determinant{};
template <typename T, precision P>
struct compute_determinant<detail::tmat2x2, T, P>
{
static T call(detail::tmat2x2<T, P> const & m)
{
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
}
};
template <typename T, precision P>
struct compute_determinant<detail::tmat3x3, T, P>
{
static T call(detail::tmat3x3<T, P> const & m)
{
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 <typename T, precision P>
struct compute_determinant<detail::tmat4x4, T, P>
{
static T call(detail::tmat4x4<T, P> const & m)
{
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<T, P> 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 <template <class, precision> class matType, typename T, precision P>
struct compute_inverse{};
template <typename T, precision P>
struct compute_inverse<detail::tmat2x2, T, P>
{
static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
{
T Determinant = determinant(m);
detail::tmat2x2<T, P> Inverse(
+ m[1][1] / Determinant,
- m[0][1] / Determinant,
- m[1][0] / Determinant,
+ m[0][0] / Determinant);
return Inverse;
}
};
template <typename T, precision P>
struct compute_inverse<detail::tmat3x3, T, P>
{
static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
{
T Determinant = determinant(m);
detail::tmat3x3<T, P> Inverse(detail::tmat3x3<T, P>::_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 <typename T, precision P>
struct compute_inverse<detail::tmat4x4, T, P>
{
static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
{
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<T, P> const SignA(+1, -1, +1, -1);
detail::tvec4<T, P> const SignB(-1, +1, -1, +1);
detail::tvec4<T, P> Fac0(Coef00, Coef00, Coef02, Coef03);
detail::tvec4<T, P> Fac1(Coef04, Coef04, Coef06, Coef07);
detail::tvec4<T, P> Fac2(Coef08, Coef08, Coef10, Coef11);
detail::tvec4<T, P> Fac3(Coef12, Coef12, Coef14, Coef15);
detail::tvec4<T, P> Fac4(Coef16, Coef16, Coef18, Coef19);
detail::tvec4<T, P> Fac5(Coef20, Coef20, Coef22, Coef23);
detail::tvec4<T, P> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
detail::tvec4<T, P> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
detail::tvec4<T, P> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
detail::tvec4<T, P> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
detail::tvec4<T, P> Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
detail::tvec4<T, P> Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
detail::tvec4<T, P> Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
detail::tvec4<T, P> Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
detail::tmat4x4<T, P> Inverse(Inv0, Inv1, Inv2, Inv3);
detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
T Determinant = dot(m[0], Row0);
Inverse /= Determinant;
return Inverse;
}
};
}//namespace detail
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_QUALIFIER matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
matType<T, P> result(matType<T, P>::_null);
for(length_t i = 0; i < result.length(); ++i)
result[i] = x[i] * y[i];
return result;
}
template<template <class, precision> class vecTypeA, template <class, precision> class vecTypeB, typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::return_type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
return detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::call(c, r);
}
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_QUALIFIER typename matType<T, P>::transpose_type transpose(matType<T, P> const & m)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
return detail::compute_transpose<matType, T, P>::call(m);
}
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_QUALIFIER T determinant(matType<T, P> const & m)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'determinant' only accept floating-point inputs");
return detail::compute_determinant<matType, T, P>::call(m);
}
template <typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_QUALIFIER matType<T, P> inverse(matType<T, P> const & m)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
return detail::compute_inverse<matType, T, P>::call(m);
}
}//namespace glm

View File

@ -36,7 +36,12 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_noise
#define glm_core_func_noise GLM_VERSION
#define glm_core_func_noise
#include "type_vec1.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "setup.hpp"
namespace glm
{
@ -50,7 +55,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
typename genType::value_type noise1(genType const & x);
GLM_FUNC_DECL typename genType::value_type noise1(genType const & x);
/// Returns a 2D noise value based on the input value x.
///
@ -59,7 +64,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
detail::tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
GLM_FUNC_DECL detail::tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
/// Returns a 3D noise value based on the input value x.
///
@ -68,7 +73,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
detail::tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
GLM_FUNC_DECL detail::tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
/// Returns a 4D noise value based on the input value x.
///
@ -77,7 +82,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
detail::tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
GLM_FUNC_DECL detail::tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
/// @}
}//namespace glm

View File

@ -26,8 +26,23 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
namespace glm
#include "../detail/_noise.hpp"
#include "./func_common.hpp"
namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> grad4(T const & j, detail::tvec4<T, P> const & ip)
{
detail::tvec3<T, P> pXYZ = floor(fract(detail::tvec3<T, P>(j) * detail::tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), detail::tvec3<T, P>(1));
detail::tvec4<T, P> s = detail::tvec4<T, P>(lessThan(detail::tvec4<T, P>(pXYZ, pW), detail::tvec4<T, P>(0.0)));
pXYZ = pXYZ + (detail::tvec3<T, P>(s) * T(2) - T(1)) * s.w;
return detail::tvec4<T, P>(pXYZ, pW);
}
}//namespace detail
template <typename T>
GLM_FUNC_QUALIFIER T noise1(T const & x)
{
@ -87,8 +102,8 @@ namespace glm
// Permutations
i = mod(i, T(289)); // Avoid truncation effects in permutation
detail::tvec3<T, P> p = permute(
permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1))) + i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
detail::tvec3<T, P> p = detail::permute(
detail::permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1))) + i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
detail::tvec3<T, P> m = max(T(0.5) - detail::tvec3<T, P>(
dot(x0, x0),
@ -101,14 +116,14 @@ namespace glm
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
detail::tvec3<T, P> x = T(2) * fract(p * C.w) - T(1);
detail::tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
detail::tvec3<T, P> h = abs(x) - T(0.5);
detail::tvec3<T, P> ox = floor(x + T(0.5));
detail::tvec3<T, P> a0 = x - ox;
// Normalise gradients implicitly by scaling m
// Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
m *= T(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
// Compute final noise value at P
detail::tvec3<T, P> g;
@ -145,14 +160,14 @@ namespace glm
// Permutations
i = mod289(i);
detail::tvec4<T, P> p(permute(permute(permute(
detail::tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
i.z + detail::tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
i.y + detail::tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
i.x + detail::tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
T n_ = T(0.142857142857); // 1.0/7.0
T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
detail::tvec3<T, P> ns(n_ * detail::tvec3<T, P>(D.w, D.y, D.z) - detail::tvec3<T, P>(D.x, D.z, D.x));
detail::tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
@ -204,7 +219,7 @@ namespace glm
-0.447213595499958); // -1 + 4 * G4
// (sqrt(5) - 1)/4 = F4, used once below
T const F4 = T(0.309016994374947451);
T const F4 = static_cast<T>(0.309016994374947451);
// First corner
detail::tvec4<T, P> i = floor(v + dot(v, detail::tvec4<T, P>(F4)));
@ -219,17 +234,17 @@ namespace glm
// i0.x = dot(isX, vec3(1.0));
//i0.x = isX.x + isX.y + isX.z;
//i0.yzw = T(1) - isX;
//i0.yzw = static_cast<T>(1) - isX;
i0 = detail::tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
// i0.y += dot(isYZ.xy, vec2(1.0));
i0.y += isYZ.x + isYZ.y;
//i0.zw += 1.0 - detail::tvec2<T, P>(isYZ.x, isYZ.y);
i0.z += T(1) - isYZ.x;
i0.w += T(1) - isYZ.y;
i0.z += static_cast<T>(1) - isYZ.x;
i0.w += static_cast<T>(1) - isYZ.y;
i0.z += isYZ.z;
i0.w += T(1) - isYZ.z;
i0.w += static_cast<T>(1) - isYZ.z;
// i0 now contains the unique values 0,1,2,3 in each channel
detail::tvec4<T, P> i3 = clamp(i0, T(0), T(1));
@ -248,8 +263,8 @@ namespace glm
// Permutations
i = mod(i, T(289));
T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);
detail::tvec4<T, P> j1 = permute(permute(permute(permute(
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
detail::tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
i.w + detail::tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
i.z + detail::tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
i.y + detail::tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
@ -259,14 +274,14 @@ namespace glm
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
detail::tvec4<T, P> ip = detail::tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
detail::tvec4<T, P> p0 = grad4(j0, ip);
detail::tvec4<T, P> p1 = grad4(j1.x, ip);
detail::tvec4<T, P> p2 = grad4(j1.y, ip);
detail::tvec4<T, P> p3 = grad4(j1.z, ip);
detail::tvec4<T, P> p4 = grad4(j1.w, ip);
detail::tvec4<T, P> p0 = detail::grad4(j0, ip);
detail::tvec4<T, P> p1 = detail::grad4(j1.x, ip);
detail::tvec4<T, P> p2 = detail::grad4(j1.y, ip);
detail::tvec4<T, P> p3 = detail::grad4(j1.z, ip);
detail::tvec4<T, P> p4 = detail::grad4(j1.w, ip);
// Normalise gradients
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;

View File

@ -34,90 +34,93 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_packing
#define GLM_CORE_func_packing GLM_VERSION
#define GLM_CORE_func_packing
#include "type_vec2.hpp"
#include "type_vec4.hpp"
namespace glm
{
/// @addtogroup core_func_packing
/// @{
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)
//!
//! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits.
//!
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
/// The conversion for component c of v to fixed point is done as follows:
/// packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)
///
/// The first component of the vector will be written to the least significant bits of the output;
/// the last component will be written to the most significant bits.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
uint32 packUnorm2x16(vec2 const & v);
GLM_FUNC_DECL uint packUnorm2x16(vec2 const & v);
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)
//!
//! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits.
//!
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
/// The conversion for component c of v to fixed point is done as follows:
/// packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)
///
/// The first component of the vector will be written to the least significant bits of the output;
/// the last component will be written to the most significant bits.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
uint32 packSnorm2x16(vec2 const & v);
GLM_FUNC_DECL uint packSnorm2x16(vec2 const & v);
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! packUnorm4x8: round(clamp(c, 0, +1) * 255.0)
//!
//! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits.
//!
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
/// The conversion for component c of v to fixed point is done as follows:
/// packUnorm4x8: round(clamp(c, 0, +1) * 255.0)
///
/// The first component of the vector will be written to the least significant bits of the output;
/// the last component will be written to the most significant bits.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
uint32 packUnorm4x8(vec4 const & v);
GLM_FUNC_DECL uint packUnorm4x8(vec4 const & v);
//! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
//! Then, the results are packed into the returned 32-bit unsigned integer.
//!
//! The conversion for component c of v to fixed point is done as follows:
//! packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
//!
//! The first component of the vector will be written to the least significant bits of the output;
//! the last component will be written to the most significant bits.
//!
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
/// The conversion for component c of v to fixed point is done as follows:
/// packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
///
/// The first component of the vector will be written to the least significant bits of the output;
/// the last component will be written to the most significant bits.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
uint32 packSnorm4x8(vec4 const & v);
GLM_FUNC_DECL uint packSnorm4x8(vec4 const & v);
//! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
//! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
//!
//! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! unpackUnorm2x16: f / 65535.0
//!
//! The first component of the returned vector will be extracted from the least significant bits of the input;
//! the last component will be extracted from the most significant bits.
//!
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackUnorm2x16: f / 65535.0
///
/// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
vec2 unpackUnorm2x16(uint32 const & p);
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint const & p);
//! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
//! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
//!
//! The conversion for unpacked fixed-point value f to floating point is done as follows:
//! unpackSnorm2x16: clamp(f / 32767.0, -1, +1)
//!
//! The first component of the returned vector will be extracted from the least significant bits of the input;
//! the last component will be extracted from the most significant bits.
//!
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm2x16: clamp(f / 32767.0, -1, +1)
///
/// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
vec2 unpackSnorm2x16(uint32 const & p);
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint const & p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
@ -130,7 +133,7 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
vec4 unpackUnorm4x8(uint32 const & p);
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint const & p);
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
@ -143,7 +146,7 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
vec4 unpackSnorm4x8(uint32 const & p);
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint const & p);
/// Returns a double-precision value obtained by packing the components of v into a 64-bit value.
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
@ -153,7 +156,7 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
double packDouble2x32(uvec2 const & v);
GLM_FUNC_DECL double packDouble2x32(uvec2 const & v);
/// Returns a two-component unsigned integer vector representation of v.
/// The bit-level representation of v is preserved.
@ -162,7 +165,7 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
uvec2 unpackDouble2x32(double const & v);
GLM_FUNC_DECL uvec2 unpackDouble2x32(double const & v);
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
/// to the 16-bit floating-point representation found in the OpenGL Specification,
@ -172,7 +175,7 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
uint packHalf2x16(vec2 const & v);
GLM_FUNC_DECL uint packHalf2x16(vec2 const & v);
/// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values,
/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
@ -182,7 +185,7 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
vec2 unpackHalf2x16(uint32 const & v);
GLM_FUNC_DECL vec2 unpackHalf2x16(uint const & v);
/// @}
}//namespace glm
@ -190,4 +193,3 @@ namespace glm
#include "func_packing.inl"
#endif//GLM_CORE_func_packing

115
glm/detail/func_packing.inl Normal file
View File

@ -0,0 +1,115 @@
///////////////////////////////////////////////////////////////////////////////////
/// 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
///////////////////////////////////////////////////////////////////////////////////
#include "func_common.hpp"
#include "type_half.hpp"
#include "../fwd.hpp"
namespace glm
{
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
{
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
return reinterpret_cast<uint&>(Topack);
}
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
{
vec2 Unpack(reinterpret_cast<u16vec2 const &>(p));
return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0
}
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
{
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
return reinterpret_cast<uint32&>(Topack);
}
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
{
vec2 Unpack(reinterpret_cast<i16vec2 const &>(p));
return clamp(
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
-1.0f, 1.0f);
}
GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v)
{
u8vec4 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
return reinterpret_cast<uint&>(Topack);
}
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint const & p)
{
vec4 Unpack(reinterpret_cast<u8vec4 const&>(p));
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
}
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
{
i8vec4 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
return reinterpret_cast<uint&>(Topack);
}
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint const & p)
{
vec4 Unpack(reinterpret_cast<i8vec4 const &>(p));
return clamp(
Unpack * 0.0078740157480315f, // 1.0f / 127.0f
-1.0f, 1.0f);
}
GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v)
{
return reinterpret_cast<double const &>(v);
}
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v)
{
return reinterpret_cast<uvec2 const &>(v);
}
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
{
i16vec2 Unpack(
detail::toFloat16(v.x),
detail::toFloat16(v.y));
return *reinterpret_cast<uint*>(&Unpack);
}
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
{
i16vec2 Unpack(reinterpret_cast<i16vec2 const &>(v));
return vec2(
detail::toFloat32(Unpack.x),
detail::toFloat32(Unpack.y));
}
}//namespace glm

View File

@ -38,7 +38,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_trigonometric
#define GLM_CORE_func_trigonometric GLM_VERSION
#define GLM_CORE_func_trigonometric
namespace glm
{
@ -52,7 +52,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType radians(genType const & degrees);
GLM_FUNC_DECL genType radians(genType const & degrees);
/// Converts radians to degrees and returns the result.
///
@ -61,7 +61,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType degrees(genType const & radians);
GLM_FUNC_DECL genType degrees(genType const & radians);
/// The standard trigonometric sine function.
/// The values returned by this function will range from [-1, 1].
@ -71,7 +71,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType sin(genType const & angle);
GLM_FUNC_DECL genType sin(genType const & angle);
/// The standard trigonometric cosine function.
/// The values returned by this function will range from [-1, 1].
@ -81,7 +81,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType cos(genType const & angle);
GLM_FUNC_DECL genType cos(genType const & angle);
/// The standard trigonometric tangent function.
///
@ -90,7 +90,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType tan(genType const & angle);
GLM_FUNC_DECL genType tan(genType const & angle);
/// Arc sine. Returns an angle whose sine is x.
/// The range of values returned by this function is [-PI/2, PI/2].
@ -101,7 +101,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType asin(genType const & x);
GLM_FUNC_DECL genType asin(genType const & x);
/// Arc cosine. Returns an angle whose sine is x.
/// The range of values returned by this function is [0, PI].
@ -112,7 +112,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType acos(genType const & x);
GLM_FUNC_DECL genType acos(genType const & x);
/// Arc tangent. Returns an angle whose tangent is y/x.
/// The signs of x and y are used to determine what
@ -125,7 +125,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType atan(genType const & y, genType const & x);
GLM_FUNC_DECL genType atan(genType const & y, genType const & x);
/// Arc tangent. Returns an angle whose tangent is y_over_x.
/// The range of values returned by this function is [-PI/2, PI/2].
@ -135,7 +135,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType atan(genType const & y_over_x);
GLM_FUNC_DECL genType atan(genType const & y_over_x);
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
///
@ -144,7 +144,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType sinh(genType const & angle);
GLM_FUNC_DECL genType sinh(genType const & angle);
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
///
@ -153,7 +153,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType cosh(genType const & angle);
GLM_FUNC_DECL genType cosh(genType const & angle);
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
///
@ -162,7 +162,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType tanh(genType const & angle);
GLM_FUNC_DECL genType tanh(genType const & angle);
/// Arc hyperbolic sine; returns the inverse of sinh.
///
@ -171,7 +171,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType asinh(genType const & x);
GLM_FUNC_DECL genType asinh(genType const & x);
/// Arc hyperbolic cosine; returns the non-negative inverse
/// of cosh. Results are undefined if x < 1.
@ -181,7 +181,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType acosh(genType const & x);
GLM_FUNC_DECL genType acosh(genType const & x);
/// Arc hyperbolic tangent; returns the inverse of tanh.
/// Results are undefined if abs(x) >= 1.
@ -191,7 +191,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename genType>
genType atanh(genType const & x);
GLM_FUNC_DECL genType atanh(genType const & x);
/// @}
}//namespace glm

View File

@ -26,6 +26,10 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "_vectorize.hpp"
#include <cmath>
#include <limits>
namespace glm
{
// radians
@ -35,7 +39,7 @@ namespace glm
genType const & degrees
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'radians' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
return degrees * genType(0.01745329251994329576923690768489);
}
@ -49,7 +53,7 @@ namespace glm
genType const & radians
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'degrees' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
return radians * genType(57.295779513082320876798154814105);
}
@ -63,7 +67,7 @@ namespace glm
genType const & angle
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sin' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sin' only accept floating-point input");
return genType(::std::sin(angle));
}
@ -74,7 +78,7 @@ namespace glm
template <typename genType>
GLM_FUNC_QUALIFIER genType cos(genType const & angle)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cos' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cos' only accept floating-point input");
return genType(::std::cos(angle));
}
@ -88,7 +92,7 @@ namespace glm
genType const & angle
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'tan' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tan' only accept floating-point input");
return genType(::std::tan(angle));
}
@ -102,7 +106,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asin' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asin' only accept floating-point input");
return genType(::std::asin(x));
}
@ -116,7 +120,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acos' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acos' only accept floating-point input");
return genType(::std::acos(x));
}
@ -131,7 +135,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atan' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
return genType(::std::atan2(y, x));
}
@ -144,7 +148,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atan' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
return genType(::std::atan(x));
}
@ -158,7 +162,7 @@ namespace glm
genType const & angle
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sinh' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sinh' only accept floating-point input");
return genType(std::sinh(angle));
}
@ -172,7 +176,7 @@ namespace glm
genType const & angle
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'cosh' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cosh' only accept floating-point input");
return genType(std::cosh(angle));
}
@ -186,7 +190,7 @@ namespace glm
genType const & angle
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'tanh' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tanh' only accept floating-point input");
return genType(std::tanh(angle));
}
@ -200,7 +204,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'asinh' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x));
}
@ -214,7 +218,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'acosh' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
if(x < genType(1))
return genType(0);
@ -230,7 +234,7 @@ namespace glm
genType const & x
)
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'atanh' only accept floating-point input");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
if(abs(x) >= genType(1))
return 0;

View File

@ -39,7 +39,12 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_vector_relational
#define GLM_CORE_func_vector_relational GLM_VERSION
#define GLM_CORE_func_vector_relational
#include "precision.hpp"
#include "setup.hpp"
#if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug
namespace glm
{
@ -52,8 +57,9 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
typename vecType<T, P>::bool_type lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
// TODO: Mismatched
//template <typename T, precision P, template <typename, precision> class vecType>
//GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns the component-wise comparison of result x <= y.
///
@ -62,7 +68,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
typename vecType<T, P>::bool_type lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns the component-wise comparison of result x > y.
///
@ -71,7 +77,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
typename vecType<T, P>::bool_type greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns the component-wise comparison of result x >= y.
///
@ -80,7 +86,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
typename vecType<T, P>::bool_type greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns the component-wise comparison of result x == y.
///
@ -88,8 +94,9 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
typename vecType<T, P>::bool_type equal(vecType<T, P> const & x, vecType<T, P> const & y);
//TODO: conflicts with definision
//template <typename T, precision P, template <typename, precision> class vecType>
//GLM_FUNC_DECL typename vecType<T, P>::bool_type equal(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns the component-wise comparison of result x != y.
///
@ -98,7 +105,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
typename vecType<T, P>::bool_type notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
GLM_FUNC_DECL typename vecType<T, P>::bool_type notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns true if any component of x is true.
///
@ -107,7 +114,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <precision P, template <typename, precision> class vecType>
bool any(vecType<bool, P> const & v);
GLM_FUNC_DECL bool any(vecType<bool, P> const & v);
/// Returns true if all components of x are true.
///
@ -116,7 +123,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <precision P, template <typename, precision> class vecType>
bool all(vecType<bool, P> const & v);
GLM_FUNC_DECL bool all(vecType<bool, P> const & v);
/// Returns the component-wise logical complement of x.
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
@ -126,11 +133,13 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
template <precision P, template <typename, precision> class vecType>
vecType<bool, P> not_(vecType<bool, P> const & v);
GLM_FUNC_DECL vecType<bool, P> not_(vecType<bool, P> const & v);
/// @}
}//namespace glm
#endif
#include "func_vector_relational.inl"
#endif//GLM_CORE_func_vector_relational

View File

@ -26,6 +26,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <limits>
namespace glm
{
template <typename T, precision P, template <typename, precision> class vecType>
@ -35,14 +37,12 @@ namespace glm
vecType<T, P> const & y
)
{
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
// "Invalid template instantiation of 'lessThan', GLM vector types required");
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
@ -55,14 +55,12 @@ namespace glm
vecType<T, P> const & y
)
{
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
// "Invalid template instantiation of 'lessThanEqual', GLM vector types required");
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i];
return Result;
}
@ -74,14 +72,12 @@ namespace glm
vecType<T, P> const & y
)
{
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
// "Invalid template instantiation of 'greaterThan', GLM vector types required");
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i];
return Result;
}
@ -93,14 +89,12 @@ namespace glm
vecType<T, P> const & y
)
{
//GLM_STATIC_ASSERT(detail::is_vector<vecType<T, P> >::_YES,
// "Invalid template instantiation of 'greaterThanEqual', GLM vector types required");
GLM_STATIC_ASSERT(detail::is_bool<T>::_NO,
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i];
return Result;
}
@ -117,7 +111,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i];
return Result;
}
@ -134,7 +128,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i];
return Result;
}
@ -146,7 +140,7 @@ namespace glm
// "Invalid template instantiation of 'any', GLM boolean vector types required");
bool Result = false;
for(typename vecType<bool, P>::size_type i = 0; i < v.length(); ++i)
for(int i = 0; i < v.length(); ++i)
Result = Result || v[i];
return Result;
}
@ -158,7 +152,7 @@ namespace glm
// "Invalid template instantiation of 'all', GLM boolean vector types required");
bool Result = true;
for(typename vecType<bool, P>::size_type i = 0; i < v.length(); ++i)
for(int i = 0; i < v.length(); ++i)
Result = Result && v[i];
return Result;
}
@ -170,7 +164,7 @@ namespace glm
// "Invalid template instantiation of 'not_', GLM vector types required");
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < v.length(); ++i)
for(int i = 0; i < v.length(); ++i)
Result[i] = !v[i];
return Result;
}

View File

@ -80,7 +80,6 @@ template struct tvec2<int8, lowp>;
template struct tvec2<int16, lowp>;
template struct tvec2<int32, lowp>;
template struct tvec2<int64, lowp>;
template struct tvec2<float16, lowp>;
template struct tvec2<float32, lowp>;
template struct tvec2<float64, lowp>;
@ -92,7 +91,6 @@ template struct tvec2<int8, mediump>;
template struct tvec2<int16, mediump>;
template struct tvec2<int32, mediump>;
template struct tvec2<int64, mediump>;
template struct tvec2<float16, mediump>;
template struct tvec2<float32, mediump>;
template struct tvec2<float64, mediump>;
@ -104,7 +102,6 @@ template struct tvec2<int8, highp>;
template struct tvec2<int16, highp>;
template struct tvec2<int32, highp>;
template struct tvec2<int64, highp>;
template struct tvec2<float16, highp>;
template struct tvec2<float32, highp>;
template struct tvec2<float64, highp>;
@ -117,7 +114,6 @@ template struct tvec3<int8, lowp>;
template struct tvec3<int16, lowp>;
template struct tvec3<int32, lowp>;
template struct tvec3<int64, lowp>;
template struct tvec3<float16, lowp>;
template struct tvec3<float32, lowp>;
template struct tvec3<float64, lowp>;
@ -129,7 +125,6 @@ template struct tvec3<int8, mediump>;
template struct tvec3<int16, mediump>;
template struct tvec3<int32, mediump>;
template struct tvec3<int64, mediump>;
template struct tvec3<float16, mediump>;
template struct tvec3<float32, mediump>;
template struct tvec3<float64, mediump>;
@ -141,7 +136,6 @@ template struct tvec3<int8, highp>;
template struct tvec3<int16, highp>;
template struct tvec3<int32, highp>;
template struct tvec3<int64, highp>;
template struct tvec3<float16, highp>;
template struct tvec3<float32, highp>;
template struct tvec3<float64, highp>;
@ -154,7 +148,6 @@ template struct tvec4<int8, lowp>;
template struct tvec4<int16, lowp>;
template struct tvec4<int32, lowp>;
template struct tvec4<int64, lowp>;
template struct tvec4<float16, lowp>;
template struct tvec4<float32, lowp>;
template struct tvec4<float64, lowp>;
@ -166,7 +159,6 @@ template struct tvec4<int8, mediump>;
template struct tvec4<int16, mediump>;
template struct tvec4<int32, mediump>;
template struct tvec4<int64, mediump>;
template struct tvec4<float16, mediump>;
template struct tvec4<float32, mediump>;
template struct tvec4<float64, mediump>;
@ -178,150 +170,116 @@ template struct tvec4<int8, highp>;
template struct tvec4<int16, highp>;
template struct tvec4<int32, highp>;
template struct tvec4<int64, highp>;
template struct tvec4<float16, highp>;
template struct tvec4<float32, highp>;
template struct tvec4<float64, highp>;
// tmat2x2 type explicit instantiation
template struct tmat2x2<float16, lowp>;
template struct tmat2x2<float32, lowp>;
template struct tmat2x2<float64, lowp>;
template struct tmat2x2<float16, mediump>;
template struct tmat2x2<float32, mediump>;
template struct tmat2x2<float64, mediump>;
template struct tmat2x2<float16, highp>;
template struct tmat2x2<float32, highp>;
template struct tmat2x2<float64, highp>;
// tmat2x3 type explicit instantiation
template struct tmat2x3<float16, lowp>;
template struct tmat2x3<float32, lowp>;
template struct tmat2x3<float64, lowp>;
template struct tmat2x3<float16, mediump>;
template struct tmat2x3<float32, mediump>;
template struct tmat2x3<float64, mediump>;
template struct tmat2x3<float16, highp>;
template struct tmat2x3<float32, highp>;
template struct tmat2x3<float64, highp>;
// tmat2x4 type explicit instantiation
template struct tmat2x4<float16, lowp>;
template struct tmat2x4<float32, lowp>;
template struct tmat2x4<float64, lowp>;
template struct tmat2x4<float16, mediump>;
template struct tmat2x4<float32, mediump>;
template struct tmat2x4<float64, mediump>;
template struct tmat2x4<float16, highp>;
template struct tmat2x4<float32, highp>;
template struct tmat2x4<float64, highp>;
// tmat3x2 type explicit instantiation
template struct tmat3x2<float16, lowp>;
template struct tmat3x2<float32, lowp>;
template struct tmat3x2<float64, lowp>;
template struct tmat3x2<float16, mediump>;
template struct tmat3x2<float32, mediump>;
template struct tmat3x2<float64, mediump>;
template struct tmat3x2<float16, highp>;
template struct tmat3x2<float32, highp>;
template struct tmat3x2<float64, highp>;
// tmat3x3 type explicit instantiation
template struct tmat3x3<float16, lowp>;
template struct tmat3x3<float32, lowp>;
template struct tmat3x3<float64, lowp>;
template struct tmat3x3<float16, mediump>;
template struct tmat3x3<float32, mediump>;
template struct tmat3x3<float64, mediump>;
template struct tmat3x3<float16, highp>;
template struct tmat3x3<float32, highp>;
template struct tmat3x3<float64, highp>;
// tmat3x4 type explicit instantiation
template struct tmat3x4<float16, lowp>;
template struct tmat3x4<float32, lowp>;
template struct tmat3x4<float64, lowp>;
template struct tmat3x4<float16, mediump>;
template struct tmat3x4<float32, mediump>;
template struct tmat3x4<float64, mediump>;
template struct tmat3x4<float16, highp>;
template struct tmat3x4<float32, highp>;
template struct tmat3x4<float64, highp>;
// tmat4x2 type explicit instantiation
template struct tmat4x2<float16, lowp>;
template struct tmat4x2<float32, lowp>;
template struct tmat4x2<float64, lowp>;
template struct tmat4x2<float16, mediump>;
template struct tmat4x2<float32, mediump>;
template struct tmat4x2<float64, mediump>;
template struct tmat4x2<float16, highp>;
template struct tmat4x2<float32, highp>;
template struct tmat4x2<float64, highp>;
// tmat4x3 type explicit instantiation
template struct tmat4x3<float16, lowp>;
template struct tmat4x3<float32, lowp>;
template struct tmat4x3<float64, lowp>;
template struct tmat4x3<float16, mediump>;
template struct tmat4x3<float32, mediump>;
template struct tmat4x3<float64, mediump>;
template struct tmat4x3<float16, highp>;
template struct tmat4x3<float32, highp>;
template struct tmat4x3<float64, highp>;
// tmat4x4 type explicit instantiation
template struct tmat4x4<float16, lowp>;
template struct tmat4x4<float32, lowp>;
template struct tmat4x4<float64, lowp>;
template struct tmat4x4<float16, mediump>;
template struct tmat4x4<float32, mediump>;
template struct tmat4x4<float64, mediump>;
template struct tmat4x4<float16, highp>;
template struct tmat4x4<float32, highp>;
template struct tmat4x4<float64, highp>;
// tquat type explicit instantiation
template struct tquat<float16, lowp>;
template struct tquat<float32, lowp>;
template struct tquat<float64, lowp>;
template struct tquat<float16, mediump>;
template struct tquat<float32, mediump>;
template struct tquat<float64, mediump>;
template struct tquat<float16, highp>;
template struct tquat<float32, highp>;
template struct tquat<float64, highp>;
//tdualquat type explicit instantiation
template struct tdualquat<float16, lowp>;
template struct tdualquat<float32, lowp>;
template struct tdualquat<float64, lowp>;
template struct tdualquat<float16, mediump>;
template struct tdualquat<float32, mediump>;
template struct tdualquat<float64, mediump>;
template struct tdualquat<float16, highp>;
template struct tdualquat<float32, highp>;
template struct tdualquat<float64, highp>;

View File

@ -1003,7 +1003,7 @@ GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float con
__m128 Sin0 = _mm_set_ss(s);
__m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0));
// detail::tvec3<valType> temp = (valType(1) - c) * axis;
// detail::tvec3<T, P> temp = (valType(1) - c) * axis;
__m128 Temp0 = _mm_sub_ps(one, CosA);
__m128 Temp1 = _mm_mul_ps(Temp0, AxisC);

View File

@ -28,10 +28,10 @@
//
//// lessThan
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type lessThan
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type lessThan
//(
// detail::tvec2<valType> const & x,
// detail::tvec2<valType> const & y
// detail::tvec2<T, P> const & x,
// detail::tvec2<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -43,10 +43,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type lessThan
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type lessThan
//(
// detail::tvec3<valType> const & x,
// detail::tvec3<valType> const & y
// detail::tvec3<T, P> const & x,
// detail::tvec3<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -58,10 +58,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type lessThan
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type lessThan
//(
// detail::tvec4<valType> const & x,
// detail::tvec4<valType> const & y
// detail::tvec4<T, P> const & x,
// detail::tvec4<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -74,10 +74,10 @@
//
//// lessThanEqual
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type lessThanEqual
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type lessThanEqual
//(
// detail::tvec2<valType> const & x,
// detail::tvec2<valType> const & y
// detail::tvec2<T, P> const & x,
// detail::tvec2<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -89,10 +89,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type lessThanEqual
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type lessThanEqual
//(
// detail::tvec3<valType> const & x,
// detail::tvec3<valType> const & y
// detail::tvec3<T, P> const & x,
// detail::tvec3<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -104,10 +104,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type lessThanEqual
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type lessThanEqual
//(
// detail::tvec4<valType> const & x,
// detail::tvec4<valType> const & y
// detail::tvec4<T, P> const & x,
// detail::tvec4<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -120,10 +120,10 @@
//
//// greaterThan
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type greaterThan
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type greaterThan
//(
// detail::tvec2<valType> const & x,
// detail::tvec2<valType> const & y
// detail::tvec2<T, P> const & x,
// detail::tvec2<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -135,10 +135,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type greaterThan
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type greaterThan
//(
// detail::tvec3<valType> const & x,
// detail::tvec3<valType> const & y
// detail::tvec3<T, P> const & x,
// detail::tvec3<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -150,10 +150,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type greaterThan
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type greaterThan
//(
// detail::tvec4<valType> const & x,
// detail::tvec4<valType> const & y
// detail::tvec4<T, P> const & x,
// detail::tvec4<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -166,10 +166,10 @@
//
//// greaterThanEqual
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type greaterThanEqual
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type greaterThanEqual
//(
// detail::tvec2<valType> const & x,
// detail::tvec2<valType> const & y
// detail::tvec2<T, P> const & x,
// detail::tvec2<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -181,10 +181,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type greaterThanEqual
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type greaterThanEqual
//(
// detail::tvec3<valType> const & x,
// detail::tvec3<valType> const & y
// detail::tvec3<T, P> const & x,
// detail::tvec3<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -196,10 +196,10 @@
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type greaterThanEqual
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type greaterThanEqual
//(
// detail::tvec4<valType> const & x,
// detail::tvec4<valType> const & y
// detail::tvec4<T, P> const & x,
// detail::tvec4<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -212,10 +212,10 @@
//
//// equal
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type equal
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type equal
//(
// detail::tvec2<valType> const & x,
// detail::tvec2<valType> const & y
// detail::tvec2<T, P> const & x,
// detail::tvec2<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -224,14 +224,14 @@
// detail::type<valType>::is_uint ||
// detail::type<valType>::is_bool);
//
// return typename detail::tvec2<valType>::bool_type(x.x == y.x, x.y == y.y);
// return typename detail::tvec2<T, P>::bool_type(x.x == y.x, x.y == y.y);
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type equal
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type equal
//(
// detail::tvec3<valType> const & x,
// detail::tvec3<valType> const & y
// detail::tvec3<T, P> const & x,
// detail::tvec3<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -240,14 +240,14 @@
// detail::type<valType>::is_uint ||
// detail::type<valType>::is_bool);
//
// return typename detail::tvec3<valType>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
// return typename detail::tvec3<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type equal
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type equal
//(
// detail::tvec4<valType> const & x,
// detail::tvec4<valType> const & y
// detail::tvec4<T, P> const & x,
// detail::tvec4<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -256,15 +256,15 @@
// detail::type<valType>::is_uint ||
// detail::type<valType>::is_bool);
//
// return typename detail::tvec4<valType>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
// return typename detail::tvec4<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
//}
//
//// notEqual
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec2<valType>::bool_type notEqual
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type notEqual
//(
// detail::tvec2<valType> const & x,
// detail::tvec2<valType> const & y
// detail::tvec2<T, P> const & x,
// detail::tvec2<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -273,14 +273,14 @@
// detail::type<valType>::is_uint ||
// detail::type<valType>::is_bool);
//
// return typename detail::tvec2<valType>::bool_type(x.x != y.x, x.y != y.y);
// return typename detail::tvec2<T, P>::bool_type(x.x != y.x, x.y != y.y);
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec3<valType>::bool_type notEqual
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type notEqual
//(
// detail::tvec3<valType> const & x,
// detail::tvec3<valType> const & y
// detail::tvec3<T, P> const & x,
// detail::tvec3<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -289,14 +289,14 @@
// detail::type<valType>::is_uint ||
// detail::type<valType>::is_bool);
//
// return typename detail::tvec3<valType>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
// return typename detail::tvec3<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
//}
//
//template <typename valType>
//GLM_FUNC_QUALIFIER typename detail::tvec4<valType>::bool_type notEqual
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type notEqual
//(
// detail::tvec4<valType> const & x,
// detail::tvec4<valType> const & y
// detail::tvec4<T, P> const & x,
// detail::tvec4<T, P> const & y
//)
//{
// GLM_STATIC_ASSERT(
@ -305,7 +305,7 @@
// detail::type<valType>::is_uint ||
// detail::type<valType>::is_bool);
//
// return typename detail::tvec4<valType>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
// return typename detail::tvec4<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
//}
//
//// any

View File

@ -52,6 +52,7 @@
#define GLM_PLATFORM_CHROME_NACL 0x00200000
#define GLM_PLATFORM_UNIX 0x00400000
#define GLM_PLATFORM_QNXNTO 0x00800000
#define GLM_PLATFORM_WINCE 0x01000000
#ifdef GLM_FORCE_PLATFORM_UNKNOWN
# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
@ -59,6 +60,8 @@
# define GLM_PLATFORM GLM_PLATFORM_QNXNTO
#elif defined(__APPLE__)
# define GLM_PLATFORM GLM_PLATFORM_APPLE
#elif defined(WINCE)
# define GLM_PLATFORM GLM_PLATFORM_WINCE
#elif defined(_WIN32)
# define GLM_PLATFORM GLM_PLATFORM_WINDOWS
#elif defined(__native_client__)
@ -76,20 +79,24 @@
// Report platform detection
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED))
# define GLM_MESSAGE_PLATFORM_DISPLAYED
# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
# pragma message("GLM: Windows platform detected")
# if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
# pragma message("GLM: QNX platform detected")
//# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
//# pragma message("GLM: iOS platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
# pragma message("GLM: Apple platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
# pragma message("GLM: WinCE platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
# pragma message("GLM: Windows platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
# pragma message("GLM: Native Client detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# pragma message("GLM: Android platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
# pragma message("GLM: Linux platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
# pragma message("GLM: UNIX platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# pragma message("GLM: Android platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
# pragma message("GLM: Chrone Native Client detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
# pragma message("GLM: platform unknown")
# else
@ -105,27 +112,27 @@
#define GLM_COMPILER_UNKNOWN 0x00000000
// Intel
#define GLM_COMPILER_INTEL 0x00100000
#define GLM_COMPILER_INTEL9 0x00100010
#define GLM_COMPILER_INTEL10_0 0x00100020
#define GLM_COMPILER_INTEL10_1 0x00100030
#define GLM_COMPILER_INTEL11_0 0x00100040
#define GLM_COMPILER_INTEL11_1 0x00100050
#define GLM_COMPILER_INTEL12_0 0x00100060
#define GLM_COMPILER_INTEL12_1 0x00100070
#define GLM_COMPILER_INTEL13_0 0x00100080
// Visual C++ defines
#define GLM_COMPILER_VC 0x01000000
#define GLM_COMPILER_VC2 0x01000010
#define GLM_COMPILER_VC4 0x01000020
#define GLM_COMPILER_VC5 0x01000030
#define GLM_COMPILER_VC6 0x01000040
#define GLM_COMPILER_VC2002 0x01000050
#define GLM_COMPILER_VC2003 0x01000060
#define GLM_COMPILER_VC2005 0x01000070
#define GLM_COMPILER_VC2008 0x01000080
#define GLM_COMPILER_VC2010 0x01000090
#define GLM_COMPILER_VC2012 0x010000A0
#define GLM_COMPILER_VC8 0x01000070
#define GLM_COMPILER_VC9 0x01000080
#define GLM_COMPILER_VC10 0x01000090
#define GLM_COMPILER_VC11 0x010000A0
#define GLM_COMPILER_VC12 0x010000B0
// GCC defines
#define GLM_COMPILER_GCC 0x02000000
#define GLM_COMPILER_GCC_LLVM 0x02000001
#define GLM_COMPILER_GCC_CLANG 0x02000002
#define GLM_COMPILER_GCC30 0x02000010
#define GLM_COMPILER_GCC31 0x02000020
#define GLM_COMPILER_GCC32 0x02000030
#define GLM_COMPILER_GCC33 0x02000040
#define GLM_COMPILER_GCC34 0x02000050
#define GLM_COMPILER_GCC35 0x02000060
#define GLM_COMPILER_GCC40 0x02000070
@ -138,18 +145,9 @@
#define GLM_COMPILER_GCC47 0x020000E0
#define GLM_COMPILER_GCC48 0x020000F0
#define GLM_COMPILER_GCC49 0x02000100
#define GLM_COMPILER_GCC50 0x02000200
// G++ command line to display defined
// echo "" | g++ -E -dM -x c++ - | sort
// Borland C++ defines. How to identify BC?
// Borland C++
#define GLM_COMPILER_BC 0x04000000
#define GLM_COMPILER_BCB4 0x04000100
#define GLM_COMPILER_BCB5 0x04000200
#define GLM_COMPILER_BCB6 0x04000300
//#define GLM_COMPILER_BCBX 0x04000400 // What's the version value?
#define GLM_COMPILER_BCB2009 0x04000500
// CodeWarrior
#define GLM_COMPILER_CODEWARRIOR 0x08000000
@ -177,21 +175,11 @@
#define GLM_COMPILER_CLANG41 0x200000A0
#define GLM_COMPILER_CLANG42 0x200000B0
#define GLM_COMPILER_CLANG43 0x200000C0
#define GLM_COMPILER_CLANG50 0x200000D0
// LLVM GCC
#define GLM_COMPILER_LLVM_GCC 0x40000000
// Intel
#define GLM_COMPILER_INTEL 0x80000000
#define GLM_COMPILER_INTEL9 0x80000010
#define GLM_COMPILER_INTEL10_0 0x80000020
#define GLM_COMPILER_INTEL10_1 0x80000030
#define GLM_COMPILER_INTEL11_0 0x80000040
#define GLM_COMPILER_INTEL11_1 0x80000050
#define GLM_COMPILER_INTEL12_0 0x80000060
#define GLM_COMPILER_INTEL12_1 0x80000070
#define GLM_COMPILER_INTEL13_0 0x80000080
// Build model
#define GLM_MODEL_32 0x00000010
#define GLM_MODEL_64 0x00000020
@ -215,7 +203,7 @@
# define GLM_COMPILER GLM_COMPILER_INTEL12_0
# elif __INTEL_COMPILER == 1210
# define GLM_COMPILER GLM_COMPILER_INTEL12_1
# elif __INTEL_COMPILER == 1300
# elif __INTEL_COMPILER >= 1300
# define GLM_COMPILER GLM_COMPILER_INTEL13_0
# else
# define GLM_COMPILER GLM_COMPILER_INTEL
@ -223,56 +211,35 @@
// CUDA
#elif defined(__CUDACC__)
# define GLM_COMPILER GLM_COMPILER_CUDA
/*
# if CUDA_VERSION < 3000
# error "GLM requires CUDA 3.0 or higher"
# elif CUDA_VERSION == 3000
# define GLM_COMPILER GLM_COMPILER_CUDA30
# elif CUDA_VERSION == 3010
# define GLM_COMPILER GLM_COMPILER_CUDA31
# elif CUDA_VERSION == 3020
# define GLM_COMPILER GLM_COMPILER_CUDA32
# elif CUDA_VERSION == 4000
# define GLM_COMPILER GLM_COMPILER_CUDA40
# elif CUDA_VERSION == 4010
# define GLM_COMPILER GLM_COMPILER_CUDA41
# elif CUDA_VERSION == 4020
# define GLM_COMPILER GLM_COMPILER_CUDA42
# else
# define GLM_COMPILER GLM_COMPILER_CUDA
# endif
*/
// Visual C++
#elif defined(_MSC_VER)
# if _MSC_VER == 900
# define GLM_COMPILER GLM_COMPILER_VC2
# elif _MSC_VER == 1000
# define GLM_COMPILER GLM_COMPILER_VC4
# elif _MSC_VER == 1100
# define GLM_COMPILER GLM_COMPILER_VC5
# elif _MSC_VER == 1200
# define GLM_COMPILER GLM_COMPILER_VC6
# elif _MSC_VER == 1300
# define GLM_COMPILER GLM_COMPILER_VC2002
# elif _MSC_VER == 1310
# define GLM_COMPILER GLM_COMPILER_VC2003
# if _MSC_VER < 1400
# error "GLM requires Visual C++ 2005 or higher"
# elif _MSC_VER == 1400
# define GLM_COMPILER GLM_COMPILER_VC2005
# define GLM_COMPILER GLM_COMPILER_VC8
# elif _MSC_VER == 1500
# define GLM_COMPILER GLM_COMPILER_VC2008
# define GLM_COMPILER GLM_COMPILER_VC9
# elif _MSC_VER == 1600
# define GLM_COMPILER GLM_COMPILER_VC2010
# define GLM_COMPILER GLM_COMPILER_VC10
# elif _MSC_VER == 1700
# define GLM_COMPILER GLM_COMPILER_VC2012
# define GLM_COMPILER GLM_COMPILER_VC11
# elif _MSC_VER >= 1800
# define GLM_COMPILER GLM_COMPILER_VC12
# else//_MSC_VER
# define GLM_COMPILER GLM_COMPILER_VC
# endif//_MSC_VER
// Clang
#elif defined(__clang__)
# if(__clang_major__ == 2) && (__clang_minor__ == 6)
# if (__clang_major__ <= 1) || ((__clang_major__ == 2) && (__clang_minor__ < 6))
# error "GLM requires Clang 2.6 or higher"
# elif(__clang_major__ == 2) && (__clang_minor__ == 6)
# define GLM_COMPILER GLM_COMPILER_CLANG26
# elif(__clang_major__ == 2) && (__clang_minor__ == 7)
# define GLM_COMPILER GLM_COMPILER_CLANG27
@ -294,19 +261,17 @@
# define GLM_COMPILER GLM_COMPILER_CLANG41
# elif(__clang_major__ == 4) && (__clang_minor__ == 2)
# define GLM_COMPILER GLM_COMPILER_CLANG42
# elif(__clang_major__ == 4) && (__clang_minor__ == 3)
# elif(__clang_major__ == 4) && (__clang_minor__ >= 3)
# define GLM_COMPILER GLM_COMPILER_CLANG43
# elif(__clang_major__ > 4)
# define GLM_COMPILER GLM_COMPILER_CLANG50
# else
# define GLM_COMPILER GLM_COMPILER_CLANG
# endif
// G++
#elif(defined(__GNUC__) || defined(__MINGW32__))// || defined(__llvm__) || defined(__clang__)
# if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
# define GLM_COMPILER GLM_COMPILER_GCC32
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
# define GLM_COMPILER GLM_COMPILER_GCC33
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
# if (__GNUC__ == 3) && (__GNUC_MINOR__ == 4)
# define GLM_COMPILER GLM_COMPILER_GCC34
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ == 5)
# define GLM_COMPILER GLM_COMPILER_GCC35
@ -328,27 +293,17 @@
# define GLM_COMPILER (GLM_COMPILER_GCC47)
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
# define GLM_COMPILER (GLM_COMPILER_GCC48)
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
# define GLM_COMPILER (GLM_COMPILER_GCC49)
# elif (__GNUC__ > 4 )
# define GLM_COMPILER (GLM_COMPILER_GCC49)
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
# define GLM_COMPILER (GLM_COMPILER_GCC50)
# else
# define GLM_COMPILER (GLM_COMPILER_GCC)
# endif
// Borland C++
#elif defined(_BORLANDC_)
# if defined(VER125)
# define GLM_COMPILER GLM_COMPILER_BCB4
# elif defined(VER130)
# define GLM_COMPILER GLM_COMPILER_BCB5
# elif defined(VER140)
# define GLM_COMPILER GLM_COMPILER_BCB6
# elif defined(VER200)
# define GLM_COMPILER GLM_COMPILER_BCB2009
# else
# define GLM_COMPILER GLM_COMPILER_BC
# endif
# define GLM_COMPILER GLM_COMPILER_BC
// Codewarrior
#elif defined(__MWERKS__)
@ -426,18 +381,22 @@
#define GLM_LANG_CXX03_FLAG (1 << 2)
#define GLM_LANG_CXX0X_FLAG (1 << 3)
#define GLM_LANG_CXX11_FLAG (1 << 4)
#define GLM_LANG_CXXMS_FLAG (1 << 5)
#define GLM_LANG_CXXGNU_FLAG (1 << 6)
#define GLM_LANG_CXX1Y_FLAG (1 << 5)
#define GLM_LANG_CXXMS_FLAG (1 << 6)
#define GLM_LANG_CXXGNU_FLAG (1 << 7)
#define GLM_LANG_CXX GLM_LANG_CXX_FLAG
#define GLM_LANG_CXX98 (GLM_LANG_CXX | GLM_LANG_CXX98_FLAG)
#define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)
#define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)
#define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)
#define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG)
#define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG
#define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG
#if(defined(GLM_FORCE_CXX11))
#if(defined(GLM_FORCE_CXX1Y))
# define GLM_LANG GLM_LANG_CXX1Y
#elif(defined(GLM_FORCE_CXX11))
# define GLM_LANG GLM_LANG_CXX11
#elif(defined(GLM_FORCE_CXX03))
# define GLM_LANG GLM_LANG_CXX03
@ -446,22 +405,34 @@
#else
# if(__cplusplus >= 201103L)
# define GLM_LANG GLM_LANG_CXX11
// -std=c++0x or -std=gnu++0x
# elif(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && defined(__GXX_EXPERIMENTAL_CXX0X__))
# define GLM_LANG GLM_LANG_CXX0X
# elif((GLM_COMPILER & GLM_COMPILER_CLANG) == GLM_COMPILER_CLANG)
# if(GLM_PLATFORM == GLM_PLATFORM_APPLE)
# define GLM_DETAIL_MAJOR 1
# else
# define GLM_DETAIL_MAJOR 0
# endif
# if(__clang_major__ < (2 + GLM_DETAIL_MAJOR))
# define GLM_LANG GLM_LANG_CXX
# elif(__has_feature(cxx_auto_type))
# define GLM_LANG GLM_LANG_CXX0X
# else
# define GLM_LANG GLM_LANG_CXX98
# endif
# elif((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC)
# if defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GLM_LANG GLM_LANG_CXX0X
# else
# define GLM_LANG GLM_LANG_CXX98
# endif
# elif(GLM_COMPILER & GLM_COMPILER_VC)
# if(defined(_MSC_EXTENSIONS))
# if(GLM_COMPILER >= GLM_COMPILER_VC2012)
# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
# if(GLM_COMPILER >= GLM_COMPILER_VC10)
# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
# else
# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
# endif
# else
# if(GLM_COMPILER >= GLM_COMPILER_VC2012)
# define GLM_LANG GLM_LANG_CXX11
# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
# if(GLM_COMPILER >= GLM_COMPILER_VC10)
# define GLM_LANG GLM_LANG_CXX0X
# else
# define GLM_LANG GLM_LANG_CXX98
@ -505,8 +476,72 @@
# else
# pragma message("GLM: C++ language undetected")
# endif//GLM_MODEL
# pragma message("GLM: #define GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_LANG_CXX11 or GLM_FORCE_CXX1Y to force using a specific version of the C++ language")
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////////////////////
// Has of C++ features
#ifndef __has_feature
# define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_extension
# define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif
// http://clang.llvm.org/cxx_status.html
// http://gcc.gnu.org/projects/cxx0x.html
// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx
// N1720
#define GLM_HAS_STATIC_ASSERT ( \
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC10)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
__has_feature(cxx_static_assert))
// N1988
#define GLM_HAS_EXTENDED_INTEGER_TYPE ( \
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER >= GLM_COMPILER_CLANG29)))
// N2235
#define GLM_HAS_CONSTEXPR ( \
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
__has_feature(cxx_constexpr))
// N2672
#define GLM_HAS_INITIALIZER_LISTS ( \
(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12))) || \
((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
__has_feature(cxx_generalized_initializers))
// OpenMP
#ifdef _OPENMP
# if(GLM_COMPILER & GLM_COMPILER_GCC)
# if(GLM_COMPILER > GLM_COMPILER_GCC47)
# define GLM_HAS_OPENMP 31
# elif(GLM_COMPILER > GLM_COMPILER_GCC44)
# define GLM_HAS_OPENMP 30
# elif(GLM_COMPILER > GLM_COMPILER_GCC42)
# define GLM_HAS_OPENMP 25
# endif
# endif//(GLM_COMPILER & GLM_COMPILER_GCC)
# if(GLM_COMPILER & GLM_COMPILER_VC)
# if(GLM_COMPILER > GLM_COMPILER_VC8)
# define GLM_HAS_OPENMP 20
# endif
# endif//(GLM_COMPILER & GLM_COMPILER_GCC)
#endif
// Not standard
#define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
/////////////////
// Platform
@ -532,7 +567,9 @@
#elif(defined(GLM_FORCE_SSE2))
# define GLM_ARCH (GLM_ARCH_SSE2)
#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64)))
# if(defined(_M_CEE_PURE))
# if(GLM_PLATFORM == GLM_PLATFORM_WINCE)
# define GLM_ARCH GLM_ARCH_PURE
# elif(defined(_M_CEE_PURE))
# define GLM_ARCH GLM_ARCH_PURE
/* TODO: Explore auto detection of instruction set support
# elif(defined(_M_IX86_FP))
@ -544,17 +581,17 @@
# define GLM_ARCH GLM_ARCH_PURE
# endif
*/
# elif(GLM_COMPILER >= GLM_COMPILER_VC2012)
# elif(GLM_COMPILER >= GLM_COMPILER_VC11)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(GLM_COMPILER >= GLM_COMPILER_VC2010)
# elif(GLM_COMPILER >= GLM_COMPILER_VC10)
# if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)//GLM_ARCH_AVX (Require SP1)
# else
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# endif
# elif(GLM_COMPILER >= GLM_COMPILER_VC2008)
# elif(GLM_COMPILER >= GLM_COMPILER_VC9)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(GLM_COMPILER >= GLM_COMPILER_VC2005)
# elif(GLM_COMPILER >= GLM_COMPILER_VC8)
# define GLM_ARCH GLM_ARCH_SSE2
# else
# define GLM_ARCH GLM_ARCH_PURE
@ -594,6 +631,13 @@
#endif//GLM_ARCH
#if(GLM_ARCH & GLM_ARCH_SSE2)
# include <emmintrin.h>
# if(GLM_COMPILER == GLM_COMPILER_VC8) // VC8 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
//#endif//(GLM_ARCH != GLM_ARCH_PURE)
@ -612,49 +656,7 @@
# elif(GLM_ARCH & GLM_ARCH_AVX2)
# pragma message("GLM: AVX2 instruction set")
# endif//GLM_ARCH
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////////////////////
// Support check macros
#define GLM_SUPPORT_ANONYMOUS_UNION() \
(GLM_LANG & GLM_LANG_CXX98_FLAG)
#define GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() \
((GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC))
#define GLM_SUPPORT_SWIZZLE_OPERATOR() \
(defined(GLM_SWIZZLE) && GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE())
#define GLM_SUPPORT_SWIZZLE_FUNCTION() defined(GLM_SWIZZLE)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Components
//#define GLM_FORCE_ONLY_XYZW
#define GLM_COMPONENT_ONLY_XYZW 0 // To disable multiple vector component names access.
#define GLM_COMPONENT_CXX98 1 //
#define GLM_COMPONENT_CXXMS 2 // To use anonymous union to provide multiple component names access for class valType. Visual C++ only.
#if(GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE() && !defined(GLM_FORCE_ONLY_XYZW))
# define GLM_COMPONENT GLM_COMPONENT_CXXMS
#elif(GLM_SUPPORT_ANONYMOUS_UNION() && !defined(GLM_FORCE_ONLY_XYZW))
# define GLM_COMPONENT GLM_COMPONENT_CXX98
#else
# define GLM_COMPONENT GLM_COMPONENT_ONLY_XYZW
#endif
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_COMPONENT_DISPLAYED))
# define GLM_MESSAGE_COMPONENT_DISPLAYED
# if(GLM_COMPONENT == GLM_COMPONENT_CXX98)
# pragma message("GLM: x,y,z,w; r,g,b,a; s,t,p,q component names except of half based vector types")
# elif(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
# pragma message("GLM: x,y,z,w component names for all vector types")
# elif(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
# pragma message("GLM: x,y,z,w; r,g,b,a; s,t,p,q component names for all vector types")
# else
# error "GLM: GLM_COMPONENT value unknown"
# endif//GLM_MESSAGE_COMPONENT_DISPLAYED
# pragma message("GLM: #define GLM_FORCE_PURE to avoid using platform specific instruction sets")
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -665,7 +667,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Static assert
#if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X)
#if GLM_HAS_STATIC_ASSERT
# define GLM_STATIC_ASSERT(x, message) static_assert(x, message)
#elif(defined(BOOST_STATIC_ASSERT))
# define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x)
@ -696,10 +698,10 @@
#endif
#if(defined(GLM_FORCE_INLINE))
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
# define GLM_INLINE __forceinline
# elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC34))
# define GLM_INLINE __attribute__((always_inline))
# define GLM_INLINE __attribute__((always_inline)) inline
# elif(GLM_COMPILER & GLM_COMPILER_CLANG)
# define GLM_INLINE __attribute__((always_inline))
# else
@ -719,57 +721,70 @@
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
# if(GLM_SUPPORT_SWIZZLE_OPERATOR())
# if defined(GLM_SWIZZLE)
# pragma message("GLM: Swizzling operators enabled")
# elif(GLM_SUPPORT_SWIZZLE_FUNCTION())
# pragma message("GLM: Swizzling operators supported through swizzling functions")
# else
# pragma message("GLM: Swizzling operators disabled")
# pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators")
# endif
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////////////////////
// Length type
// User defines: GLM_FORCE_SIZE_T_LENGTH
namespace glm
{
#if defined(GLM_FORCE_SIZE_T_LENGTH)
typedef std::size_t length_t;
#else
typedef int length_t;
#endif
}//namespace glm
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH))
# define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
# if defined(GLM_FORCE_SIZE_T_LENGTH)
# pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
# else
# pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
# pragma message("GLM: #define GLM_FORCE_SIZE_T_LENGTH for .length() to return a std::size_t")
# endif
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////////////////////
// Qualifiers
#if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
#if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
# define GLM_DEPRECATED __declspec(deprecated)
# define GLM_ALIGN(x) __declspec(align(x))
# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
# define GLM_RESTRICT __declspec(restrict)
# define GLM_RESTRICT_VAR __restrict
# define GLM_CONSTEXPR
#elif(GLM_COMPILER & GLM_COMPILER_INTEL)
# define GLM_DEPRECATED
# define GLM_ALIGN(x) __declspec(align(x))
# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
# define GLM_RESTRICT
# define GLM_RESTRICT_VAR __restrict
# define GLM_CONSTEXPR
#elif(((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) || (GLM_COMPILER & GLM_COMPILER_CLANG))
#elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
# define GLM_DEPRECATED __attribute__((__deprecated__))
# define GLM_ALIGN(x) __attribute__((aligned(x)))
# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
# if(GLM_COMPILER >= GLM_COMPILER_GCC33)
# define GLM_RESTRICT __restrict__
# define GLM_RESTRICT_VAR __restrict__
# else
# define GLM_RESTRICT
# define GLM_RESTRICT_VAR
# endif
# define GLM_RESTRICT __restrict__
# define GLM_RESTRICT_VAR __restrict__
# if((GLM_COMPILER >= GLM_COMPILER_GCC47) && ((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X))
# define GLM_CONSTEXPR constexpr
# else
# define GLM_CONSTEXPR
# endif
#else
# define GLM_DEPRECATED
# define GLM_ALIGN
# define GLM_ALIGNED_STRUCT(x)
# define GLM_RESTRICT
# define GLM_RESTRICT_VAR
# define GLM_CONSTEXPR
#endif//GLM_COMPILER
#if GLM_HAS_CONSTEXPR
# define GLM_CONSTEXPR constexpr
#else
# define GLM_CONSTEXPR
#endif
#endif//GLM_SETUP_INCLUDED

View File

@ -34,20 +34,11 @@
namespace glm{
namespace detail
{
class half;
typedef half float16;
typedef float float32;
typedef double float64;
}//namespace detail
typedef detail::half half;
#ifdef GLM_USE_HALF_SCALAR
typedef detail::half lowp_float_t;
#else//GLM_USE_HALF_SCALAR
typedef float lowp_float_t;
#endif//GLM_USE_HALF_SCALAR
typedef float mediump_float_t;
typedef double highp_float_t;
@ -87,114 +78,18 @@ namespace detail
# error "GLM error: multiple default precision requested for floating-point types"
#endif
typedef half float16;
typedef float float32;
typedef double float64;
////////////////////
// check type sizes
#ifndef GLM_STATIC_ASSERT_NULL
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
#endif//GLM_STATIC_ASSERT_NULL
/// @}
namespace detail
{
//////////////////
// float
template <typename T>
struct is_float
{
enum is_float_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_FLOAT(T) \
template <> \
struct is_float<T> \
{ \
enum is_float_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
////////////////////
// Mark half to be flaot
GLM_DETAIL_IS_FLOAT(half);
GLM_DETAIL_IS_FLOAT(float);
GLM_DETAIL_IS_FLOAT(double);
GLM_DETAIL_IS_FLOAT(long double);
template <>
struct float_or_int_trait<float16>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
template <>
struct float_or_int_trait<float32>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
template <>
struct float_or_int_trait<float64>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
union uif32
{
GLM_FUNC_QUALIFIER uif32() :
i(0)
{}
GLM_FUNC_QUALIFIER uif32(float f) :
f(f)
{}
GLM_FUNC_QUALIFIER uif32(uint32 i) :
i(i)
{}
float f;
uint32 i;
};
union uif64
{
GLM_FUNC_QUALIFIER uif64() :
i(0)
{}
GLM_FUNC_QUALIFIER uif64(double f) :
f(f)
{}
GLM_FUNC_QUALIFIER uif64(uint64 i) :
i(i)
{}
double f;
uint64 i;
};
//////////////////
// type
template <typename T>
struct type
{
enum type_enum
{
is_float = is_float<T>::_YES,
is_int = is_int<T>::_YES,
is_uint = is_uint<T>::_YES,
is_bool = is_bool<T>::_YES
};
};
}//namespace detail
}//namespace glm
#endif//glm_core_type_float

View File

@ -132,7 +132,7 @@ namespace detail
base();
base(class_type const & m);
explicit base(value_type const & x);
explicit base(T const & x);
explicit base(value_type const * const x);
explicit base(col_type const * const x);
@ -149,13 +149,13 @@ namespace detail
//////////////////////////////////////
// Unary updatable operators
class_type& operator= (class_type const & x);
class_type& operator+= (value_type const & x);
class_type& operator+= (T const & x);
class_type& operator+= (class_type const & x);
class_type& operator-= (value_type const & x);
class_type& operator-= (T const & x);
class_type& operator-= (class_type const & x);
class_type& operator*= (value_type const & x);
class_type& operator*= (T const & x);
class_type& operator*= (class_type const & x);
class_type& operator/= (value_type const & x);
class_type& operator/= (T const & x);
class_type& operator/= (class_type const & x);
class_type& operator++ ();
class_type& operator-- ();

View File

@ -97,7 +97,7 @@ base<vT, cT, rT, pT>::base
template <typename vT, uint cT, uint rT, profile pT>
base<vT, cT, rT, pT>::base
(
typename base<vT, cT, rT, pT>::value_type const & x
typename base<vT, cT, rT, pT>::T const & x
)
{
if(rT == 1) // vector
@ -211,7 +211,7 @@ typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator=
template <typename vT, uint cT, uint rT, profile pT>
typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator+=
(
typename base<vT, cT, rT, pT>::value_type const & x
typename base<vT, cT, rT, pT>::T const & x
)
{
typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
@ -243,7 +243,7 @@ typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator+=
template <typename vT, uint cT, uint rT, profile pT>
typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator-=
(
typename base<vT, cT, rT, pT>::value_type const & x
typename base<vT, cT, rT, pT>::T const & x
)
{
typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
@ -275,7 +275,7 @@ typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator-=
template <typename vT, uint cT, uint rT, profile pT>
typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator*=
(
typename base<vT, cT, rT, pT>::value_type const & x
typename base<vT, cT, rT, pT>::T const & x
)
{
typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();
@ -307,7 +307,7 @@ typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator*=
template <typename vT, uint cT, uint rT, profile pT>
typename base<vT, cT, rT, pT>::class_type& base<vT, cT, rT, pT>::operator/=
(
typename base<vT, cT, rT, pT>::value_type const & x
typename base<vT, cT, rT, pT>::T const & x
)
{
typename base<vT, cT, rT, pT>::size_type stop_col = x.col_size();

View File

@ -20,66 +20,32 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_vector_access
/// @file glm/gtx/vector_access.hpp
/// @date 2006-01-16 / 2011-06-07
/// @ref core
/// @file glm/core/type_half.hpp
/// @date 2008-08-17 / 2011-09-20
/// @author Christophe Riccio
///
/// @see core (dependence)
///
/// @defgroup gtx_vector_access GLM_GTX_vector_access
/// @ingroup gtx
///
/// @brief Function to set values to vectors
///
/// <glm/gtx/vector_access.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTX_vector_access
#define GLM_GTX_vector_access GLM_VERSION
#ifndef glm_core_type_half
#define glm_core_type_half
// Dependency:
#include "../glm.hpp"
#include "setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_GTX_vector_access extension included")
#endif
namespace glm
namespace glm{
namespace detail
{
/// @addtogroup gtx_vector_access
/// @{
typedef short hdata;
//! Set values to a 2 components vector.
/// @see gtx_vector_access extension.
template <typename valType>
void set(
detail::tvec2<valType> & v,
valType const & x,
valType const & y);
GLM_FUNC_DECL float toFloat32(hdata value);
GLM_FUNC_DECL hdata toFloat16(float const & value);
//! Set values to a 3 components vector.
/// @see gtx_vector_access extension.
template <typename valType>
void set(
detail::tvec3<valType> & v,
valType const & x,
valType const & y,
valType const & z);
}//namespace detail
//! Set values to a 4 components vector.
/// @see gtx_vector_access extension.
template <typename valType>
void set(
detail::tvec4<valType> & v,
valType const & x,
valType const & y,
valType const & z,
valType const & w);
/// half-precision floating-point numbers.
//typedef detail::hdata half;
/// @}
}//namespace glm
#include "vector_access.inl"
#include "type_half.inl"
#endif//GLM_GTX_vector_access
#endif//glm_core_type_half

View File

@ -43,6 +43,24 @@ namespace detail
return f;
}
union uif32
{
GLM_FUNC_QUALIFIER uif32() :
i(0)
{}
GLM_FUNC_QUALIFIER uif32(float f) :
f(f)
{}
GLM_FUNC_QUALIFIER uif32(uint32 i) :
i(i)
{}
float f;
uint32 i;
};
GLM_FUNC_QUALIFIER float toFloat32(hdata value)
{
int s = (value >> 15) & 0x00000001;
@ -133,9 +151,9 @@ namespace detail
// of float and half (127 versus 15).
//
register int s = (i >> 16) & 0x00008000;
register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
register int m = i & 0x007fffff;
int s = (i >> 16) & 0x00008000;
int e = ((i >> 23) & 0x000000ff) - (127 - 15);
int m = i & 0x007fffff;
//
// Now reassemble s, e and m into a half:
@ -252,168 +270,5 @@ namespace detail
}
}
GLM_FUNC_QUALIFIER half::half() :
data(0)
{}
GLM_FUNC_QUALIFIER half::half(half const & s) :
data(s.data)
{}
template <typename U>
GLM_FUNC_QUALIFIER half::half(U const & s) :
data(toFloat16(float(s)))
{}
/*
template <typename U>
GLM_FUNC_QUALIFIER half::operator U() const
{
return static_cast<U>(toFloat32(this->data));
}
*/
GLM_FUNC_QUALIFIER half::operator float() const
{
return toFloat32(this->data);
}
// Unary updatable operators
GLM_FUNC_QUALIFIER half& half::operator= (half const & s)
{
data = s.data;
return *this;
}
GLM_FUNC_QUALIFIER half& half::operator+=(half const & s)
{
data = toFloat16(toFloat32(data) + toFloat32(s.data));
return *this;
}
GLM_FUNC_QUALIFIER half& half::operator-=(half const & s)
{
data = toFloat16(toFloat32(data) - toFloat32(s.data));
return *this;
}
GLM_FUNC_QUALIFIER half& half::operator*=(half const & s)
{
data = toFloat16(toFloat32(data) * toFloat32(s.data));
return *this;
}
GLM_FUNC_QUALIFIER half& half::operator/=(half const & s)
{
data = toFloat16(toFloat32(data) / toFloat32(s.data));
return *this;
}
GLM_FUNC_QUALIFIER half& half::operator++()
{
float Casted = toFloat32(data);
this->data = toFloat16(++Casted);
return *this;
}
GLM_FUNC_QUALIFIER half& half::operator--()
{
float Casted = toFloat32(data);
this->data = toFloat16(--Casted);
return *this;
}
//////////////////////////////////////
// Binary arithmetic operators
GLM_FUNC_QUALIFIER detail::half operator+ (detail::half const & s1, detail::half const & s2)
{
return detail::half(float(s1) + float(s2));
}
GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s1, detail::half const & s2)
{
return detail::half(float(s1) - float(s2));
}
GLM_FUNC_QUALIFIER detail::half operator* (detail::half const & s1, detail::half const & s2)
{
return detail::half(float(s1) * float(s2));
}
GLM_FUNC_QUALIFIER detail::half operator/ (detail::half const & s1, detail::half const & s2)
{
return detail::half(float(s1) / float(s2));
}
// Unary constant operators
GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s)
{
return detail::half(-float(s));
}
GLM_FUNC_QUALIFIER detail::half operator-- (detail::half const & s, int)
{
return detail::half(float(s) - 1.0f);
}
GLM_FUNC_QUALIFIER detail::half operator++ (detail::half const & s, int)
{
return detail::half(float(s) + 1.0f);
}
GLM_FUNC_QUALIFIER bool operator==
(
detail::half const & x,
detail::half const & y
)
{
return x._data() == y._data();
}
GLM_FUNC_QUALIFIER bool operator!=
(
detail::half const & x,
detail::half const & y
)
{
return x._data() != y._data();
}
GLM_FUNC_QUALIFIER bool operator<
(
detail::half const & x,
detail::half const & y
)
{
return float(x) < float(y);
}
GLM_FUNC_QUALIFIER bool operator<=
(
detail::half const & x,
detail::half const & y
)
{
return float(x) <= float(y);
}
GLM_FUNC_QUALIFIER bool operator>
(
detail::half const & x,
detail::half const & y
)
{
return float(x) > float(y);
}
GLM_FUNC_QUALIFIER bool operator>=
(
detail::half const & x,
detail::half const & y
)
{
return float(x) >= float(y);
}
}//namespace detail
}//namespace glm

View File

@ -31,15 +31,14 @@
#include "setup.hpp"
#if(((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
//#if((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
#include <cstdint>
#if GLM_HAS_EXTENDED_INTEGER_TYPE
# include <cstdint>
#endif
namespace glm{
namespace detail
{
# if((GLM_LANG & GLM_LANG_CXX11) == GLM_LANG_CXX11)
# if GLM_HAS_EXTENDED_INTEGER_TYPE
typedef std::int8_t int8;
typedef std::int16_t int16;
typedef std::int32_t int32;
@ -78,13 +77,13 @@ namespace detail
typedef uint64 uint64;
#endif//
typedef signed short lowp_int_t;
typedef signed int lowp_int_t;
typedef signed int mediump_int_t;
typedef int64 highp_int_t;
typedef signed int highp_int_t;
typedef unsigned short lowp_uint_t;
typedef unsigned int lowp_uint_t;
typedef unsigned int mediump_uint_t;
typedef uint64 highp_uint_t;
typedef unsigned int highp_uint_t;
}//namespace detail
typedef detail::int8 int8;
@ -187,158 +186,6 @@ namespace detail
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
#endif//GLM_STATIC_ASSERT_NULL
namespace detail
{
//////////////////
// int
template <typename T>
struct is_int
{
enum is_int_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_INT(T) \
template <> \
struct is_int<T> \
{ \
enum is_int_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
GLM_DETAIL_IS_INT(signed char);
GLM_DETAIL_IS_INT(signed short);
GLM_DETAIL_IS_INT(signed int);
GLM_DETAIL_IS_INT(signed long);
GLM_DETAIL_IS_INT(highp_int_t);
//////////////////
// uint
template <typename T>
struct is_uint
{
enum is_uint_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_UINT(T) \
template <> \
struct is_uint<T> \
{ \
enum is_uint_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
GLM_DETAIL_IS_UINT(unsigned char);
GLM_DETAIL_IS_UINT(unsigned short);
GLM_DETAIL_IS_UINT(unsigned int);
GLM_DETAIL_IS_UINT(unsigned long);
GLM_DETAIL_IS_UINT(highp_uint_t);
//////////////////
// bool
template <typename T>
struct is_bool
{
enum is_bool_enum
{
_YES = 0,
_NO = 1
};
};
template <>
struct is_bool<bool>
{
enum is_bool_enum
{
_YES = 1,
_NO = 0
};
};
//////////////////
// float_or_int_trait
struct float_or_int_value
{
enum
{
GLM_ERROR,
GLM_FLOAT,
GLM_INT
};
};
template <typename T>
struct float_or_int_trait
{
enum{ID = float_or_int_value::GLM_ERROR};
};
template <>
struct float_or_int_trait<detail::int8>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::int16>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::int32>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::int64>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::uint8>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::uint16>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::uint32>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<detail::uint64>
{
enum{ID = float_or_int_value::GLM_INT};
};
}//namespace detail
}//namespace glm
#endif//glm_core_type_int

View File

@ -30,7 +30,9 @@
#define glm_core_type_mat2x2
#include "../fwd.hpp"
#include "type_vec2.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -38,7 +40,6 @@ namespace detail
template <typename T, precision P>
struct tmat2x2
{
// Implementation detail
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
@ -47,38 +48,48 @@ namespace detail
typedef tmat2x2<T, P> type;
typedef tmat2x2<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
public:
// Implementation detail
GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
template <typename U, precision Q>
friend tmat2x2<U, Q> inverse(tmat2x2<U, Q> const & m);
template <typename U, precision Q>
friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
template <typename U, precision Q>
friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
private:
//////////////////////////////////////
// Implementation detail
/// @cond DETAIL
col_type value[2];
GLM_FUNC_DECL tmat2x2<T, P> _inverse() const;
/// @endcond
public:
//////////////////////////////////////
// Constructors
GLM_FUNC_DECL tmat2x2();
GLM_FUNC_DECL tmat2x2(
tmat2x2 const & m);
GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x2(
ctor Null);
GLM_FUNC_DECL explicit tmat2x2(
value_type const & x);
T const & x);
GLM_FUNC_DECL explicit tmat2x2(
value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2);
T const & x1, T const & y1,
T const & x2, T const & y2);
GLM_FUNC_DECL explicit tmat2x2(
col_type const & v1,
col_type const & v2);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat2x2(std::initializer_list<U> m);
GLM_FUNC_DECL tmat2x2(std::initializer_list<tvec2<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
@ -112,27 +123,27 @@ namespace detail
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(tmat2x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(tmat2x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(tmat2x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(tmat2x2<U, P> const & m);
@ -146,101 +157,101 @@ namespace detail
};
// Binary operators
template <typename T, precision P>
tmat2x2<T, P> operator+ (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s);
template <typename T, precision P>
tmat2x2<T, P> operator+ (
typename tmat2x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
tmat2x2<T, P> const & m,
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
tmat2x2<T, P> operator+ (
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
tmat2x2<T, P> const & m1,
tmat2x2<T, P> const & m2);
template <typename T, precision P>
tmat2x2<T, P> operator- (
GLM_FUNC_DECL tmat2x2<T, P> operator- (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x2<T, P> operator- (
typename tmat2x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x2<T, P> operator- (
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
tmat2x2<T, P> operator- (
GLM_FUNC_DECL tmat2x2<T, P> operator- (
tmat2x2<T, P> const & m1,
tmat2x2<T, P> const & m2);
template <typename T, precision P>
tmat2x2<T, P> operator* (
GLM_FUNC_DECL tmat2x2<T, P> operator* (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x2<T, P> operator* (
typename tmat2x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x2<T, P> operator* (
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
typename tmat2x2<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator* (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat2x2<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator* (
typename tmat2x2<T, P>::col_type const & v,
tmat2x2<T, P> const & m);
template <typename T, precision P>
tmat2x2<T, P> operator* (
GLM_FUNC_DECL tmat2x2<T, P> operator* (
tmat2x2<T, P> const & m1,
tmat2x2<T, P> const & m2);
template <typename T, precision P>
tmat3x2<T, P> operator* (
GLM_FUNC_DECL tmat3x2<T, P> operator* (
tmat2x2<T, P> const & m1,
tmat3x2<T, P> const & m2);
template <typename T, precision P>
tmat4x2<T, P> operator* (
GLM_FUNC_DECL tmat4x2<T, P> operator* (
tmat2x2<T, P> const & m1,
tmat4x2<T, P> const & m2);
template <typename T, precision P>
tmat2x2<T, P> operator/ (
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x2<T, P> operator/ (
typename tmat2x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
typename tmat2x2<T, P>::col_type operator/ (
GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator/ (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat2x2<T, P>::row_type operator/ (
GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator/ (
typename tmat2x2<T, P>::col_type const & v,
tmat2x2<T, P> const & m);
template <typename T, precision P>
tmat2x2<T, P> operator/ (
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
tmat2x2<T, P> const & m1,
tmat2x2<T, P> const & m2);
// Unary constant operators
template <typename T, precision P>
tmat2x2<T, P> const operator-(
GLM_FUNC_DECL tmat2x2<T, P> const operator-(
tmat2x2<T, P> const & m);
} //namespace detail
} //namespace glm

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::size_type tmat2x2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::size_type tmat2x2<T, P>::col_size()
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::size_type tmat2x2<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2<T, P>::length() const
{
return 2;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type &
tmat2x2<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const &
tmat2x2<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -92,6 +80,15 @@ namespace detail
this->value[1] = m.value[1];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(
tmat2x2<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
@ -102,7 +99,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
value_type const & s
T const & s
)
{
value_type const Zero(0);
@ -113,8 +110,8 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1
T const & x0, T const & y0,
T const & x1, T const & y1
)
{
this->value[0] = col_type(x0, y0);
@ -132,35 +129,58 @@ namespace detail
this->value[1] = v1;
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat2x2<T, P>::tmat2x2
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec2<T, P>(*(p + 0), *(p + 1));
this->value[1] = tvec2<T, P>(*(p + 2), *(p + 3));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(std::initializer_list<tvec2<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T, P>(value_type(s), Zero);
this->value[0] = tvec2<T, P>(static_cast<T>(s), Zero);
this->value[1] = tvec2<T, P>(Zero, value_type(s));
}
template <typename T, precision P>
template <typename X1, typename Y1, typename X2, typename Y2>
GLM_FUNC_DECL tmat2x2<T, P>::tmat2x2
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2
)
{
this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2));
}
template <typename T, precision P>
template <typename V1, typename V2>
GLM_FUNC_DECL tmat2x2<T, P>::tmat2x2
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
tvec2<V1, P> const & v1,
tvec2<V2, P> const & v2
@ -282,10 +302,7 @@ namespace detail
// This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator=
(
tmat2x2<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator= (tmat2x2<T, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -294,10 +311,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator=
(
tmat2x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator= (tmat2x2<U, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -306,10 +320,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -318,10 +329,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+=
(
tmat2x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+= (tmat2x2<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -330,10 +338,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -342,10 +347,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-=
(
tmat2x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-= (tmat2x2<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -354,10 +356,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -366,20 +365,14 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*=
(
tmat2x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*= (tmat2x2<U, P> const & m)
{
return (*this = *this * m);
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -388,12 +381,9 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/=
(
tmat2x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/= (tmat2x2<U, P> const & m)
{
return (*this = *this / m);
return (*this = *this * m._inverse());
}
template <typename T, precision P>
@ -435,7 +425,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -446,7 +436,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
(
typename tmat2x2<T, P>::value_type const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -471,7 +461,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -482,7 +472,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
(
typename tmat2x2<T, P>::value_type const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -507,7 +497,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -518,7 +508,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
(
typename tmat2x2<T, P>::value_type const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -603,7 +593,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::value_type const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -614,7 +604,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
(
typename tmat2x2<T, P>::value_type const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -650,7 +640,8 @@ namespace detail
tmat2x2<T, P> const & m2
)
{
return m1 * m2._inverse();
tmat2x2<T, P> m1_copy(m1);
return m1_copy /= m2;
}
// Unary constant operators

View File

@ -30,7 +30,10 @@
#define glm_core_type_mat2x3
#include "../fwd.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,10 +49,7 @@ namespace detail
typedef tmat2x3<T, P> type;
typedef tmat3x2<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private:
// Data
@ -58,19 +58,28 @@ namespace detail
public:
// Constructors
GLM_FUNC_DECL tmat2x3();
GLM_FUNC_DECL tmat2x3(tmat2x3 const & m);
GLM_FUNC_DECL tmat2x3(tmat2x3<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat2x3(tmat2x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x3(
ctor);
GLM_FUNC_DECL explicit tmat2x3(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tmat2x3(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1);
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1);
GLM_FUNC_DECL explicit tmat2x3(
col_type const & v0,
col_type const & v1);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat2x3(std::initializer_list<U> m);
GLM_FUNC_DECL tmat2x3(std::initializer_list<tvec3<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
@ -102,27 +111,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x);
// Accesses
col_type & operator[](size_type i);
col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator+= (U const & s);
GLM_FUNC_DECL tmat2x3<T, P> & operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator+= (tmat2x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator-= (U const & s);
GLM_FUNC_DECL tmat2x3<T, P> & operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator-= (tmat2x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator*= (U const & s);
GLM_FUNC_DECL tmat2x3<T, P> & operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator*= (tmat2x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P> & operator/= (U const & s);
GLM_FUNC_DECL tmat2x3<T, P> & operator/= (U s);
//////////////////////////////////////
// Increment and decrement operators
@ -134,10 +141,11 @@ namespace detail
};
// Binary operators
template <typename T, precision P>
tmat2x3<T, P> operator+ (
GLM_FUNC_DECL tmat2x3<T, P> operator+ (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x3<T, P> operator+ (
@ -145,63 +153,63 @@ namespace detail
tmat2x3<T, P> const & m2);
template <typename T, precision P>
tmat2x3<T, P> operator- (
GLM_FUNC_DECL tmat2x3<T, P> operator- (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x3<T, P> operator- (
GLM_FUNC_DECL tmat2x3<T, P> operator- (
tmat2x3<T, P> const & m1,
tmat2x3<T, P> const & m2);
template <typename T, precision P>
tmat2x3<T, P> operator* (
GLM_FUNC_DECL tmat2x3<T, P> operator* (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x3<T, P> operator* (
typename tmat2x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x3<T, P> operator* (
T const & s,
tmat2x3<T, P> const & m);
template <typename T, precision P>
typename tmat2x3<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat2x3<T, P>::col_type operator* (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat2x3<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat2x3<T, P>::row_type operator* (
typename tmat2x3<T, P>::col_type const & v,
tmat2x3<T, P> const & m);
template <typename T, precision P>
tmat2x3<T, P> operator* (
GLM_FUNC_DECL tmat2x3<T, P> operator* (
tmat2x3<T, P> const & m1,
tmat2x2<T, P> const & m2);
template <typename T, precision P>
tmat3x3<T, P> operator* (
GLM_FUNC_DECL tmat3x3<T, P> operator* (
tmat2x3<T, P> const & m1,
tmat3x2<T, P> const & m2);
template <typename T, precision P>
tmat4x3<T, P> operator* (
GLM_FUNC_DECL tmat4x3<T, P> operator* (
tmat2x3<T, P> const & m1,
tmat4x2<T, P> const & m2);
template <typename T, precision P>
tmat2x3<T, P> operator/ (
GLM_FUNC_DECL tmat2x3<T, P> operator/ (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x3<T, P> operator/ (
typename tmat2x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x3<T, P> operator/ (
T const & s,
tmat2x3<T, P> const & m);
// Unary constant operators
template <typename T, precision P>
tmat2x3<T, P> const operator- (
GLM_FUNC_DECL tmat2x3<T, P> const operator- (
tmat2x3<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::size_type tmat2x3<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::size_type tmat2x3<T, P>::col_size()
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::size_type tmat2x3<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3<T, P>::length() const
{
return 2;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type &
tmat2x3<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const &
tmat2x3<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -92,6 +80,15 @@ namespace detail
this->value[1] = m.value[1];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(
tmat2x3<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
@ -102,7 +99,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
value_type const & s
T const & s
)
{
this->value[0] = col_type(s, T(0), T(0));
@ -112,8 +109,8 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1
)
{
this->value[0] = col_type(x0, y0, z0);
@ -131,17 +128,40 @@ namespace detail
this->value[1] = v1;
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat2x3<T, P>::tmat2x3
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec3<T, P>(*(p + 0), *(p + 1), *(p + 2));
this->value[1] = tvec3<T, P>(*(p + 3), *(p + 4), *(p + 5));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(std::initializer_list<tvec3<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T, P>(value_type(s), Zero, Zero);
this->value[0] = tvec3<T, P>(static_cast<T>(s), Zero, Zero);
this->value[1] = tvec3<T, P>(Zero, value_type(s), Zero);
}
@ -149,19 +169,19 @@ namespace detail
template <
typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL tmat2x3<T, P>::tmat2x3
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2
)
{
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2));
}
template <typename T, precision P>
template <typename V1, typename V2>
GLM_FUNC_DECL tmat2x3<T, P>::tmat2x3
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
tvec3<V1, P> const & v1,
tvec3<V2, P> const & v2
@ -269,10 +289,7 @@ namespace detail
// Unary updatable operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator=
(
tmat2x3<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator= (tmat2x3<T, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -281,10 +298,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator=
(
tmat2x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator= (tmat2x3<U, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -293,10 +307,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -305,10 +316,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator+=
(
tmat2x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator+= (tmat2x3<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -317,10 +325,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -329,10 +334,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-=
(
tmat2x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-= (tmat2x3<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -341,10 +343,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -353,20 +352,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator*=
(
tmat2x3<U, P> const & m
)
{
return (*this = tmat2x3<U, P>(*this * m));
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -412,7 +398,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -436,7 +422,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -460,7 +446,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -471,7 +457,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
(
typename tmat2x3<T, P>::value_type const & s,
T const & s,
tmat2x3<T, P> const & m
)
{
@ -579,7 +565,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::value_type const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -590,7 +576,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/
(
typename tmat2x3<T, P>::value_type const & s,
T const & s,
tmat2x3<T, P> const & m
)
{

View File

@ -30,7 +30,10 @@
#define glm_core_type_mat2x4
#include "../fwd.hpp"
#include "type_vec2.hpp"
#include "type_vec4.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,10 +49,7 @@ namespace detail
typedef tmat2x4<T, P> type;
typedef tmat4x2<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private:
// Data
@ -58,19 +58,28 @@ namespace detail
public:
// Constructors
GLM_FUNC_DECL tmat2x4();
GLM_FUNC_DECL tmat2x4(tmat2x4 const & m);
GLM_FUNC_DECL tmat2x4(tmat2x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x4(
ctor);
GLM_FUNC_DECL explicit tmat2x4(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tmat2x4(
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1);
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1);
GLM_FUNC_DECL explicit tmat2x4(
col_type const & v0,
col_type const & v1);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat2x4(std::initializer_list<U> m);
GLM_FUNC_DECL tmat2x4(std::initializer_list<tvec4<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
@ -104,27 +113,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x);
// Accesses
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator+= (U const & s);
GLM_FUNC_DECL tmat2x4<T, P>& operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator+= (tmat2x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator-= (U const & s);
GLM_FUNC_DECL tmat2x4<T, P>& operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator-= (tmat2x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator*= (U const & s);
GLM_FUNC_DECL tmat2x4<T, P>& operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator*= (tmat2x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>& operator/= (U const & s);
GLM_FUNC_DECL tmat2x4<T, P>& operator/= (U s);
//////////////////////////////////////
// Increment and decrement operators
@ -136,74 +143,75 @@ namespace detail
};
// Binary operators
template <typename T, precision P>
tmat2x4<T, P> operator+ (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s);
template <typename T, precision P>
tmat2x4<T, P> operator+ (
GLM_FUNC_DECL tmat2x4<T, P> operator+ (
tmat2x4<T, P> const & m,
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator+ (
tmat2x4<T, P> const & m1,
tmat2x4<T, P> const & m2);
template <typename T, precision P>
tmat2x4<T, P> operator- (
GLM_FUNC_DECL tmat2x4<T, P> operator- (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x4<T, P> operator- (
GLM_FUNC_DECL tmat2x4<T, P> operator- (
tmat2x4<T, P> const & m1,
tmat2x4<T, P> const & m2);
template <typename T, precision P>
tmat2x4<T, P> operator* (
GLM_FUNC_DECL tmat2x4<T, P> operator* (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x4<T, P> operator* (
typename tmat2x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x4<T, P> operator* (
T const & s,
tmat2x4<T, P> const & m);
template <typename T, precision P>
typename tmat2x4<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat2x4<T, P>::col_type operator* (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat2x4<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat2x4<T, P>::row_type operator* (
typename tmat2x4<T, P>::col_type const & v,
tmat2x4<T, P> const & m);
template <typename T, precision P>
tmat4x4<T, P> operator* (
GLM_FUNC_DECL tmat4x4<T, P> operator* (
tmat2x4<T, P> const & m1,
tmat4x2<T, P> const & m2);
template <typename T, precision P>
tmat2x4<T, P> operator* (
GLM_FUNC_DECL tmat2x4<T, P> operator* (
tmat2x4<T, P> const & m1,
tmat2x2<T, P> const & m2);
template <typename T, precision P>
tmat3x4<T, P> operator* (
GLM_FUNC_DECL tmat3x4<T, P> operator* (
tmat2x4<T, P> const & m1,
tmat3x2<T, P> const & m2);
template <typename T, precision P>
tmat2x4<T, P> operator/ (
GLM_FUNC_DECL tmat2x4<T, P> operator/ (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat2x4<T, P> operator/ (
typename tmat2x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat2x4<T, P> operator/ (
T const & s,
tmat2x4<T, P> const & m);
// Unary constant operators
template <typename T, precision P>
tmat2x4<T, P> const operator- (
GLM_FUNC_DECL tmat2x4<T, P> const operator- (
tmat2x4<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::size_type tmat2x4<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::size_type tmat2x4<T, P>::col_size()
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::size_type tmat2x4<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4<T, P>::length() const
{
return 2;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type &
tmat2x4<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const &
tmat2x4<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -94,6 +82,15 @@ namespace detail
this->value[1] = m.value[1];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(
tmat2x4<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
@ -104,7 +101,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
value_type const & s
T const & s
)
{
value_type const Zero(0);
@ -115,8 +112,8 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1
)
{
this->value[0] = col_type(x0, y0, z0, w0);
@ -134,17 +131,40 @@ namespace detail
this->value[1] = v1;
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat2x4<T, P>::tmat2x4
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(std::initializer_list<tvec4<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T, P>(value_type(s), Zero, Zero, Zero);
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
this->value[1] = tvec4<T, P>(Zero, value_type(s), Zero, Zero);
}
@ -152,19 +172,19 @@ namespace detail
template <
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_DECL tmat2x4<T, P>::tmat2x4
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2
)
{
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2), value_type(w2));
}
template <typename T, precision P>
template <typename V1, typename V2>
GLM_FUNC_DECL tmat2x4<T, P>::tmat2x4
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
tvec4<V1, P> const & v1,
tvec4<V2, P> const & v2
@ -272,10 +292,7 @@ namespace detail
// Unary updatable operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator=
(
tmat2x4<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator= (tmat2x4<T, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -284,10 +301,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator=
(
tmat2x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator= (tmat2x4<U, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -296,10 +310,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -308,10 +319,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+=
(
tmat2x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+= (tmat2x4<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -320,10 +328,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -332,10 +337,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-=
(
tmat2x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-= (tmat2x4<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -344,10 +346,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -356,20 +355,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator*=
(
tmat2x4<U, P> const & m
)
{
return (*this = tmat2x4<T, P>(*this * m));
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P> & tmat2x4<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat2x4<T, P> & tmat2x4<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -415,7 +401,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -439,7 +425,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -463,7 +449,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -474,7 +460,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
(
typename tmat2x4<T, P>::value_type const & s,
T const & s,
tmat2x4<T, P> const & m
)
{
@ -598,7 +584,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::value_type const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -609,7 +595,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/
(
typename tmat2x4<T, P>::value_type const & s,
T const & s,
tmat2x4<T, P> const & m
)
{

View File

@ -30,7 +30,10 @@
#define glm_core_type_mat3x2
#include "../fwd.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,10 +49,7 @@ namespace detail
typedef tmat3x2<T, P> type;
typedef tmat2x3<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private:
// Data
@ -59,32 +59,39 @@ namespace detail
// Constructors
GLM_FUNC_DECL tmat3x2();
GLM_FUNC_DECL tmat3x2(tmat3x2<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x2(
ctor);
GLM_FUNC_DECL explicit tmat3x2(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tmat3x2(
value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2);
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2);
GLM_FUNC_DECL explicit tmat3x2(
col_type const & v0,
col_type const & v1,
col_type const & v2);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat3x2(std::initializer_list<U> l);
GLM_FUNC_DECL tmat3x2(std::initializer_list<tvec2<T, P> > l);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat3x2(
U const & x);
template
<
template<
typename X1, typename Y1,
typename X2, typename Y2,
typename X3, typename Y3
>
typename X3, typename Y3>
GLM_FUNC_DECL explicit tmat3x2(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
@ -110,27 +117,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x);
// Accesses
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator+= (U const & s);
GLM_FUNC_DECL tmat3x2<T, P> & operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator+= (tmat3x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator-= (U const & s);
GLM_FUNC_DECL tmat3x2<T, P> & operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator-= (tmat3x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator*= (U const & s);
GLM_FUNC_DECL tmat3x2<T, P> & operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator*= (tmat3x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P> & operator/= (U const & s);
GLM_FUNC_DECL tmat3x2<T, P> & operator/= (U s);
//////////////////////////////////////
// Increment and decrement operators
@ -143,73 +148,73 @@ namespace detail
// Binary operators
template <typename T, precision P>
tmat3x2<T, P> operator+ (
GLM_FUNC_DECL tmat3x2<T, P> operator+ (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x2<T, P> operator+ (
GLM_FUNC_DECL tmat3x2<T, P> operator+ (
tmat3x2<T, P> const & m1,
tmat3x2<T, P> const & m2);
template <typename T, precision P>
tmat3x2<T, P> operator- (
GLM_FUNC_DECL tmat3x2<T, P> operator- (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x2<T, P> operator- (
GLM_FUNC_DECL tmat3x2<T, P> operator- (
tmat3x2<T, P> const & m1,
tmat3x2<T, P> const & m2);
template <typename T, precision P>
tmat3x2<T, P> operator* (
GLM_FUNC_DECL tmat3x2<T, P> operator* (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x2<T, P> operator* (
typename tmat3x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x2<T, P> operator* (
T const & s,
tmat3x2<T, P> const & m);
template <typename T, precision P>
typename tmat3x2<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat3x2<T, P>::col_type operator* (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat3x2<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat3x2<T, P>::row_type operator* (
typename tmat3x2<T, P>::col_type const & v,
tmat3x2<T, P> const & m);
template <typename T, precision P>
tmat2x2<T, P> operator* (
GLM_FUNC_DECL tmat2x2<T, P> operator* (
tmat3x2<T, P> const & m1,
tmat2x3<T, P> const & m2);
template <typename T, precision P>
tmat3x2<T, P> operator* (
GLM_FUNC_DECL tmat3x2<T, P> operator* (
tmat3x2<T, P> const & m1,
tmat3x3<T, P> const & m2);
template <typename T, precision P>
tmat4x2<T, P> operator* (
GLM_FUNC_DECL tmat4x2<T, P> operator* (
tmat3x2<T, P> const & m1,
tmat4x3<T, P> const & m2);
template <typename T, precision P>
tmat3x2<T, P> operator/ (
GLM_FUNC_DECL tmat3x2<T, P> operator/ (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x2<T, P> operator/ (
typename tmat3x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x2<T, P> operator/ (
T const & s,
tmat3x2<T, P> const & m);
// Unary constant operators
template <typename T, precision P>
tmat3x2<T, P> const operator-(
GLM_FUNC_DECL tmat3x2<T, P> const operator-(
tmat3x2<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::size_type tmat3x2<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::size_type tmat3x2<T, P>::col_size()
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::size_type tmat3x2<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2<T, P>::length() const
{
return 3;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type &
tmat3x2<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const &
tmat3x2<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -94,6 +82,16 @@ namespace detail
this->value[2] = m.value[2];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(
tmat3x2<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
@ -104,7 +102,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
value_type const & s
T const & s
)
{
this->value[0] = col_type(s, 0);
@ -115,9 +113,9 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2
)
{
this->value[0] = col_type(x0, y0);
@ -138,17 +136,42 @@ namespace detail
this->value[2] = v2;
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat3x2<T, P>::tmat3x2
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec2<T, P>(*(p + 0), *(p + 1));
this->value[1] = tvec2<T, P>(*(p + 2), *(p + 3));
this->value[2] = tvec2<T, P>(*(p + 4), *(p + 5));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(std::initializer_list<tvec2<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T, P>(value_type(s), Zero);
this->value[0] = tvec2<T, P>(static_cast<T>(s), Zero);
this->value[1] = tvec2<T, P>(Zero, value_type(s));
this->value[2] = tvec2<T, P>(Zero);
}
@ -158,21 +181,21 @@ namespace detail
typename X1, typename Y1,
typename X2, typename Y2,
typename X3, typename Y3>
GLM_FUNC_DECL tmat3x2<T, P>::tmat3x2
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3
)
{
this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2));
this->value[2] = col_type(value_type(x3), value_type(y3));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2));
this->value[2] = col_type(static_cast<T>(x3), value_type(y3));
}
template <typename T, precision P>
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x2<T, P>::tmat3x2
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
tvec2<V1, P> const & v1,
tvec2<V2, P> const & v2,
@ -291,10 +314,7 @@ namespace detail
// Unary updatable operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator=
(
tmat3x2<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator= (tmat3x2<T, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -304,10 +324,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator=
(
tmat3x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator= (tmat3x2<U, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -317,10 +334,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -330,10 +344,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+=
(
tmat3x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+= (tmat3x2<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -343,10 +354,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -356,10 +364,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-=
(
tmat3x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-= (tmat3x2<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -369,10 +374,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -382,20 +384,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator*=
(
tmat3x2<U, P> const & m
)
{
return (*this = tmat3x2<T, P>(*this * m));
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P> & tmat3x2<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x2<T, P> & tmat3x2<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -444,7 +433,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -470,7 +459,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -496,7 +485,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -508,7 +497,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
(
typename tmat3x2<T, P>::value_type const & s,
T const & s,
tmat3x2<T, P> const & m
)
{
@ -608,7 +597,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::value_type const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -620,7 +609,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/
(
typename tmat3x2<T, P>::value_type const & s,
T const & s,
tmat3x2<T, P> const & m
)
{

View File

@ -30,7 +30,9 @@
#define glm_core_type_mat3x3
#include "../fwd.hpp"
#include "type_vec3.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,51 +48,59 @@ namespace detail
typedef tmat3x3<T, P> type;
typedef tmat3x3<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
public:
/// Implementation detail
/// @cond DETAIL
GLM_FUNC_DECL tmat3x3<T, P> _inverse() const;
/// @endcond
template <typename U, precision Q>
friend tmat3x3<U, Q> inverse(tmat3x3<U, Q> const & m);
template <typename U, precision Q>
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
template <typename U, precision Q>
friend tvec3<U, Q> operator/(tvec3<U, Q> const & v, tmat3x3<U, Q> const & m);
private:
// Data
/// @cond DETAIL
col_type value[3];
GLM_FUNC_DECL tmat3x3<T, P> _inverse() const;
/// @endcond
public:
// Constructors
GLM_FUNC_DECL tmat3x3();
GLM_FUNC_DECL tmat3x3(tmat3x3<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x3(
ctor Null);
GLM_FUNC_DECL explicit tmat3x3(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tmat3x3(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1,
value_type const & x2, value_type const & y2, value_type const & z2);
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2);
GLM_FUNC_DECL explicit tmat3x3(
col_type const & v0,
col_type const & v1,
col_type const & v2);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat3x3(std::initializer_list<U> m);
GLM_FUNC_DECL tmat3x3(std::initializer_list<tvec3<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat3x3(
U const & x);
template
<
template<
typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3
>
typename X3, typename Y3, typename Z3>
GLM_FUNC_DECL explicit tmat3x3(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2,
@ -116,27 +126,27 @@ namespace detail
GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x);
// Accesses
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator+= (U const & s);
GLM_FUNC_DECL tmat3x3<T, P>& operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator+= (tmat3x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator-= (U const & s);
GLM_FUNC_DECL tmat3x3<T, P>& operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator-= (tmat3x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator*= (U const & s);
GLM_FUNC_DECL tmat3x3<T, P>& operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator*= (tmat3x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator/= (U const & s);
GLM_FUNC_DECL tmat3x3<T, P>& operator/= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>& operator/= (tmat3x3<U, P> const & m);
@ -151,98 +161,98 @@ namespace detail
// Binary operators
template <typename T, precision P>
tmat3x3<T, P> operator+ (
GLM_FUNC_DECL tmat3x3<T, P> operator+ (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x3<T, P> operator+ (
typename tmat3x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x3<T, P> operator+ (
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
tmat3x3<T, P> operator+ (
GLM_FUNC_DECL tmat3x3<T, P> operator+ (
tmat3x3<T, P> const & m1,
tmat3x3<T, P> const & m2);
template <typename T, precision P>
tmat3x3<T, P> operator- (
GLM_FUNC_DECL tmat3x3<T, P> operator- (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x3<T, P> operator- (
typename tmat3x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x3<T, P> operator- (
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
tmat3x3<T, P> operator- (
GLM_FUNC_DECL tmat3x3<T, P> operator- (
tmat3x3<T, P> const & m1,
tmat3x3<T, P> const & m2);
template <typename T, precision P>
tmat3x3<T, P> operator* (
GLM_FUNC_DECL tmat3x3<T, P> operator* (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x3<T, P> operator* (
typename tmat3x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x3<T, P> operator* (
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
typename tmat3x3<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat3x3<T, P>::col_type operator* (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat3x3<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat3x3<T, P>::row_type operator* (
typename tmat3x3<T, P>::col_type const & v,
tmat3x3<T, P> const & m);
template <typename T, precision P>
tmat3x3<T, P> operator* (
GLM_FUNC_DECL tmat3x3<T, P> operator* (
tmat3x3<T, P> const & m1,
tmat3x3<T, P> const & m2);
template <typename T, precision P>
tmat2x3<T, P> operator* (
GLM_FUNC_DECL tmat2x3<T, P> operator* (
tmat3x3<T, P> const & m1,
tmat2x3<T, P> const & m2);
template <typename T, precision P>
tmat4x3<T, P> operator* (
GLM_FUNC_DECL tmat4x3<T, P> operator* (
tmat3x3<T, P> const & m1,
tmat4x3<T, P> const & m2);
template <typename T, precision P>
tmat3x3<T, P> operator/ (
GLM_FUNC_DECL tmat3x3<T, P> operator/ (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x3<T, P> operator/ (
typename tmat3x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x3<T, P> operator/ (
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
typename tmat3x3<T, P>::col_type operator/ (
GLM_FUNC_DECL typename tmat3x3<T, P>::col_type operator/ (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat3x3<T, P>::row_type operator/ (
GLM_FUNC_DECL typename tmat3x3<T, P>::row_type operator/ (
typename tmat3x3<T, P>::col_type const & v,
tmat3x3<T, P> const & m);
template <typename T, precision P>
tmat3x3<T, P> operator/ (
GLM_FUNC_DECL tmat3x3<T, P> operator/ (
tmat3x3<T, P> const & m1,
tmat3x3<T, P> const & m2);
// Unary constant operators
template <typename T, precision P>
tmat3x3<T, P> const operator-(
GLM_FUNC_DECL tmat3x3<T, P> const operator-(
tmat3x3<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::size_type tmat3x3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::size_type tmat3x3<T, P>::col_size()
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::size_type tmat3x3<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3<T, P>::length() const
{
return 3;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type &
tmat3x3<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const &
tmat3x3<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -103,10 +91,20 @@ namespace detail
)
{}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(
tmat3x3<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
value_type const & s
T const & s
)
{
value_type const Zero(0);
@ -118,9 +116,9 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1,
value_type const & x2, value_type const & y2, value_type const & z2
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2
)
{
this->value[0] = col_type(x0, y0, z0);
@ -141,17 +139,42 @@ namespace detail
this->value[2] = v2;
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat3x3<T, P>::tmat3x3
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec3<T, P>(*(p + 0), *(p + 1), *(p + 2));
this->value[1] = tvec3<T, P>(*(p + 3), *(p + 4), *(p + 5));
this->value[2] = tvec3<T, P>(*(p + 6), *(p + 7), *(p + 8));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(std::initializer_list<tvec3<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T, P>(value_type(s), Zero, Zero);
this->value[0] = tvec3<T, P>(static_cast<T>(s), Zero, Zero);
this->value[1] = tvec3<T, P>(Zero, value_type(s), Zero);
this->value[2] = tvec3<T, P>(Zero, Zero, value_type(s));
}
@ -161,21 +184,21 @@ namespace detail
typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3>
GLM_FUNC_DECL tmat3x3<T, P>::tmat3x3
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3
)
{
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2));
this->value[2] = col_type(static_cast<T>(x3), value_type(y3), value_type(z3));
}
template <typename T, precision P>
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x3<T, P>::tmat3x3
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
tvec3<V1, P> const & v1,
tvec3<V2, P> const & v2,
@ -294,10 +317,7 @@ namespace detail
// Operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator=
(
tmat3x3<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator= (tmat3x3<T, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -307,10 +327,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator=
(
tmat3x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator= (tmat3x3<U, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -320,10 +337,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -333,10 +347,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+=
(
tmat3x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+= (tmat3x3<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -346,10 +357,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -359,10 +367,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-=
(
tmat3x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-= (tmat3x3<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -372,10 +377,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -385,20 +387,14 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*=
(
tmat3x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*= (tmat3x3<U, P> const & m)
{
return (*this = *this * m);
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -408,12 +404,9 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/=
(
tmat3x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/= (tmat3x3<U, P> const & m)
{
return (*this = *this / m);
return (*this = *this * m._inverse());
}
template <typename T, precision P>
@ -502,7 +495,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -514,7 +507,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
(
typename tmat3x3<T, P>::value_type const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -541,7 +534,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -553,7 +546,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
(
typename tmat3x3<T, P>::value_type const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -580,7 +573,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -592,7 +585,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
(
typename tmat3x3<T, P>::value_type const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -710,7 +703,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::value_type const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -722,7 +715,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
(
typename tmat3x3<T, P>::value_type const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -759,7 +752,8 @@ namespace detail
tmat3x3<T, P> const & m2
)
{
return m1 * m2._inverse();
tmat3x3<T, P> m1_copy(m1);
return m1_copy /= m2;
}
// Unary constant operators

View File

@ -30,7 +30,10 @@
#define glm_core_type_mat3x4
#include "../fwd.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,10 +49,7 @@ namespace detail
typedef tmat3x4<T, P> type;
typedef tmat4x3<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private:
// Data
@ -58,33 +58,40 @@ namespace detail
public:
// Constructors
GLM_FUNC_DECL tmat3x4();
GLM_FUNC_DECL tmat3x4(tmat3x4 const & m);
GLM_FUNC_DECL tmat3x4(tmat3x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat3x4(tmat3x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x4(
ctor Null);
GLM_FUNC_DECL explicit tmat3x4(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tmat3x4(
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2);
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2);
GLM_FUNC_DECL explicit tmat3x4(
col_type const & v0,
col_type const & v1,
col_type const & v2);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat3x4(std::initializer_list<U> m);
GLM_FUNC_DECL tmat3x4(std::initializer_list<tvec4<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat3x4(
U const & x);
template
<
template<
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3
>
typename X3, typename Y3, typename Z3, typename W3>
GLM_FUNC_DECL explicit tmat3x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
@ -110,27 +117,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x);
// Accesses
col_type & operator[](size_type i);
col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator+= (U const & s);
GLM_FUNC_DECL tmat3x4<T, P> & operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator+= (tmat3x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator-= (U const & s);
GLM_FUNC_DECL tmat3x4<T, P> & operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator-= (tmat3x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator*= (U const & s);
GLM_FUNC_DECL tmat3x4<T, P> & operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator*= (tmat3x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P> & operator/= (U const & s);
GLM_FUNC_DECL tmat3x4<T, P> & operator/= (U s);
//////////////////////////////////////
// Increment and decrement operators
@ -143,73 +148,73 @@ namespace detail
// Binary operators
template <typename T, precision P>
tmat3x4<T, P> operator+ (
GLM_FUNC_DECL tmat3x4<T, P> operator+ (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x4<T, P> operator+ (
GLM_FUNC_DECL tmat3x4<T, P> operator+ (
tmat3x4<T, P> const & m1,
tmat3x4<T, P> const & m2);
template <typename T, precision P>
tmat3x4<T, P> operator- (
GLM_FUNC_DECL tmat3x4<T, P> operator- (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x4<T, P> operator- (
GLM_FUNC_DECL tmat3x4<T, P> operator- (
tmat3x4<T, P> const & m1,
tmat3x4<T, P> const & m2);
template <typename T, precision P>
tmat3x4<T, P> operator* (
GLM_FUNC_DECL tmat3x4<T, P> operator* (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x4<T, P> operator* (
typename tmat3x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x4<T, P> operator* (
T const & s,
tmat3x4<T, P> const & m);
template <typename T, precision P>
typename tmat3x4<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat3x4<T, P>::col_type operator* (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat3x4<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat3x4<T, P>::row_type operator* (
typename tmat3x4<T, P>::col_type const & v,
tmat3x4<T, P> const & m);
template <typename T, precision P>
tmat4x4<T, P> operator* (
GLM_FUNC_DECL tmat4x4<T, P> operator* (
tmat3x4<T, P> const & m1,
tmat4x3<T, P> const & m2);
template <typename T, precision P>
tmat2x4<T, P> operator* (
GLM_FUNC_DECL tmat2x4<T, P> operator* (
tmat3x4<T, P> const & m1,
tmat2x3<T, P> const & m2);
template <typename T, precision P>
tmat3x4<T, P> operator* (
GLM_FUNC_DECL tmat3x4<T, P> operator* (
tmat3x4<T, P> const & m1,
tmat3x3<T, P> const & m2);
template <typename T, precision P>
tmat3x4<T, P> operator/ (
GLM_FUNC_DECL tmat3x4<T, P> operator/ (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat3x4<T, P> operator/ (
typename tmat3x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat3x4<T, P> operator/ (
T const & s,
tmat3x4<T, P> const & m);
// Unary constant operators
template <typename T, precision P>
tmat3x4<T, P> const operator-(
GLM_FUNC_DECL tmat3x4<T, P> const operator-(
tmat3x4<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::size_type tmat3x4<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::size_type tmat3x4<T, P>::col_size()
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::size_type tmat3x4<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4<T, P>::length() const
{
return 3;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type &
tmat3x4<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const &
tmat3x4<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -94,6 +82,16 @@ namespace detail
this->value[2] = m.value[2];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(
tmat3x4<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
@ -104,7 +102,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
value_type const & s
T const & s
)
{
value_type const Zero(0);
@ -116,9 +114,9 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2
)
{
this->value[0] = col_type(x0, y0, z0, w0);
@ -140,16 +138,16 @@ namespace detail
}
//////////////////////////////////////
// Convertion constructors
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat3x4<T, P>::tmat3x4
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T, P>(value_type(s), Zero, Zero, Zero);
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
this->value[1] = tvec4<T, P>(Zero, value_type(s), Zero, Zero);
this->value[2] = tvec4<T, P>(Zero, Zero, value_type(s), Zero);
}
@ -159,21 +157,21 @@ namespace detail
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3>
GLM_FUNC_DECL tmat3x4<T, P>::tmat3x4
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3
)
{
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2), value_type(w2));
this->value[2] = col_type(static_cast<T>(x3), value_type(y3), value_type(z3), value_type(w3));
}
template <typename T, precision P>
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x4<T, P>::tmat3x4
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
tvec4<V1, P> const & v1,
tvec4<V2, P> const & v2,
@ -185,6 +183,31 @@ namespace detail
this->value[2] = col_type(v3);
}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
this->value[2] = tvec4<T, P>(*(p + 8), *(p + 9), *(p + 10), *(p + 11));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(std::initializer_list<tvec4<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
}
#endif//GLM_HAS_INITIALIZER_LISTS
// Conversion
template <typename T, precision P>
template <typename U, precision Q>
@ -290,10 +313,7 @@ namespace detail
// Unary updatable operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator=
(
tmat3x4<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator= (tmat3x4<T, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -303,10 +323,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator=
(
tmat3x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator= (tmat3x4<U, P> const & m)
{
this->value[0] = m[0];
this->value[1] = m[1];
@ -316,10 +333,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -329,10 +343,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+=
(
tmat3x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+= (tmat3x4<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -342,10 +353,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -355,10 +363,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-=
(
tmat3x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-= (tmat3x4<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -368,10 +373,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -381,20 +383,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator*=
(
tmat3x4<U, P> const & m
)
{
return (*this = tmat3x4<T, P>(*this * m));
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P> & tmat3x4<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat3x4<T, P> & tmat3x4<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -443,7 +432,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -469,7 +458,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -495,7 +484,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -507,7 +496,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
(
typename tmat3x4<T, P>::value_type const & s,
T const & s,
tmat3x4<T, P> const & m
)
{
@ -641,7 +630,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::value_type const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -653,7 +642,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/
(
typename tmat3x4<T, P>::value_type const & s,
T const & s,
tmat3x4<T, P> const & m
)
{

View File

@ -30,7 +30,10 @@
#define glm_core_type_mat4x2
#include "../fwd.hpp"
#include "type_vec2.hpp"
#include "type_vec4.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,10 +49,7 @@ namespace detail
typedef tmat4x2<T, P> type;
typedef tmat2x4<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private:
// Data
@ -58,36 +58,43 @@ namespace detail
public:
// Constructors
GLM_FUNC_DECL tmat4x2();
GLM_FUNC_DECL tmat4x2(tmat4x2 const & m);
GLM_FUNC_DECL tmat4x2(tmat4x2<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x2(
ctor Null);
GLM_FUNC_DECL explicit tmat4x2(
value_type const & x);
T const & x);
GLM_FUNC_DECL explicit tmat4x2(
value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2,
value_type const & x3, value_type const & y3);
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2,
T const & x3, T const & y3);
GLM_FUNC_DECL explicit tmat4x2(
col_type const & v0,
col_type const & v1,
col_type const & v2,
col_type const & v3);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat4x2(std::initializer_list<U> m);
GLM_FUNC_DECL tmat4x2(std::initializer_list<tvec2<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat4x2(
U const & x);
template
<
template<
typename X1, typename Y1,
typename X2, typename Y2,
typename X3, typename Y3,
typename X4, typename Y4
>
typename X4, typename Y4>
GLM_FUNC_DECL explicit tmat4x2(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
@ -115,27 +122,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
// Accesses
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator+= (U const & s);
GLM_FUNC_DECL tmat4x2<T, P>& operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator+= (tmat4x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator-= (U const & s);
GLM_FUNC_DECL tmat4x2<T, P>& operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator-= (tmat4x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator*= (U const & s);
GLM_FUNC_DECL tmat4x2<T, P>& operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator*= (tmat4x2<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>& operator/= (U const & s);
GLM_FUNC_DECL tmat4x2<T, P>& operator/= (U s);
//////////////////////////////////////
// Increment and decrement operators
@ -148,73 +153,73 @@ namespace detail
// Binary operators
template <typename T, precision P>
tmat4x2<T, P> operator+ (
GLM_FUNC_DECL tmat4x2<T, P> operator+ (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x2<T, P> operator+ (
GLM_FUNC_DECL tmat4x2<T, P> operator+ (
tmat4x2<T, P> const & m1,
tmat4x2<T, P> const & m2);
template <typename T, precision P>
tmat4x2<T, P> operator- (
GLM_FUNC_DECL tmat4x2<T, P> operator- (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x2<T, P> operator- (
GLM_FUNC_DECL tmat4x2<T, P> operator- (
tmat4x2<T, P> const & m1,
tmat4x2<T, P> const & m2);
template <typename T, precision P>
tmat4x2<T, P> operator* (
GLM_FUNC_DECL tmat4x2<T, P> operator* (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x2<T, P> operator* (
typename tmat4x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x2<T, P> operator* (
T const & s,
tmat4x2<T, P> const & m);
template <typename T, precision P>
typename tmat4x2<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator* (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat4x2<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator* (
typename tmat4x2<T, P>::col_type const & v,
tmat4x2<T, P> const & m);
template <typename T, precision P>
tmat3x2<T, P> operator* (
GLM_FUNC_DECL tmat3x2<T, P> operator* (
tmat4x2<T, P> const & m1,
tmat3x4<T, P> const & m2);
template <typename T, precision P>
tmat4x2<T, P> operator* (
GLM_FUNC_DECL tmat4x2<T, P> operator* (
tmat4x2<T, P> const & m1,
tmat4x4<T, P> const & m2);
template <typename T, precision P>
tmat2x3<T, P> operator* (
GLM_FUNC_DECL tmat2x3<T, P> operator* (
tmat4x3<T, P> const & m1,
tmat2x4<T, P> const & m2);
template <typename T, precision P>
tmat4x2<T, P> operator/ (
GLM_FUNC_DECL tmat4x2<T, P> operator/ (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x2<T, P> operator/ (
typename tmat4x2<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x2<T, P> operator/ (
T const & s,
tmat4x2<T, P> const & m);
// Unary constant operators
template <typename T, precision P>
tmat4x2<T, P> const operator-(
GLM_FUNC_DECL tmat4x2<T, P> const operator-(
tmat4x2<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::size_type tmat4x2<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::size_type tmat4x2<T, P>::col_size()
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::size_type tmat4x2<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2<T, P>::length() const
{
return 4;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type &
tmat4x2<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const &
tmat4x2<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -87,10 +75,8 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
tmat4x2<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(
tmat4x2<T, P> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
@ -99,16 +85,24 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
ctor
)
template <precision Q>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(
tmat4x2<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
this->value[3] = m.value[3];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(ctor)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
value_type const & s
T const & s
)
{
value_type const Zero(0);
@ -121,10 +115,10 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2,
value_type const & x3, value_type const & y3
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2,
T const & x3, T const & y3
)
{
this->value[0] = col_type(x0, y0);
@ -149,16 +143,16 @@ namespace detail
}
//////////////////////////////////////
// Convertion constructors
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat4x2<T, P>::tmat4x2
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T, P>(value_type(s), Zero);
this->value[0] = tvec2<T, P>(static_cast<T>(s), Zero);
this->value[1] = tvec2<T, P>(Zero, value_type(s));
this->value[2] = tvec2<T, P>(Zero, Zero);
this->value[3] = tvec2<T, P>(Zero, Zero);
@ -170,7 +164,7 @@ namespace detail
typename X2, typename Y2,
typename X3, typename Y3,
typename X4, typename Y4>
GLM_FUNC_DECL tmat4x2<T, P>::tmat4x2
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
@ -178,15 +172,15 @@ namespace detail
X4 const & x4, Y4 const & y4
)
{
this->value[0] = col_type(value_type(x1), value_type(y1));
this->value[1] = col_type(value_type(x2), value_type(y2));
this->value[2] = col_type(value_type(x3), value_type(y3));
this->value[3] = col_type(value_type(x4), value_type(y4));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2));
this->value[2] = col_type(static_cast<T>(x3), value_type(y3));
this->value[3] = col_type(static_cast<T>(x4), value_type(y4));
}
template <typename T, precision P>
template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL tmat4x2<T, P>::tmat4x2
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
tvec2<V1, P> const & v1,
tvec2<V2, P> const & v2,
@ -200,6 +194,34 @@ namespace detail
this->value[3] = col_type(v4);
}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec2<T, P>(*(p + 0), *(p + 1));
this->value[1] = tvec2<T, P>(*(p + 2), *(p + 3));
this->value[2] = tvec2<T, P>(*(p + 4), *(p + 5));
this->value[3] = tvec2<T, P>(*(p + 6), *(p + 7));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(std::initializer_list<tvec2<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
this->value[3] = l.begin()[3];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion
template <typename T, precision P>
template <typename U, precision Q>
@ -222,8 +244,8 @@ namespace detail
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0));
this->value[2] = col_type(static_cast<T>(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -235,7 +257,7 @@ namespace detail
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -258,8 +280,8 @@ namespace detail
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0));
this->value[2] = col_type(static_cast<T>(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -271,7 +293,7 @@ namespace detail
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -282,8 +304,8 @@ namespace detail
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0));
this->value[2] = col_type(static_cast<T>(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -307,7 +329,7 @@ namespace detail
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
//////////////////////////////////////////////////////////////
@ -342,10 +364,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -356,10 +375,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+=
(
tmat4x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+= (tmat4x2<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -370,10 +386,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -384,10 +397,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-=
(
tmat4x2<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-= (tmat4x2<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -398,10 +408,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -412,20 +419,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator*=
(
tmat4x2<U, P> const & m
)
{
return (*this = tmat4x2<T, P>(*this * m));
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -477,7 +471,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -505,7 +499,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -533,7 +527,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -546,7 +540,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
(
typename tmat4x2<T, P>::value_type const & s,
T const & s,
tmat4x2<T, P> const & m
)
{
@ -654,7 +648,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::value_type const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -667,7 +661,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/
(
typename tmat4x2<T, P>::value_type const & s,
T const & s,
tmat4x2<T, P> const & m
)
{

View File

@ -30,7 +30,10 @@
#define glm_core_type_mat4x3
#include "../fwd.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include "type_mat.hpp"
#include <limits>
namespace glm{
namespace detail
@ -46,10 +49,7 @@ namespace detail
typedef tmat4x3<T, P> type;
typedef tmat3x4<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
private:
// Data
@ -58,23 +58,32 @@ namespace detail
public:
// Constructors
GLM_FUNC_DECL tmat4x3();
GLM_FUNC_DECL tmat4x3(tmat4x3 const & m);
GLM_FUNC_DECL tmat4x3(tmat4x3<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x3(tmat4x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x3(
ctor Null);
GLM_FUNC_DECL explicit tmat4x3(
value_type const & x);
T const & x);
GLM_FUNC_DECL explicit tmat4x3(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1,
value_type const & x2, value_type const & y2, value_type const & z2,
value_type const & x3, value_type const & y3, value_type const & z3);
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2,
T const & x3, T const & y3, T const & z3);
GLM_FUNC_DECL explicit tmat4x3(
col_type const & v0,
col_type const & v1,
col_type const & v2,
col_type const & v3);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat4x3(std::initializer_list<U> m);
GLM_FUNC_DECL tmat4x3(std::initializer_list<tvec3<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
@ -113,27 +122,25 @@ namespace detail
GLM_FUNC_DECL explicit tmat4x3(tmat3x4<T, P> const & x);
// Accesses
col_type & operator[](size_type i);
col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat4x3<T, P> & operator= (tmat4x3<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator= (tmat4x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator+= (U const & s);
GLM_FUNC_DECL tmat4x3<T, P> & operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator+= (tmat4x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator-= (U const & s);
GLM_FUNC_DECL tmat4x3<T, P> & operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator-= (tmat4x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator*= (U const & s);
GLM_FUNC_DECL tmat4x3<T, P> & operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator*= (tmat4x3<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P> & operator/= (U const & s);
GLM_FUNC_DECL tmat4x3<T, P> & operator/= (U s);
//////////////////////////////////////
// Increment and decrement operators
@ -146,73 +153,73 @@ namespace detail
// Binary operators
template <typename T, precision P>
tmat4x3<T, P> operator+ (
GLM_FUNC_DECL tmat4x3<T, P> operator+ (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x3<T, P> operator+ (
GLM_FUNC_DECL tmat4x3<T, P> operator+ (
tmat4x3<T, P> const & m1,
tmat4x3<T, P> const & m2);
template <typename T, precision P>
tmat4x3<T, P> operator- (
GLM_FUNC_DECL tmat4x3<T, P> operator- (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x3<T, P> operator- (
GLM_FUNC_DECL tmat4x3<T, P> operator- (
tmat4x3<T, P> const & m1,
tmat4x3<T, P> const & m2);
template <typename T, precision P>
tmat4x3<T, P> operator* (
GLM_FUNC_DECL tmat4x3<T, P> operator* (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x3<T, P> operator* (
typename tmat4x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x3<T, P> operator* (
T const & s,
tmat4x3<T, P> const & m);
template <typename T, precision P>
typename tmat4x3<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat4x3<T, P>::col_type operator* (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat4x3<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat4x3<T, P>::row_type operator* (
typename tmat4x3<T, P>::col_type const & v,
tmat4x3<T, P> const & m);
template <typename T, precision P>
tmat2x3<T, P> operator* (
GLM_FUNC_DECL tmat2x3<T, P> operator* (
tmat4x3<T, P> const & m1,
tmat2x4<T, P> const & m2);
template <typename T, precision P>
tmat3x3<T, P> operator* (
GLM_FUNC_DECL tmat3x3<T, P> operator* (
tmat4x3<T, P> const & m1,
tmat3x4<T, P> const & m2);
template <typename T, precision P>
tmat4x3<T, P> operator* (
GLM_FUNC_DECL tmat4x3<T, P> operator* (
tmat4x3<T, P> const & m1,
tmat4x4<T, P> const & m2);
template <typename T, precision P>
tmat4x3<T, P> operator/ (
GLM_FUNC_DECL tmat4x3<T, P> operator/ (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x3<T, P> operator/ (
typename tmat4x3<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x3<T, P> operator/ (
T const & s,
tmat4x3<T, P> const & m);
// Unary constant operators
template <typename T, precision P>
tmat4x3<T, P> const operator- (
GLM_FUNC_DECL tmat4x3<T, P> const operator- (
tmat4x3<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::size_type tmat4x3<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::size_type tmat4x3<T, P>::col_size()
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::size_type tmat4x3<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3<T, P>::length() const
{
return 4;
}
@ -87,10 +75,8 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
tmat4x3<T, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
tmat4x3<T, P> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
@ -99,17 +85,23 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
ctor
)
template <precision Q>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
tmat4x3<T, Q> const & m)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
this->value[3] = m.value[3];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(ctor)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
value_type const & s
)
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
T const & s)
{
value_type const Zero(0);
this->value[0] = col_type(s, Zero, Zero);
@ -121,10 +113,10 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1,
value_type const & x2, value_type const & y2, value_type const & z2,
value_type const & x3, value_type const & y3, value_type const & z3
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2,
T const & x3, T const & y3, T const & z3
)
{
this->value[0] = col_type(x0, y0, z0);
@ -148,17 +140,44 @@ namespace detail
this->value[3] = v3;
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat4x3<T, P>::tmat4x3
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec3<T, P>(*(p + 0), *(p + 1), *(p + 2));
this->value[1] = tvec3<T, P>(*(p + 3), *(p + 4), *(p + 5));
this->value[2] = tvec3<T, P>(*(p + 6), *(p + 7), *(p + 8));
this->value[3] = tvec3<T, P>(*(p + 9), *(p + 10), *(p + 11));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(std::initializer_list<tvec3<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
this->value[3] = l.begin()[3];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T, P>(value_type(s), Zero, Zero);
this->value[0] = tvec3<T, P>(static_cast<T>(s), Zero, Zero);
this->value[1] = tvec3<T, P>(Zero, value_type(s), Zero);
this->value[2] = tvec3<T, P>(Zero, Zero, value_type(s));
this->value[3] = tvec3<T, P>(Zero, Zero, Zero);
@ -170,7 +189,7 @@ namespace detail
typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3,
typename X4, typename Y4, typename Z4>
GLM_FUNC_DECL tmat4x3<T, P>::tmat4x3
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2,
@ -178,15 +197,15 @@ namespace detail
X4 const & x4, Y4 const & y4, Z4 const & z4
)
{
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2));
this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3));
this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2));
this->value[2] = col_type(static_cast<T>(x3), value_type(y3), value_type(z3));
this->value[3] = col_type(static_cast<T>(x4), value_type(y4), value_type(z4));
}
template <typename T, precision P>
template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL tmat4x3<T, P>::tmat4x3
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
tvec3<V1, P> const & v1,
tvec3<V2, P> const & v2,
@ -225,7 +244,7 @@ namespace detail
this->value[0] = col_type(m[0], value_type(0));
this->value[1] = col_type(m[1], value_type(0));
this->value[2] = col_type(m[2], value_type(1));
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -237,7 +256,7 @@ namespace detail
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -260,8 +279,8 @@ namespace detail
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0), value_type(0), value_type(1));
this->value[3] = col_type(value_type(0));
this->value[2] = col_type(static_cast<T>(0), value_type(0), value_type(1));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -273,7 +292,7 @@ namespace detail
this->value[0] = col_type(m[0], value_type(0));
this->value[1] = col_type(m[1], value_type(0));
this->value[2] = col_type(m[2], value_type(1));
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -284,8 +303,8 @@ namespace detail
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(value_type(0), value_type(0), value_type(1));
this->value[3] = col_type(value_type(0));
this->value[2] = col_type(static_cast<T>(0), value_type(0), value_type(1));
this->value[3] = col_type(static_cast<T>(0));
}
template <typename T, precision P>
@ -309,7 +328,7 @@ namespace detail
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
this->value[3] = col_type(value_type(0));
this->value[3] = col_type(static_cast<T>(0));
}
//////////////////////////////////////////////////////////////
@ -344,10 +363,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -358,10 +374,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+=
(
tmat4x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+= (tmat4x3<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -372,10 +385,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -386,10 +396,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-=
(
tmat4x3<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-= (tmat4x3<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -400,10 +407,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -414,20 +418,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator*=
(
tmat4x3<U, P> const & m
)
{
return (*this = tmat4x3<T, P>(*this * m));
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -462,7 +453,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+ (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s)
T const & s)
{
return tmat4x3<T, P>(
m[0] + s,
@ -486,7 +477,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator- (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s)
T const & s)
{
return tmat4x3<T, P>(
m[0] - s,
@ -510,7 +501,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator* (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s)
T const & s)
{
return tmat4x3<T, P>(
m[0] * s,
@ -521,7 +512,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator* (
typename tmat4x3<T, P>::value_type const & s,
T const & s,
tmat4x3<T, P> const & m)
{
return tmat4x3<T, P>(
@ -644,7 +635,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/
(
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::value_type const & s
T const & s
)
{
return tmat4x3<T, P>(
@ -657,7 +648,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/
(
typename tmat4x3<T, P>::value_type const & s,
T const & s,
tmat4x3<T, P> const & m
)
{

View File

@ -30,7 +30,13 @@
#define glm_core_type_mat4x4
#include "../fwd.hpp"
#include "type_vec4.hpp"
#include "type_mat.hpp"
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <limits>
#include <cstddef>
namespace glm{
namespace detail
@ -46,41 +52,51 @@ namespace detail
typedef tmat4x4<T, P> type;
typedef tmat4x4<T, P> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
public:
/// Implementation detail
/// @cond DETAIL
GLM_FUNC_DECL tmat4x4<T, P> _inverse() const;
/// @endcond
template <typename U, precision Q>
friend tmat4x4<U, Q> inverse(tmat4x4<U, Q> const & m);
template <typename U, precision Q>
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
template <typename U, precision Q>
friend tvec4<U, Q> operator/(tvec4<U, Q> const & v, tmat4x4<U, Q> const & m);
private:
// Data
/// @cond DETAIL
col_type value[4];
GLM_FUNC_DECL tmat4x4<T, P> _inverse() const;
/// @endcond
public:
// Constructors
GLM_FUNC_DECL tmat4x4();
GLM_FUNC_DECL tmat4x4(tmat4x4 const & m);
GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m);
template <precision Q>
GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x4(
ctor Null);
GLM_FUNC_DECL explicit tmat4x4(
value_type const & x);
T const & x);
GLM_FUNC_DECL explicit tmat4x4(
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2,
value_type const & x3, value_type const & y3, value_type const & z3, value_type const & w3);
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2,
T const & x3, T const & y3, T const & z3, T const & w3);
GLM_FUNC_DECL explicit tmat4x4(
col_type const & v0,
col_type const & v1,
col_type const & v2,
col_type const & v3);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tmat4x4(std::initializer_list<U> m);
GLM_FUNC_DECL tmat4x4(std::initializer_list<tvec4<T, P> > m);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversions
template <typename U>
@ -119,27 +135,27 @@ namespace detail
GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
// Accesses
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
GLM_FUNC_DECL col_type & operator[](length_t i);
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
// Unary updatable operators
GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator+= (U const & s);
GLM_FUNC_DECL tmat4x4<T, P> & operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator+= (tmat4x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator-= (U const & s);
GLM_FUNC_DECL tmat4x4<T, P> & operator-= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator-= (tmat4x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator*= (U const & s);
GLM_FUNC_DECL tmat4x4<T, P> & operator*= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator*= (tmat4x4<U, P> const & m);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator/= (U const & s);
GLM_FUNC_DECL tmat4x4<T, P> & operator/= (U s);
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P> & operator/= (tmat4x4<U, P> const & m);
@ -154,98 +170,98 @@ namespace detail
// Binary operators
template <typename T, precision P>
tmat4x4<T, P> operator+ (
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x4<T, P> operator+ (
typename tmat4x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
tmat4x4<T, P> operator+ (
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
tmat4x4<T, P> const & m1,
tmat4x4<T, P> const & m2);
template <typename T, precision P>
tmat4x4<T, P> operator- (
GLM_FUNC_DECL tmat4x4<T, P> operator- (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x4<T, P> operator- (
typename tmat4x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x4<T, P> operator- (
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
tmat4x4<T, P> operator- (
GLM_FUNC_DECL tmat4x4<T, P> operator- (
tmat4x4<T, P> const & m1,
tmat4x4<T, P> const & m2);
template <typename T, precision P>
tmat4x4<T, P> operator* (
GLM_FUNC_DECL tmat4x4<T, P> operator* (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x4<T, P> operator* (
typename tmat4x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x4<T, P> operator* (
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
typename tmat4x4<T, P>::col_type operator* (
GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator* (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat4x4<T, P>::row_type operator* (
GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator* (
typename tmat4x4<T, P>::col_type const & v,
tmat4x4<T, P> const & m);
template <typename T, precision P>
tmat2x4<T, P> operator* (
GLM_FUNC_DECL tmat2x4<T, P> operator* (
tmat4x4<T, P> const & m1,
tmat2x4<T, P> const & m2);
template <typename T, precision P>
tmat3x4<T, P> operator* (
GLM_FUNC_DECL tmat3x4<T, P> operator* (
tmat4x4<T, P> const & m1,
tmat3x4<T, P> const & m2);
template <typename T, precision P>
tmat4x4<T, P> operator* (
GLM_FUNC_DECL tmat4x4<T, P> operator* (
tmat4x4<T, P> const & m1,
tmat4x4<T, P> const & m2);
template <typename T, precision P>
tmat4x4<T, P> operator/ (
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s);
T const & s);
template <typename T, precision P>
tmat4x4<T, P> operator/ (
typename tmat4x4<T, P>::value_type const & s,
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
typename tmat4x4<T, P>::col_type operator/ (
GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator/ (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::row_type const & v);
template <typename T, precision P>
typename tmat4x4<T, P>::row_type operator/ (
GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator/ (
typename tmat4x4<T, P>::col_type & v,
tmat4x4<T, P> const & m);
template <typename T, precision P>
tmat4x4<T, P> operator/ (
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
tmat4x4<T, P> const & m1,
tmat4x4<T, P> const & m2);
// Unary constant operators
template <typename T, precision P>
tmat4x4<T, P> const operator- (
GLM_FUNC_DECL tmat4x4<T, P> const operator- (
tmat4x4<T, P> const & m);
}//namespace detail

View File

@ -30,19 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::size_type tmat4x4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::size_type tmat4x4<T, P>::col_size()
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::size_type tmat4x4<T, P>::row_size()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4<T, P>::length() const
{
return 4;
}
@ -54,7 +42,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type &
tmat4x4<T, P>::operator[]
(
size_type i
length_t i
)
{
assert(i < this->length());
@ -65,7 +53,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const &
tmat4x4<T, P>::operator[]
(
size_type i
length_t i
) const
{
assert(i < this->length());
@ -98,6 +86,19 @@ namespace detail
this->value[3] = m.value[3];
}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
tmat4x4<T, Q> const & m
)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
this->value[3] = m.value[3];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
@ -108,7 +109,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
value_type const & s
T const & s
)
{
value_type const Zero(0);
@ -121,10 +122,10 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2,
value_type const & x3, value_type const & y3, value_type const & z3, value_type const & w3
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2,
T const & x3, T const & y3, T const & z3, T const & w3
)
{
this->value[0] = col_type(x0, y0, z0, w0);
@ -161,19 +162,46 @@ namespace detail
this->value[3] = col_type(m[3]);
}
//////////////////////////////////////
// Convertion constructors
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_DECL tmat4x4<T, P>::tmat4x4
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<U> l)
{
assert(l.size() == this->length() * this->value[0].length());
typename std::initializer_list<U>::iterator p = l.begin();
this->value[0] = tvec4<T, P>(*(p + 0), *(p + 1), *(p + 2), *(p + 3));
this->value[1] = tvec4<T, P>(*(p + 4), *(p + 5), *(p + 6), *(p + 7));
this->value[2] = tvec4<T, P>(*(p + 8), *(p + 9), *(p + 10), *(p + 11));
this->value[3] = tvec4<T, P>(*(p + 12), *(p + 13), *(p + 14), *(p + 15));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(std::initializer_list<tvec4<T, P> > l)
{
assert(l.size() == this->length());
this->value[0] = l.begin()[0];
this->value[1] = l.begin()[1];
this->value[2] = l.begin()[2];
this->value[3] = l.begin()[3];
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
U const & s
)
{
GLM_STATIC_ASSERT(detail::type<U>::is_float || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
value_type const Zero(0);
this->value[0] = tvec4<T, P>(value_type(s), Zero, Zero, Zero);
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
this->value[1] = tvec4<T, P>(Zero, value_type(s), Zero, Zero);
this->value[2] = tvec4<T, P>(Zero, Zero, value_type(s), Zero);
this->value[3] = tvec4<T, P>(Zero, Zero, Zero, value_type(s));
@ -185,7 +213,7 @@ namespace detail
typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3,
typename X4, typename Y4, typename Z4, typename W4>
GLM_FUNC_DECL tmat4x4<T, P>::tmat4x4
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
@ -193,35 +221,35 @@ namespace detail
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4
)
{
GLM_STATIC_ASSERT(detail::type<X1>::is_float || std::numeric_limits<X1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Y1>::is_float || std::numeric_limits<Y1>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Z1>::is_float || std::numeric_limits<Z1>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<W1>::is_float || std::numeric_limits<W1>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<X1>::is_iec559 || std::numeric_limits<X1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Y1>::is_iec559 || std::numeric_limits<Y1>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Z1>::is_iec559 || std::numeric_limits<Z1>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<W1>::is_iec559 || std::numeric_limits<W1>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<X2>::is_float || std::numeric_limits<X2>::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Y2>::is_float || std::numeric_limits<Y2>::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Z2>::is_float || std::numeric_limits<Z2>::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<W2>::is_float || std::numeric_limits<W2>::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<X2>::is_iec559 || std::numeric_limits<X2>::is_integer, "*mat4x4 constructor only takes float and integer types, 5th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Y2>::is_iec559 || std::numeric_limits<Y2>::is_integer, "*mat4x4 constructor only takes float and integer types, 6th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Z2>::is_iec559 || std::numeric_limits<Z2>::is_integer, "*mat4x4 constructor only takes float and integer types, 7th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<W2>::is_iec559 || std::numeric_limits<W2>::is_integer, "*mat4x4 constructor only takes float and integer types, 8th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<X3>::is_float || std::numeric_limits<X3>::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Y3>::is_float || std::numeric_limits<Y3>::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Z3>::is_float || std::numeric_limits<Z3>::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<W3>::is_float || std::numeric_limits<W3>::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<X3>::is_iec559 || std::numeric_limits<X3>::is_integer, "*mat4x4 constructor only takes float and integer types, 9th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Y3>::is_iec559 || std::numeric_limits<Y3>::is_integer, "*mat4x4 constructor only takes float and integer types, 10th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Z3>::is_iec559 || std::numeric_limits<Z3>::is_integer, "*mat4x4 constructor only takes float and integer types, 11th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<W3>::is_iec559 || std::numeric_limits<W3>::is_integer, "*mat4x4 constructor only takes float and integer types, 12th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<X4>::is_float || std::numeric_limits<X4>::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Y4>::is_float || std::numeric_limits<Y4>::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<Z4>::is_float || std::numeric_limits<Z4>::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<W4>::is_float || std::numeric_limits<W4>::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<X4>::is_iec559 || std::numeric_limits<X4>::is_integer, "*mat4x4 constructor only takes float and integer types, 13th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Y4>::is_iec559 || std::numeric_limits<Y4>::is_integer, "*mat4x4 constructor only takes float and integer types, 14th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<Z4>::is_iec559 || std::numeric_limits<Z4>::is_integer, "*mat4x4 constructor only takes float and integer types, 15th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<W4>::is_iec559 || std::numeric_limits<W4>::is_integer, "*mat4x4 constructor only takes float and integer types, 16th parameter type invalid.");
this->value[0] = col_type(value_type(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(value_type(x2), value_type(y2), value_type(z2), value_type(w2));
this->value[2] = col_type(value_type(x3), value_type(y3), value_type(z3), value_type(w3));
this->value[3] = col_type(value_type(x4), value_type(y4), value_type(z4), value_type(w4));
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1), value_type(w1));
this->value[1] = col_type(static_cast<T>(x2), value_type(y2), value_type(z2), value_type(w2));
this->value[2] = col_type(static_cast<T>(x3), value_type(y3), value_type(z3), value_type(w3));
this->value[3] = col_type(static_cast<T>(x4), value_type(y4), value_type(z4), value_type(w4));
}
template <typename T, precision P>
template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL tmat4x4<T, P>::tmat4x4
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
tvec4<V1, P> const & v1,
tvec4<V2, P> const & v2,
@ -229,10 +257,10 @@ namespace detail
tvec4<V4, P> const & v4
)
{
GLM_STATIC_ASSERT(detail::type<V1>::is_float || std::numeric_limits<V1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<V2>::is_float || std::numeric_limits<V2>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<V3>::is_float || std::numeric_limits<V3>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
GLM_STATIC_ASSERT(detail::type<V4>::is_float || std::numeric_limits<V4>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<V1>::is_iec559 || std::numeric_limits<V1>::is_integer, "*mat4x4 constructor only takes float and integer types, 1st parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<V2>::is_iec559 || std::numeric_limits<V2>::is_integer, "*mat4x4 constructor only takes float and integer types, 2nd parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<V3>::is_iec559 || std::numeric_limits<V3>::is_integer, "*mat4x4 constructor only takes float and integer types, 3rd parameter type invalid.");
GLM_STATIC_ASSERT(std::numeric_limits<V4>::is_iec559 || std::numeric_limits<V4>::is_integer, "*mat4x4 constructor only takes float and integer types, 4th parameter type invalid.");
this->value[0] = col_type(v1);
this->value[1] = col_type(v2);
@ -250,8 +278,8 @@ namespace detail
{
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
this->value[2] = col_type(static_cast<T>(0));
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
}
template <typename T, precision P>
@ -263,7 +291,7 @@ namespace detail
this->value[0] = col_type(m[0], value_type(0));
this->value[1] = col_type(m[1], value_type(0));
this->value[2] = col_type(m[2], value_type(0));
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
}
template <typename T, precision P>
@ -274,8 +302,8 @@ namespace detail
{
this->value[0] = col_type(m[0], value_type(0));
this->value[1] = col_type(m[1], value_type(0));
this->value[2] = col_type(value_type(0));
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
this->value[2] = col_type(static_cast<T>(0));
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
}
template <typename T, precision P>
@ -287,7 +315,7 @@ namespace detail
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
this->value[2] = col_type(m[2], detail::tvec2<T, P>(0));
this->value[3] = col_type(value_type(0), value_type(0), value_type(0), value_type(1));
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
}
template <typename T, precision P>
@ -374,10 +402,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+= (U s)
{
this->value[0] += s;
this->value[1] += s;
@ -388,10 +413,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+=
(
tmat4x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+= (tmat4x4<U, P> const & m)
{
this->value[0] += m[0];
this->value[1] += m[1];
@ -402,10 +424,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-= (U s)
{
this->value[0] -= s;
this->value[1] -= s;
@ -416,10 +435,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-=
(
tmat4x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-= (tmat4x4<U, P> const & m)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
@ -430,10 +446,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*= (U s)
{
this->value[0] *= s;
this->value[1] *= s;
@ -444,20 +457,14 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*=
(
tmat4x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*= (tmat4x4<U, P> const & m)
{
return (*this = *this * m);
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/= (U s)
{
this->value[0] /= s;
this->value[1] /= s;
@ -468,12 +475,9 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/=
(
tmat4x4<U, P> const & m
)
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/= (tmat4x4<U, P> const & m)
{
return (*this = *this / m);
return (*this = *this * m._inverse());
}
template <typename T, precision P>
@ -578,7 +582,7 @@ namespace detail
- this->value[0][0] * SubFactor14 + this->value[0][1] * SubFactor16 - this->value[0][3] * SubFactor18,
+ this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18);
T Determinant = T(
T Determinant = static_cast<T>(
+ this->value[0][0] * Inverse[0][0]
+ this->value[0][1] * Inverse[1][0]
+ this->value[0][2] * Inverse[2][0]
@ -593,7 +597,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -606,7 +610,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
(
typename tmat4x4<T, P>::value_type const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -635,7 +639,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -648,7 +652,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
(
typename tmat4x4<T, P>::value_type const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -677,7 +681,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -690,7 +694,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
(
typename tmat4x4<T, P>::value_type const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -731,13 +735,13 @@ namespace detail
typename tmat4x4<T, P>::col_type const Mov1(v[1]);
typename tmat4x4<T, P>::col_type const Mul0 = m[0] * Mov0;
typename tmat4x4<T, P>::col_type const Mul1 = m[1] * Mov1;
typename tmat4x4<T, P>::col_type const Add0 = Mul0 * Mul1;
typename tmat4x4<T, P>::col_type const Add0 = Mul0 + Mul1;
typename tmat4x4<T, P>::col_type const Mov2(v[2]);
typename tmat4x4<T, P>::col_type const Mov3(v[3]);
typename tmat4x4<T, P>::col_type const Mul2 = m[2] * Mov2;
typename tmat4x4<T, P>::col_type const Mul3 = m[3] * Mov3;
typename tmat4x4<T, P>::col_type const Add1 = Mul2 * Mul3;
typename tmat4x4<T, P>::col_type const Add2 = Add0 * Add1;
typename tmat4x4<T, P>::col_type const Add1 = Mul2 + Mul3;
typename tmat4x4<T, P>::col_type const Add2 = Add0 + Add1;
return Add2;
/*
@ -832,7 +836,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -845,7 +849,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
(
typename tmat4x4<T, P>::value_type const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -883,7 +887,8 @@ namespace detail
tmat4x4<T, P> const & m2
)
{
return m1 * m2._inverse();
tmat4x4<T, P> m1_copy(m1);
return m1_copy /= m2;
}
// Unary constant operators

View File

@ -30,6 +30,7 @@
#define glm_core_type_vec
#include "precision.hpp"
#include "type_int.hpp"
namespace glm{
namespace detail

View File

@ -31,7 +31,17 @@
#include "../fwd.hpp"
#include "type_vec.hpp"
#include "_swizzle.hpp"
#ifdef GLM_SWIZZLE
# if GLM_HAS_ANONYMOUS_UNION
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
# endif
#endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef>
namespace glm{
namespace detail
@ -39,35 +49,43 @@ namespace detail
template <typename T, precision P>
struct tvec1
{
//////////////////////////////////////
// Implementation detail
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec1<T, P> type;
typedef tvec1<bool, P> bool_type;
typedef T value_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
//////////////////////////////////////
// Helper
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
//////////////////////////////////////
// Data
# if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
value_type x;
# else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
union {value_type x, r, s;};
# endif//GLM_COMPONENT
union {T x, r, s;};
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL value_type const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
//////////////////////////////////////
// Implicit basic constructors
GLM_FUNC_DECL tvec1();
GLM_FUNC_DECL tvec1(tvec1<T, P> const & v);
template <precision Q>
GLM_FUNC_DECL tvec1(tvec1<T, Q> const & v);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec1(std::initializer_list<U> const & v);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
@ -75,22 +93,22 @@ namespace detail
GLM_FUNC_DECL explicit tvec1(
ctor);
GLM_FUNC_DECL explicit tvec1(
value_type const & s);
T const & s);
//////////////////////////////////////
// Swizzle constructors
GLM_FUNC_DECL tvec1(tref1<T, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
// Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec1(U const & s);
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
@ -164,27 +182,6 @@ namespace detail
GLM_FUNC_DECL tvec1<T, P> & operator>>=(U const & s);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator>>=(tvec1<U, P> const & v);
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;
GLM_FUNC_DECL tref1<T, P> swizzle(comp X);
};
template <typename T, precision P>
struct tref1
{
GLM_FUNC_DECL tref1(T & x);
GLM_FUNC_DECL tref1(tref1<T, P> const & r);
GLM_FUNC_DECL tref1(tvec1<T, P> const & v);
GLM_FUNC_DECL tref1<T, P> & operator= (tref1<T, P> const & r);
GLM_FUNC_DECL tref1<T, P> & operator= (tvec1<T, P> const & v);
T& x;
};
GLM_DETAIL_IS_VECTOR(tvec1);

View File

@ -30,7 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::size_type tvec1<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1<T, P>::length() const
{
return 1;
}
@ -39,22 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec1<T, P>::value_type & tvec1<T, P>::operator[]
(
size_type i
)
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](length_t i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec1<T, P>::value_type const & tvec1<T, P>::operator[]
(
size_type i
) const
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](length_t i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -63,48 +57,44 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1() :
x(value_type(0))
x(static_cast<T>(0))
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
(
ctor
)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
(
tvec1<T, P> const & v
) :
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec1<T, P> const & v) :
x(v.x)
{}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec1<T, Q> const & v) :
x(v.x)
{}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(std::initializer_list<U> const & v) :
x(static_cast<T>(v.begin()[0]))
{
assert(v.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
(
value_type const & s
) :
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(ctor)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(T const & s) :
x(s)
{}
//////////////////////////////////////
// Swizzle constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
(
tref1<T, P> const & r
) :
x(r.x)
{}
//////////////////////////////////////
// Convertion scalar constructors
// Conversion scalar constructors
template <typename T, precision P>
template <typename U>
@ -112,11 +102,11 @@ namespace detail
(
U const & s
) :
x(value_type(s))
x(static_cast<T>(s))
{}
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
template <typename T, precision P>
template <typename U, precision Q>
@ -124,7 +114,7 @@ namespace detail
(
tvec1<U, Q> const & v
) :
x(value_type(v.x))
x(static_cast<T>(v.x))
{}
template <typename T, precision P>
@ -133,7 +123,7 @@ namespace detail
(
tvec2<U, Q> const & v
) :
x(value_type(v.x))
x(static_cast<T>(v.x))
{}
template <typename T, precision P>
@ -142,7 +132,7 @@ namespace detail
(
tvec3<U, Q> const & v
) :
x(value_type(v.x))
x(static_cast<T>(v.x))
{}
template <typename T, precision P>
@ -151,7 +141,7 @@ namespace detail
(
tvec4<U, Q> const & v
) :
x(value_type(v.x))
x(static_cast<T>(v.x))
{}
//////////////////////////////////////
@ -174,7 +164,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x = T(v.x);
this->x = static_cast<T>(v.x);
return *this;
}
@ -185,7 +175,7 @@ namespace detail
U const & s
)
{
this->x += T(s);
this->x += static_cast<T>(s);
return *this;
}
@ -196,7 +186,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x += T(v.x);
this->x += static_cast<T>(v.x);
return *this;
}
@ -207,7 +197,7 @@ namespace detail
U const & s
)
{
this->x -= T(s);
this->x -= static_cast<T>(s);
return *this;
}
@ -218,7 +208,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x -= T(v.x);
this->x -= static_cast<T>(v.x);
return *this;
}
@ -229,7 +219,7 @@ namespace detail
U const & s
)
{
this->x *= T(s);
this->x *= static_cast<T>(s);
return *this;
}
@ -240,7 +230,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x *= T(v.x);
this->x *= static_cast<T>(v.x);
return *this;
}
@ -251,7 +241,7 @@ namespace detail
U const & s
)
{
this->x /= T(s);
this->x /= static_cast<T>(s);
return *this;
}
@ -262,7 +252,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x /= T(v.x);
this->x /= static_cast<T>(v.x);
return *this;
}
@ -332,7 +322,7 @@ namespace detail
U const & s
)
{
this->x %= T(s);
this->x %= static_cast<T>(s);
return *this;
}
@ -343,7 +333,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x %= T(v.x);
this->x %= static_cast<T>(v.x);
return *this;
}
@ -354,7 +344,7 @@ namespace detail
U const & s
)
{
this->x &= T(s);
this->x &= static_cast<T>(s);
return *this;
}
@ -365,7 +355,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x &= T(v.x);
this->x &= static_cast<T>(v.x);
return *this;
}
@ -376,7 +366,7 @@ namespace detail
U const & s
)
{
this->x |= T(s);
this->x |= static_cast<T>(s);
return *this;
}
@ -398,7 +388,7 @@ namespace detail
U const & s
)
{
this->x ^= T(s);
this->x ^= static_cast<T>(s);
return *this;
}
@ -409,7 +399,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x ^= T(v.x);
this->x ^= static_cast<T>(v.x);
return *this;
}
@ -420,7 +410,7 @@ namespace detail
U const & s
)
{
this->x <<= T(s);
this->x <<= static_cast<T>(s);
return *this;
}
@ -431,7 +421,7 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x <<= T(v.x);
this->x <<= static_cast<T>(v.x);
return *this;
}
@ -442,7 +432,7 @@ namespace detail
U const & s
)
{
this->x >>= T(s);
this->x >>= static_cast<T>(s);
return *this;
}
@ -453,71 +443,10 @@ namespace detail
tvec1<U, P> const & v
)
{
this->x >>= T(v.x);
this->x >>= static_cast<T>(v.x);
return *this;
}
//////////////////////////////////////
// Swizzle operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER T tvec1<T, P>::swizzle(comp x) const
{
return (*this)[x];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec1<T, P>::swizzle
(
comp x,
comp y
) const
{
return tvec2<T, P>(
(*this)[x],
(*this)[y]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tvec1<T, P>::swizzle
(
comp x,
comp y,
comp z
) const
{
return tvec3<T, P>(
(*this)[x],
(*this)[y],
(*this)[z]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> tvec1<T, P>::swizzle
(
comp x,
comp y,
comp z,
comp w
) const
{
return tvec4<T, P>(
(*this)[x],
(*this)[y],
(*this)[z],
(*this)[w]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref1<T, P> tvec1<T, P>::swizzle
(
comp x
)
{
return tref1<T, P>(
(*this)[x]);
}
//////////////////////////////////////
// Binary arithmetic operators
@ -525,7 +454,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator+
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -535,7 +464,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator+
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -559,7 +488,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator-
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -569,7 +498,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator-
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -593,7 +522,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator*
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -603,7 +532,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator*
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -627,7 +556,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator/
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -637,7 +566,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator/
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -696,7 +625,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator%
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -706,7 +635,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator%
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -729,7 +658,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator&
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -739,7 +668,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator&
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -762,7 +691,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator|
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -772,7 +701,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator|
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -795,7 +724,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator^
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -805,7 +734,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator^
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -828,7 +757,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -838,7 +767,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -861,7 +790,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>
(
tvec1<T, P> const & v,
typename tvec1<T, P>::value_type const & s
typename tvec1<T, P>::T const & s
)
{
return tvec1<T, P>(
@ -871,7 +800,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>
(
typename tvec1<T, P>::value_type const & s,
typename tvec1<T, P>::T const & s,
tvec1<T, P> const & v
)
{
@ -900,52 +829,5 @@ namespace detail
~v.x);
}
//////////////////////////////////////
// tref definition
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref1<T, P>::tref1
(
T & x
) :
x(x)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref1<T, P>::tref1
(
tref1<T, P> const & r
) :
x(r.x)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref1<T, P>::tref1
(
tvec1<T, P> const & v
) :
x(v.x)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref1<T, P> & tref1<T, P>::operator=
(
tref1<T, P> const & r
)
{
x = r.x;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref1<T, P> & tref1<T, P>::operator=
(
tvec1<T, P> const & v
)
{
x = v.x;
return *this;
}
}//namespace detail
}//namespace glm

View File

@ -22,16 +22,26 @@
///
/// @ref core
/// @file glm/core/type_vec2.hpp
/// @date 2008-08-18 / 2011-06-15
/// @date 2008-08-18 / 2013-08-27
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_gentype2
#define glm_core_type_gentype2
#include "../fwd.hpp"
//#include "../fwd.hpp"
#include "type_vec.hpp"
#include "_swizzle.hpp"
#ifdef GLM_SWIZZLE
# if GLM_HAS_ANONYMOUS_UNION
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
# endif
#endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef>
namespace glm{
namespace detail
@ -39,67 +49,68 @@ namespace detail
template <typename T, precision P>
struct tvec2
{
//////////////////////////////////////
// Implementation detail
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec2<T, P> type;
typedef tvec2<bool, P> bool_type;
typedef T value_type;
typedef int size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
//////////////////////////////////////
// Helper
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
//////////////////////////////////////
// Data
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
union
{
# if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
# endif//(defined(GLM_SWIZZLE))
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
union
{
struct{ T x, y; };
struct{ T r, g; };
struct{ T s, t; };
struct {value_type r, g;};
struct {value_type s, t;};
struct {value_type x, y;};
};
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;};
union {value_type y, g, t;};
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
};
# else
union {T x, r, s;};
union {T y, g, t;};
# if(defined(GLM_SWIZZLE))
// Defines all he swizzle operator as functions
GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, P, detail::tvec2, detail::tref2)
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
value_type x, y;
# if(defined(GLM_SWIZZLE))
// Defines all he swizzle operator as functions
GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(value_type, P, detail::tvec2, detail::tref2, x, y)
GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4, x, y)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_COMPONENT
# ifdef GLM_SWIZZLE
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
# endif
# endif
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL value_type const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
//////////////////////////////////////
// Implicit basic constructors
GLM_FUNC_DECL tvec2();
GLM_FUNC_DECL tvec2(tvec2<T, P> const & v);
template <precision Q>
GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec2(std::initializer_list<U> const & v);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
@ -107,24 +118,24 @@ namespace detail
GLM_FUNC_DECL explicit tvec2(
ctor);
GLM_FUNC_DECL explicit tvec2(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tvec2(
value_type const & s1,
value_type const & s2);
T const & s1,
T const & s2);
//////////////////////////////////////
// Swizzle constructors
tvec2(tref2<T, P> const & r);
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1>
GLM_FUNC_DECL tvec2(_swizzle<2,T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
{
*this = that();
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
//////////////////////////////////////
// Convertion constructors
// Conversion constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
@ -137,7 +148,7 @@ namespace detail
V const & y);
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
@ -157,19 +168,19 @@ namespace detail
GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator+=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator-=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator*=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator/=(tvec2<U, P> const & v);
@ -185,52 +196,29 @@ namespace detail
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator%= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator&= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator|= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^= (U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator^= (U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^= (tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U s);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec2<U, P> const & v);
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;
GLM_FUNC_DECL tref2<T, P> swizzle(comp X, comp Y);
};
template <typename T, precision P>
struct tref2
{
GLM_FUNC_DECL tref2(T & x, T & y);
GLM_FUNC_DECL tref2(tref2<T, P> const & r);
GLM_FUNC_DECL explicit tref2(tvec2<T, P> const & v);
GLM_FUNC_DECL tref2<T, P> & operator= (tref2<T, P> const & r);
GLM_FUNC_DECL tref2<T, P> & operator= (tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator() ();
T & x;
T & y;
};
GLM_DETAIL_IS_VECTOR(tvec2);

View File

@ -30,7 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::size_type tvec2<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec2<T, P>::length() const
{
return 2;
}
@ -39,16 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](size_type i)
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](length_t i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](size_type i) const
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](length_t i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -57,34 +57,43 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2() :
x(value_type(0)),
y(value_type(0))
x(0),
y(0)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
ctor
)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
tvec2<T, P> const & v
) :
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec2<T, P> const & v) :
x(v.x),
y(v.y)
{}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(tvec2<T, Q> const & v) :
x(v.x),
y(v.y)
{}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(std::initializer_list<U> const & v) :
x(static_cast<T>(v.begin()[0])),
y(static_cast<T>(v.begin()[1]))
{
assert(v.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
value_type const & s
) :
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(ctor)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & s) :
x(s),
y(s)
{}
@ -92,27 +101,15 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
value_type const & s1,
value_type const & s2
T const & s1,
T const & s2
) :
x(s1),
y(s2)
{}
//////////////////////////////////////
// Swizzle constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
tref2<T, P> const & r
) :
x(r.x),
y(r.y)
{}
//////////////////////////////////////
// Convertion scalar constructors
// Conversion scalar constructors
template <typename T, precision P>
template <typename U>
@ -120,8 +117,8 @@ namespace detail
(
U const & x
) :
x(value_type(x)),
y(value_type(x))
x(static_cast<T>(x)),
y(static_cast<T>(x))
{}
template <typename T, precision P>
@ -131,12 +128,12 @@ namespace detail
U const & a,
V const & b
) :
x(value_type(a)),
y(value_type(b))
x(static_cast<T>(a)),
y(static_cast<T>(b))
{}
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
template <typename T, precision P>
template <typename U, precision Q>
@ -144,8 +141,8 @@ namespace detail
(
tvec2<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y))
{}
template <typename T, precision P>
@ -154,8 +151,8 @@ namespace detail
(
tvec3<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y))
{}
template <typename T, precision P>
@ -164,8 +161,8 @@ namespace detail
(
tvec4<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y))
{}
//////////////////////////////////////
@ -189,8 +186,8 @@ namespace detail
tvec2<U, P> const & v
)
{
this->x = T(v.x);
this->y = T(v.y);
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
return *this;
}
@ -198,11 +195,11 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=
(
U const & s
U s
)
{
this->x += T(s);
this->y += T(s);
this->x += static_cast<T>(s);
this->y += static_cast<T>(s);
return *this;
}
@ -213,8 +210,8 @@ namespace detail
tvec2<U, P> const & v
)
{
this->x += T(v.x);
this->y += T(v.y);
this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.y);
return *this;
}
@ -222,11 +219,11 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=
(
U const & s
U s
)
{
this->x -= T(s);
this->y -= T(s);
this->x -= static_cast<T>(s);
this->y -= static_cast<T>(s);
return *this;
}
@ -237,8 +234,8 @@ namespace detail
tvec2<U, P> const & v
)
{
this->x -= T(v.x);
this->y -= T(v.y);
this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.y);
return *this;
}
@ -246,11 +243,11 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=
(
U const & s
U s
)
{
this->x *= T(s);
this->y *= T(s);
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
return *this;
}
@ -261,8 +258,8 @@ namespace detail
tvec2<U, P> const & v
)
{
this->x *= T(v.x);
this->y *= T(v.y);
this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.y);
return *this;
}
@ -270,11 +267,11 @@ namespace detail
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=
(
U const & s
U s
)
{
this->x /= T(s);
this->y /= T(s);
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
return *this;
}
@ -285,8 +282,8 @@ namespace detail
tvec2<U, P> const & v
)
{
this->x /= T(v.x);
this->y /= T(v.y);
this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.y);
return *this;
}
@ -353,214 +350,112 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%= (U s)
{
this->x %= T(s);
this->y %= T(s);
this->x %= static_cast<T>(s);
this->y %= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%= (tvec2<U, P> const & v)
{
this->x %= T(v.x);
this->y %= T(v.y);
this->x %= static_cast<T>(v.x);
this->y %= static_cast<T>(v.y);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&= (U s)
{
this->x &= T(s);
this->y &= T(s);
this->x &= static_cast<T>(s);
this->y &= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&= (tvec2<U, P> const & v)
{
this->x &= T(v.x);
this->y &= T(v.y);
this->x &= static_cast<T>(v.x);
this->y &= static_cast<T>(v.y);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|= (U s)
{
this->x |= T(s);
this->y |= T(s);
this->x |= static_cast<T>(s);
this->y |= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|= (tvec2<U, P> const & v)
{
this->x |= T(v.x);
this->y |= T(v.y);
this->x |= static_cast<T>(v.x);
this->y |= static_cast<T>(v.y);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^= (U s)
{
this->x ^= T(s);
this->y ^= T(s);
this->x ^= static_cast<T>(s);
this->y ^= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^= (tvec2<U, P> const & v)
{
this->x ^= T(v.x);
this->y ^= T(v.y);
this->x ^= static_cast<T>(v.x);
this->y ^= static_cast<T>(v.y);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<= (U s)
{
this->x <<= T(s);
this->y <<= T(s);
this->x <<= static_cast<T>(s);
this->y <<= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<= (tvec2<U, P> const & v)
{
this->x <<= T(v.x);
this->y <<= T(v.y);
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.y);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>= (U s)
{
this->x >>= T(s);
this->y >>= T(s);
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=
(
tvec2<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>= (tvec2<U, P> const & v)
{
this->x >>= T(v.x);
this->y >>= T(v.y);
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y);
return *this;
}
//////////////////////////////////////
// Swizzle operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec2<T, P>::value_type tvec2<T, P>::swizzle
(
comp x
) const
{
return (*this)[x];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::swizzle
(
comp x,
comp y
) const
{
return tvec2<T, P>(
(*this)[x],
(*this)[y]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tvec2<T, P>::swizzle
(
comp x,
comp y,
comp z
) const
{
return tvec3<T, P>(
(*this)[x],
(*this)[y],
(*this)[z]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> tvec2<T, P>::swizzle
(
comp x,
comp y,
comp z,
comp w
) const
{
return tvec4<T, P>(
(*this)[x],
(*this)[y],
(*this)[z],
(*this)[w]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P> tvec2<T, P>::swizzle
(
comp x,
comp y
)
{
return tref2<T, P>(
(*this)[x],
(*this)[y]);
}
//////////////////////////////////////
// Binary arithmetic operators
@ -572,8 +467,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x + T(s),
v.y + T(s));
v.x + s,
v.y + s);
}
template <typename T, precision P>
@ -584,8 +479,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) + v.x,
T(s) + v.y);
s + v.x,
s + v.y);
}
template <typename T, precision P>
@ -596,8 +491,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x + T(v2.x),
v1.y + T(v2.y));
v1.x + v2.x,
v1.y + v2.y);
}
//operator-
@ -609,8 +504,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x - T(s),
v.y - T(s));
v.x - s,
v.y - s);
}
template <typename T, precision P>
@ -621,8 +516,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) - v.x,
T(s) - v.y);
s - v.x,
s - v.y);
}
template <typename T, precision P>
@ -633,8 +528,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x - T(v2.x),
v1.y - T(v2.y));
v1.x - v2.x,
v1.y - v2.y);
}
//operator*
@ -646,8 +541,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x * T(s),
v.y * T(s));
v.x * s,
v.y * s);
}
template <typename T, precision P>
@ -658,8 +553,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) * v.x,
T(s) * v.y);
s * v.x,
s * v.y);
}
template <typename T, precision P>
@ -670,8 +565,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x * T(v2.x),
v1.y * T(v2.y));
v1.x * v2.x,
v1.y * v2.y);
}
//operator/
@ -683,8 +578,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x / T(s),
v.y / T(s));
v.x / s,
v.y / s);
}
template <typename T, precision P>
@ -695,8 +590,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) / v.x,
T(s) / v.y);
s / v.x,
s / v.y);
}
template <typename T, precision P>
@ -707,8 +602,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x / T(v2.x),
v1.y / T(v2.y));
v1.x / v2.x,
v1.y / v2.y);
}
// Unary constant operators
@ -734,8 +629,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x % T(s),
v.y % T(s));
v.x % s,
v.y % s);
}
template <typename T, precision P>
@ -746,8 +641,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) % v.x,
T(s) % v.y);
s % v.x,
s % v.y);
}
template <typename T, precision P>
@ -758,8 +653,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x % T(v2.x),
v1.y % T(v2.y));
v1.x % v2.x,
v1.y % v2.y);
}
template <typename T, precision P>
@ -770,8 +665,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x & T(s),
v.y & T(s));
v.x & s,
v.y & s);
}
template <typename T, precision P>
@ -782,8 +677,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) & v.x,
T(s) & v.y);
s & v.x,
s & v.y);
}
template <typename T, precision P>
@ -794,8 +689,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x & T(v2.x),
v1.y & T(v2.y));
v1.x & v2.x,
v1.y & v2.y);
}
template <typename T, precision P>
@ -806,8 +701,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x | T(s),
v.y | T(s));
v.x | s,
v.y | s);
}
template <typename T, precision P>
@ -818,8 +713,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) | v.x,
T(s) | v.y);
s | v.x,
s | v.y);
}
template <typename T, precision P>
@ -830,8 +725,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x | T(v2.x),
v1.y | T(v2.y));
v1.x | v2.x,
v1.y | v2.y);
}
template <typename T, precision P>
@ -842,8 +737,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x ^ T(s),
v.y ^ T(s));
v.x ^ s,
v.y ^ s);
}
template <typename T, precision P>
@ -854,8 +749,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) ^ v.x,
T(s) ^ v.y);
s ^ v.x,
s ^ v.y);
}
template <typename T, precision P>
@ -866,8 +761,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x ^ T(v2.x),
v1.y ^ T(v2.y));
v1.x ^ v2.x,
v1.y ^ v2.y);
}
template <typename T, precision P>
@ -878,8 +773,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x << T(s),
v.y << T(s));
v.x << s,
v.y << s);
}
template <typename T, precision P>
@ -890,8 +785,8 @@ namespace detail
)
{
return tvec2<T, P>(
s << T(v.x),
s << T(v.y));
s << v.x,
s << v.y);
}
template <typename T, precision P>
@ -902,8 +797,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x << T(v2.x),
v1.y << T(v2.y));
v1.x << v2.x,
v1.y << v2.y);
}
template <typename T, precision P>
@ -914,8 +809,8 @@ namespace detail
)
{
return tvec2<T, P>(
v.x >> T(s),
v.y >> T(s));
v.x >> s,
v.y >> s);
}
template <typename T, precision P>
@ -926,8 +821,8 @@ namespace detail
)
{
return tvec2<T, P>(
T(s) >> v.x,
T(s) >> v.y);
s >> v.x,
s >> v.y);
}
template <typename T, precision P>
@ -938,8 +833,8 @@ namespace detail
)
{
return tvec2<T, P>(
v1.x >> T(v2.x),
v1.y >> T(v2.y));
v1.x >> v2.x,
v1.y >> v2.y);
}
template <typename T, precision P>
@ -953,63 +848,5 @@ namespace detail
~v.y);
}
//////////////////////////////////////
// tref definition
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P>::tref2
(
T & x,
T & y
) :
x(x),
y(y)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P>::tref2
(
tref2<T, P> const & r
) :
x(r.x),
y(r.y)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P>::tref2
(
tvec2<T, P> const & v
) :
x(v.x),
y(v.y)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P>& tref2<T, P>::operator=
(
tref2<T, P> const & r
)
{
x = r.x;
y = r.y;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P>& tref2<T, P>::operator=
(
tvec2<T, P> const & v
)
{
x = v.x;
y = v.y;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tref2<T, P>::operator() ()
{
return tvec2<T, P>(this->x, this->y);
}
}//namespace detail
}//namespace glm

View File

@ -29,9 +29,19 @@
#ifndef glm_core_type_gentype3
#define glm_core_type_gentype3
#include "../fwd.hpp"
//#include "../fwd.hpp"
#include "type_vec.hpp"
#include "_swizzle.hpp"
#ifdef GLM_SWIZZLE
# if GLM_HAS_ANONYMOUS_UNION
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
# endif
#endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef>
namespace glm{
namespace detail
@ -39,68 +49,69 @@ namespace detail
template <typename T, precision P>
struct tvec3
{
//////////////////////////////////////
// Implementation detail
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec3<T, P> type;
typedef tvec3<bool, P> bool_type;
typedef T value_type;
typedef int size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
//////////////////////////////////////
// Helper
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
//////////////////////////////////////
// Data
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
union
{
# if(defined(GLM_SWIZZLE))
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
# endif//(defined(GLM_SWIZZLE))
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
union
{
struct{ T x, y, z; };
struct{ T r, g, b; };
struct{ T s, t, p; };
struct {value_type r, g, b;};
struct {value_type s, t, p;};
struct {value_type x, y, z;};
};
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;};
union {value_type y, g, t;};
union {value_type z, b, p;};
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
};
# else
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
# if(defined(GLM_SWIZZLE))
// Defines all he swizzle operator as functions
GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P, detail::tvec3, detail::tref2, detail::tref3)
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
value_type x, y, z;
# if(defined(GLM_SWIZZLE))
// Defines all he swizzle operator as functions
GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, detail::tvec3, detail::tref2, detail::tref3, x, y, z)
GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4, x, y, z)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_COMPONENT
# ifdef GLM_SWIZZLE
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4)
# endif
# endif//GLM_LANG
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL value_type const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
//////////////////////////////////////
// Implicit basic constructors
GLM_FUNC_DECL tvec3();
GLM_FUNC_DECL tvec3(tvec3<T, P> const & v);
template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec3(std::initializer_list<U> const & v);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
@ -108,14 +119,14 @@ namespace detail
GLM_FUNC_DECL explicit tvec3(
ctor);
GLM_FUNC_DECL explicit tvec3(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tvec3(
value_type const & s1,
value_type const & s2,
value_type const & s3);
T const & s1,
T const & s2,
T const & s3);
//////////////////////////////////////
// Convertion scalar constructors
// Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
@ -129,7 +140,7 @@ namespace detail
W const & z);
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
@ -147,14 +158,7 @@ namespace detail
//////////////////////////////////////
// Swizzle constructors
GLM_FUNC_DECL tvec3(tref3<T, P> const & r);
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(tref2<A, P> const & v, B const & s);
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(A const & s, tref2<B, P> const & v);
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
{
@ -172,6 +176,7 @@ namespace detail
{
*this = tvec3<T, P>(s, v());
}
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
//////////////////////////////////////
// Unary arithmetic operators
@ -181,19 +186,19 @@ namespace detail
GLM_FUNC_DECL tvec3<T, P> & operator= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec3<U, P> const & v);
@ -209,54 +214,29 @@ namespace detail
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator%= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator&= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator|= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^= (U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator^= (U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^= (tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U s);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec3<U, P> const & v);
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;
GLM_FUNC_DECL tref2<T, P> swizzle(comp X, comp Y);
GLM_FUNC_DECL tref3<T, P> swizzle(comp X, comp Y, comp Z);
};
template <typename T, precision P>
struct tref3
{
GLM_FUNC_DECL tref3(T & x, T & y, T & z);
GLM_FUNC_DECL tref3(tref3<T, P> const & r);
GLM_FUNC_DECL explicit tref3(tvec3<T, P> const & v);
GLM_FUNC_DECL tref3<T, P> & operator= (tref3<T, P> const & r);
GLM_FUNC_DECL tref3<T, P> & operator= (tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator() ();
T & x;
T & y;
T & z;
};
GLM_DETAIL_IS_VECTOR(tvec3);

View File

@ -30,7 +30,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::size_type tvec3<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec3<T, P>::length() const
{
return 3;
}
@ -39,16 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](size_type i)
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](length_t i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](size_type i) const
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](length_t i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -57,36 +57,47 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3() :
x(value_type(0)),
y(value_type(0)),
z(value_type(0))
x(0),
y(0),
z(0)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
ctor
)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
tvec3<T, P> const & v
) :
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec3<T, P> const & v) :
x(v.x),
y(v.y),
z(v.z)
{}
template <typename T, precision P>
template <precision Q>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(tvec3<T, Q> const & v) :
x(v.x),
y(v.y),
z(v.z)
{}
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(std::initializer_list<U> const & v) :
x(static_cast<T>(v.begin()[0])),
y(static_cast<T>(v.begin()[1])),
z(static_cast<T>(v.begin()[2]))
{
assert(v.size() == this->length());
}
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
value_type const & s
) :
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(ctor)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(T const & s) :
x(s),
y(s),
z(s)
@ -95,9 +106,9 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
value_type const & s0,
value_type const & s1,
value_type const & s2
T const & s0,
T const & s1,
T const & s2
) :
x(s0),
y(s1),
@ -105,44 +116,7 @@ namespace detail
{}
//////////////////////////////////////
// Swizzle constructors
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
tref3<T, P> const & r
) :
x(r.x),
y(r.y),
z(r.z)
{}
template <typename T, precision P>
template <typename A, typename B>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
tref2<A, P> const & v,
B const & s
) :
x(value_type(v.x)),
y(value_type(v.y)),
z(value_type(s))
{}
template <typename T, precision P>
template <typename A, typename B>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
A const & s,
tref2<B, P> const & v
) :
x(value_type(s)),
y(value_type(v.x)),
z(value_type(v.y))
{}
//////////////////////////////////////
// Convertion scalar constructors
// Conversion scalar constructors
template <typename T, precision P>
template <typename U>
@ -150,9 +124,9 @@ namespace detail
(
U const & s
) :
x(value_type(s)),
y(value_type(s)),
z(value_type(s))
x(static_cast<T>(s)),
y(static_cast<T>(s)),
z(static_cast<T>(s))
{}
template <typename T, precision P>
@ -163,13 +137,13 @@ namespace detail
B const & y,
C const & z
) :
x(value_type(x)),
y(value_type(y)),
z(value_type(z))
x(static_cast<T>(x)),
y(static_cast<T>(y)),
z(static_cast<T>(z))
{}
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
template <typename T, precision P>
template <typename A, typename B, precision Q>
@ -178,9 +152,9 @@ namespace detail
tvec2<A, Q> const & v,
B const & s
) :
x(value_type(v.x)),
y(value_type(v.y)),
z(value_type(s))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(s))
{}
template <typename T, precision P>
@ -190,9 +164,9 @@ namespace detail
A const & s,
tvec2<B, Q> const & v
) :
x(value_type(s)),
y(value_type(v.x)),
z(value_type(v.y))
x(static_cast<T>(s)),
y(static_cast<T>(v.x)),
z(static_cast<T>(v.y))
{}
template <typename T, precision P>
@ -201,9 +175,9 @@ namespace detail
(
tvec3<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y)),
z(value_type(v.z))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(v.z))
{}
template <typename T, precision P>
@ -212,19 +186,16 @@ namespace detail
(
tvec4<U, Q> const & v
) :
x(value_type(v.x)),
y(value_type(v.y)),
z(value_type(v.z))
x(static_cast<T>(v.x)),
y(static_cast<T>(v.y)),
z(static_cast<T>(v.z))
{}
//////////////////////////////////////
// Unary arithmetic operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator=
(
tvec3<T, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator= (tvec3<T, P> const & v)
{
this->x = v.x;
this->y = v.y;
@ -234,118 +205,91 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P>& tvec3<T, P>::operator= (tvec3<U, P> const & v)
{
this->x = T(v.x);
this->y = T(v.y);
this->z = T(v.z);
this->x = static_cast<T>(v.x);
this->y = static_cast<T>(v.y);
this->z = static_cast<T>(v.z);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (U s)
{
this->x += T(s);
this->y += T(s);
this->z += T(s);
this->x += static_cast<T>(s);
this->y += static_cast<T>(s);
this->z += static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+= (tvec3<U, P> const & v)
{
this->x += T(v.x);
this->y += T(v.y);
this->z += T(v.z);
this->x += static_cast<T>(v.x);
this->y += static_cast<T>(v.y);
this->z += static_cast<T>(v.z);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (U s)
{
this->x -= T(s);
this->y -= T(s);
this->z -= T(s);
this->x -= static_cast<T>(s);
this->y -= static_cast<T>(s);
this->z -= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-= (tvec3<U, P> const & v)
{
this->x -= T(v.x);
this->y -= T(v.y);
this->z -= T(v.z);
this->x -= static_cast<T>(v.x);
this->y -= static_cast<T>(v.y);
this->z -= static_cast<T>(v.z);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (U s)
{
this->x *= T(s);
this->y *= T(s);
this->z *= T(s);
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
this->z *= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*= (tvec3<U, P> const & v)
{
this->x *= T(v.x);
this->y *= T(v.y);
this->z *= T(v.z);
this->x *= static_cast<T>(v.x);
this->y *= static_cast<T>(v.y);
this->z *= static_cast<T>(v.z);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (U s)
{
this->x /= T(s);
this->y /= T(s);
this->z /= T(s);
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
this->z /= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/= (tvec3<U, P> const & v)
{
this->x /= T(v.x);
this->y /= T(v.y);
this->z /= T(v.z);
this->x /= static_cast<T>(v.x);
this->y /= static_cast<T>(v.y);
this->z /= static_cast<T>(v.z);
return *this;
}
@ -414,10 +358,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (U s)
{
this->x %= s;
this->y %= s;
@ -427,10 +368,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%= (tvec3<U, P> const & v)
{
this->x %= v.x;
this->y %= v.y;
@ -440,10 +378,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (U s)
{
this->x &= s;
this->y &= s;
@ -453,10 +388,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&= (tvec3<U, P> const & v)
{
this->x &= v.x;
this->y &= v.y;
@ -466,10 +398,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (U s)
{
this->x |= s;
this->y |= s;
@ -479,10 +408,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|= (tvec3<U, P> const & v)
{
this->x |= v.x;
this->y |= v.y;
@ -492,10 +418,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (U s)
{
this->x ^= s;
this->y ^= s;
@ -505,10 +428,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^= (tvec3<U, P> const & v)
{
this->x ^= v.x;
this->y ^= v.y;
@ -518,10 +438,7 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (U s)
{
this->x <<= s;
this->y <<= s;
@ -531,124 +448,34 @@ namespace detail
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<= (tvec3<U, P> const & v)
{
this->x <<= T(v.x);
this->y <<= T(v.y);
this->z <<= T(v.z);
this->x <<= static_cast<T>(v.x);
this->y <<= static_cast<T>(v.y);
this->z <<= static_cast<T>(v.z);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>=
(
U const & s
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (U s)
{
this->x >>= T(s);
this->y >>= T(s);
this->z >>= T(s);
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
this->z >>= static_cast<T>(s);
return *this;
}
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>=
(
tvec3<U, P> const & v
)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>= (tvec3<U, P> const & v)
{
this->x >>= T(v.x);
this->y >>= T(v.y);
this->z >>= T(v.z);
this->x >>= static_cast<T>(v.x);
this->y >>= static_cast<T>(v.y);
this->z >>= static_cast<T>(v.z);
return *this;
}
//////////////////////////////////////
// Swizzle operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec3<T, P>::value_type
tvec3<T, P>::swizzle
(
comp x
) const
{
return (*this)[x];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec3<T, P>::swizzle
(
comp x,
comp y
) const
{
return tvec2<T, P>(
(*this)[x],
(*this)[y]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tvec3<T, P>::swizzle
(
comp x,
comp y,
comp z
) const
{
return tvec3<T, P>(
(*this)[x],
(*this)[y],
(*this)[z]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> tvec3<T, P>::swizzle
(
comp x,
comp y,
comp z,
comp w
) const
{
return tvec4<T, P>(
(*this)[x],
(*this)[y],
(*this)[z],
(*this)[w]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P> tvec3<T, P>::swizzle
(
comp x,
comp y
)
{
return tref2<T, P>(
(*this)[x],
(*this)[y]);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P> tvec3<T, P>::swizzle
(
comp x,
comp y,
comp z
)
{
return tref3<T, P>(
(*this)[x],
(*this)[y],
(*this)[z]);
}
//////////////////////////////////////
// Binary arithmetic operators
@ -660,9 +487,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x + T(s),
v.y + T(s),
v.z + T(s));
v.x + s,
v.y + s,
v.z + s);
}
template <typename T, precision P>
@ -673,9 +500,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) + v.x,
T(s) + v.y,
T(s) + v.z);
s + v.x,
s + v.y,
s + v.z);
}
template <typename T, precision P>
@ -686,9 +513,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x + T(v2.x),
v1.y + T(v2.y),
v1.z + T(v2.z));
v1.x + v2.x,
v1.y + v2.y,
v1.z + v2.z);
}
//operator-
@ -700,9 +527,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x - T(s),
v.y - T(s),
v.z - T(s));
v.x - s,
v.y - s,
v.z - s);
}
template <typename T, precision P>
@ -713,9 +540,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) - v.x,
T(s) - v.y,
T(s) - v.z);
s - v.x,
s - v.y,
s - v.z);
}
template <typename T, precision P>
@ -726,9 +553,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x - T(v2.x),
v1.y - T(v2.y),
v1.z - T(v2.z));
v1.x - v2.x,
v1.y - v2.y,
v1.z - v2.z);
}
//operator*
@ -740,9 +567,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x * T(s),
v.y * T(s),
v.z * T(s));
v.x * s,
v.y * s,
v.z * s);
}
template <typename T, precision P>
@ -753,9 +580,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) * v.x,
T(s) * v.y,
T(s) * v.z);
s * v.x,
s * v.y,
s * v.z);
}
template <typename T, precision P>
@ -766,9 +593,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x * T(v2.x),
v1.y * T(v2.y),
v1.z * T(v2.z));
v1.x * v2.x,
v1.y * v2.y,
v1.z * v2.z);
}
//operator/
@ -780,9 +607,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x / T(s),
v.y / T(s),
v.z / T(s));
v.x / s,
v.y / s,
v.z / s);
}
template <typename T, precision P>
@ -793,9 +620,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) / v.x,
T(s) / v.y,
T(s) / v.z);
s / v.x,
s / v.y,
s / v.z);
}
template <typename T, precision P>
@ -806,9 +633,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x / T(v2.x),
v1.y / T(v2.y),
v1.z / T(v2.z));
v1.x / v2.x,
v1.y / v2.y,
v1.z / v2.z);
}
// Unary constant operators
@ -835,9 +662,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x % T(s),
v.y % T(s),
v.z % T(s));
v.x % s,
v.y % s,
v.z % s);
}
template <typename T, precision P>
@ -848,9 +675,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) % v.x,
T(s) % v.y,
T(s) % v.z);
s % v.x,
s % v.y,
s % v.z);
}
template <typename T, precision P>
@ -861,9 +688,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x % T(v2.x),
v1.y % T(v2.y),
v1.z % T(v2.z));
v1.x % v2.x,
v1.y % v2.y,
v1.z % v2.z);
}
template <typename T, precision P>
@ -874,9 +701,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x & T(s),
v.y & T(s),
v.z & T(s));
v.x & s,
v.y & s,
v.z & s);
}
template <typename T, precision P>
@ -887,9 +714,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) & v.x,
T(s) & v.y,
T(s) & v.z);
s & v.x,
s & v.y,
s & v.z);
}
template <typename T, precision P>
@ -900,9 +727,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x & T(v2.x),
v1.y & T(v2.y),
v1.z & T(v2.z));
v1.x & v2.x,
v1.y & v2.y,
v1.z & v2.z);
}
template <typename T, precision P>
@ -913,9 +740,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x | T(s),
v.y | T(s),
v.z | T(s));
v.x | s,
v.y | s,
v.z | s);
}
template <typename T, precision P>
@ -926,9 +753,9 @@ namespace detail
)
{
return tvec3<T, P>(
T(s) | v.x,
T(s) | v.y,
T(s) | v.z);
s | v.x,
s | v.y,
s | v.z);
}
template <typename T, precision P>
@ -939,9 +766,9 @@ namespace detail
)
{
return tvec3<T, P>(
v1.x | T(v2.x),
v1.y | T(v2.y),
v1.z | T(v2.z));
v1.x | v2.x,
v1.y | v2.y,
v1.z | v2.z);
}
template <typename T, precision P>
@ -952,9 +779,9 @@ namespace detail
)
{
return tvec3<T, P>(
v.x ^ T(s),
v.y ^ T(s),
v.z ^ T(s));
v.x ^ s,
v.y ^ s,
v.z ^ s);
}
template <typename T, precision P>
@ -1073,65 +900,5 @@ namespace detail
~v.z);
}
//////////////////////////////////////
// tref definition
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P>::tref3(T & x, T & y, T & z) :
x(x),
y(y),
z(z)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P>::tref3
(
tref3<T, P> const & r
) :
x(r.x),
y(r.y),
z(r.z)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P>::tref3
(
tvec3<T, P> const & v
) :
x(v.x),
y(v.y),
z(v.z)
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P> & tref3<T, P>::operator=
(
tref3<T, P> const & r
)
{
x = r.x;
y = r.y;
z = r.z;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P> & tref3<T, P>::operator=
(
tvec3<T, P> const & v
)
{
x = v.x;
y = v.y;
z = v.z;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tref3<T, P>::operator() ()
{
return tvec3<T, P>(this->x, this->y, this->z);
}
}//namespace detail
}//namespace glm

View File

@ -29,32 +29,52 @@
#ifndef glm_core_type_gentype4
#define glm_core_type_gentype4
#include "../fwd.hpp"
//#include "../fwd.hpp"
#include "setup.hpp"
#include "type_vec.hpp"
#include "_swizzle.hpp"
#ifdef GLM_SWIZZLE
# if GLM_HAS_ANONYMOUS_UNION
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
# endif
#endif //GLM_SWIZZLE
#if(GLM_HAS_INITIALIZER_LISTS)
# include <initializer_list>
#endif //GLM_HAS_INITIALIZER_LISTS
#include <cstddef>
namespace glm{
namespace detail
{
template <typename T, precision P>
struct __declspec(align(16)) tvec4
struct tvec4
{
//////////////////////////////////////
// Implementation detail
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec4<T, P> type;
typedef tvec4<bool, P> bool_type;
typedef T value_type;
typedef int size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
//////////////////////////////////////
// Helper
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
//////////////////////////////////////
// Data
# if(GLM_COMPONENT == GLM_COMPONENT_CXXMS)
union
{
# if(defined(GLM_SWIZZLE))
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
union
{
struct { T r, g, b, a; };
struct { T s, t, p, q; };
struct { T x, y, z, w;};
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q)
@ -64,44 +84,36 @@ namespace detail
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w)
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
# endif//(defined(GLM_SWIZZLE))
};
# else
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
union { T w, a, q; };
struct {value_type r, g, b, a;};
struct {value_type s, t, p, q;};
struct {value_type x, y, z, w;};
};
# elif(GLM_COMPONENT == GLM_COMPONENT_CXX98)
union {value_type x, r, s;};
union {value_type y, g, t;};
union {value_type z, b, p;};
union {value_type w, a, q;};
# if(defined(GLM_SWIZZLE))
// Defines all he swizzle operator as functions
GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4)
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# else //(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
value_type x, y, z, w;
# if(defined(GLM_SWIZZLE))
// Defines all he swizzle operator as functions
GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4, x, y, z, w)
GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4, x, y, z, w)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_COMPONENT
# ifdef GLM_SWIZZLE
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4)
# endif
# endif//GLM_LANG
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL value_type const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
//////////////////////////////////////
// Implicit basic constructors
GLM_FUNC_DECL tvec4();
GLM_FUNC_DECL tvec4(type const & v);
template <precision Q>
GLM_FUNC_DECL tvec4(tvec4<T, Q> const & v);
#if(GLM_HAS_INITIALIZER_LISTS)
template <typename U>
GLM_FUNC_DECL tvec4(std::initializer_list<U> l);
#endif//GLM_HAS_INITIALIZER_LISTS
//////////////////////////////////////
// Explicit basic constructors
@ -109,21 +121,21 @@ namespace detail
GLM_FUNC_DECL explicit tvec4(
ctor);
GLM_FUNC_DECL explicit tvec4(
value_type const & s);
T const & s);
GLM_FUNC_DECL explicit tvec4(
value_type const & s0,
value_type const & s1,
value_type const & s2,
value_type const & s3);
T const & s0,
T const & s1,
T const & s2,
T const & s3);
//////////////////////////////////////
// Convertion scalar constructors
// Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec4(
U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL explicit tvec4(
A const & x,
@ -132,7 +144,7 @@ namespace detail
D const & w);
//////////////////////////////////////
// Convertion vector constructors
// Conversion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
@ -156,6 +168,10 @@ namespace detail
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v);
//////////////////////////////////////
// Swizzle constructors
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
template <int E0, int E1, int E2, int E3>
GLM_FUNC_DECL tvec4(_swizzle<4, T, P, tvec4<T, P>, E0, E1, E2, E3> const & that)
{
@ -197,58 +213,29 @@ namespace detail
{
*this = tvec4<T, P>(x, v());
}
//////////////////////////////////////
// Swizzle constructors
GLM_FUNC_DECL tvec4(tref4<T, P> const & r);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
GLM_FUNC_DECL explicit tvec4(tref2<A, P> const & v, B const & s1, C const & s2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
GLM_FUNC_DECL explicit tvec4(A const & s1, tref2<B, P> const & v, C const & s2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
GLM_FUNC_DECL explicit tvec4(A const & s1, B const & s2, tref2<C, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec4(tref3<A, P> const & v, B const & s);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec4(A const & s, tref3<B, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec4(tref2<A, P> const & v1, tref2<B, P> const & v2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec4(tvec2<A, P> const & v1, tref2<B, P> const & v2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec4(tref2<A, P> const & v1, tvec2<B, P> const & v2);
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
//////////////////////////////////////
// Unary arithmetic operators
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, P> const & v);
template <typename U, precision Q>
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, Q> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator+=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator-=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator*=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator/=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v);
@ -264,92 +251,65 @@ namespace detail
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator%= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator%= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator&= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator&= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator|= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator|= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator^= (U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator^= (tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U s);
template <typename U>
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P> const & v);
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;
GLM_FUNC_DECL tref2<T, P> swizzle(comp X, comp Y);
GLM_FUNC_DECL tref3<T, P> swizzle(comp X, comp Y, comp Z);
GLM_FUNC_DECL tref4<T, P> swizzle(comp X, comp Y, comp Z, comp W);
};
template <typename T, precision P>
struct tref4
{
GLM_FUNC_DECL tref4(T & x, T & y, T & z, T & w);
GLM_FUNC_DECL tref4(tref4<T, P> const & r);
GLM_FUNC_DECL explicit tref4(tvec4<T, P> const & v);
GLM_FUNC_DECL tref4<T, P> & operator= (tref4<T, P> const & r);
GLM_FUNC_DECL tref4<T, P> & operator= (tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator() ();
T & x;
T & y;
T & z;
T & w;
};
GLM_DETAIL_IS_VECTOR(tvec4);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator+(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator-(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator- (tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator*(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator/(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -364,55 +324,55 @@ namespace detail
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator%(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator&(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator|(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator^(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator<<(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, typename tvec4<T, P>::value_type const & s);
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(typename tvec4<T, P>::value_type const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator>>(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2);

File diff suppressed because it is too large Load Diff

34
glm/exponential.hpp Normal file
View File

@ -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/exponential.hpp
/// @date 2013-12-24 / 2013-12-24
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_EXPONENTIAL_INCLUDED
#define GLM_EXPONENTIAL_INCLUDED
#include "detail/func_exponential.hpp"
#endif//GLM_EXPONENTIAL_INCLUDED

View File

@ -55,8 +55,8 @@
/// (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showprofile&User=22660).
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_ext
#define glm_ext
#ifndef GLM_EXT_INCLUDED
#define GLM_EXT_INCLUDED
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED))
# define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED
@ -65,16 +65,15 @@
#include "./gtc/constants.hpp"
#include "./gtc/epsilon.hpp"
#include "./gtc/half_float.hpp"
#include "./gtc/matrix_access.hpp"
#include "./gtc/matrix_integer.hpp"
#include "./gtc/matrix_inverse.hpp"
#include "./gtc/matrix_transform.hpp"
#include "./gtc/noise.hpp"
#include "./gtc/packing.hpp"
#include "./gtc/quaternion.hpp"
#include "./gtc/random.hpp"
#include "./gtc/reciprocal.hpp"
#include "./gtc/swizzle.hpp"
#include "./gtc/type_precision.hpp"
#include "./gtc/type_ptr.hpp"
#include "./gtc/ulp.hpp"
@ -82,7 +81,6 @@
#include "./gtx/associated_min_max.hpp"
#include "./gtx/bit.hpp"
#include "./gtx/closest_point.hpp"
#include "./gtx/color_cast.hpp"
#include "./gtx/color_space.hpp"
#include "./gtx/color_space_YCoCg.hpp"
#include "./gtx/compatibility.hpp"
@ -126,10 +124,8 @@
#include "./gtx/transform.hpp"
#include "./gtx/transform2.hpp"
#include "./gtx/vec1.hpp"
#include "./gtx/vector_access.hpp"
#include "./gtx/vector_angle.hpp"
#include "./gtx/vector_query.hpp"
#include "./gtx/verbose_operator.hpp"
#include "./gtx/wrap.hpp"
#if(GLM_ARCH & GLM_ARCH_SSE2)
@ -137,9 +133,4 @@
# include "./gtx/simd_mat4.hpp"
#endif
#include "./virtrev/xstream.hpp"
//const float goldenRatio = 1.618033988749894848f;
//const float pi = 3.141592653589793238f;
#endif //glm_ext
#endif //GLM_EXT_INCLUDED

View File

@ -29,50 +29,19 @@
#ifndef GLM_FWD_INCLUDED
#define GLM_FWD_INCLUDED
#include "core/type_int.hpp"
#include "core/type_float.hpp"
#include "core/type_vec.hpp"
#include "core/type_mat.hpp"
#include "detail/type_int.hpp"
#include "detail/type_float.hpp"
#include "detail/type_vec.hpp"
#include "detail/type_mat.hpp"
//////////////////////
// GLM_GTC_quaternion
namespace glm{
namespace detail
{
template <typename T, precision P> struct tref1;
template <typename T, precision P> struct tref2;
template <typename T, precision P> struct tref3;
template <typename T, precision P> struct tref4;
template <typename T, precision P> struct tquat;
}//namespace detail
/// Quaternion of low half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<half, lowp> lowp_hquat;
/// Quaternion of medium half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<half, mediump> mediump_hquat;
/// Quaternion of high half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<half, highp> highp_hquat;
#if(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
typedef highp_hquat hquat;
#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
typedef mediump_hquat hquat;
#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF))
typedef lowp_hquat hquat;
#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
/// Default half-precision floating-point numbers.
typedef highp_hquat hquat;
#endif
/// Quaternion of low single-precision floating-point numbers.
///
@ -1356,10 +1325,6 @@ namespace glm
//////////////////////
// Float vector types
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 lowp_float16;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32;
@ -1368,10 +1333,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 lowp_float64;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 lowp_float16_t;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32_t;
@ -1380,10 +1341,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 lowp_float64_t;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef float16 lowp_f16;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef float32 lowp_f32;
@ -1392,10 +1349,6 @@ namespace glm
/// @see gtc_type_precision
typedef float64 lowp_f64;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 lowp_float16;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32;
@ -1404,10 +1357,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 lowp_float64;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 lowp_float16_t;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32_t;
@ -1416,10 +1365,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 lowp_float64_t;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef float16 lowp_f16;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef float32 lowp_f32;
@ -1429,11 +1374,6 @@ namespace glm
typedef float64 lowp_f64;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 lowp_float16;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32;
@ -1442,10 +1382,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 lowp_float64;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 lowp_float16_t;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32_t;
@ -1454,10 +1390,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 lowp_float64_t;
/// Low 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef float16 lowp_f16;
/// Low 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef float32 lowp_f32;
@ -1467,10 +1399,6 @@ namespace glm
typedef float64 lowp_f64;
/// Medium 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 mediump_float16;
/// Medium 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 mediump_float32;
@ -1479,10 +1407,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 mediump_float64;
/// Medium 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 mediump_float16_t;
/// Medium 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 mediump_float32_t;
@ -1491,10 +1415,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 mediump_float64_t;
/// Medium 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef float16 mediump_f16;
/// Medium 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef float32 mediump_f32;
@ -1504,10 +1424,6 @@ namespace glm
typedef float64 mediump_f64;
/// High 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 highp_float16;
/// High 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 highp_float32;
@ -1516,10 +1432,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 highp_float64;
/// High 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 highp_float16_t;
/// High 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 highp_float32_t;
@ -1528,10 +1440,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::float64 highp_float64_t;
/// High 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef float16 highp_f16;
/// High 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef float32 highp_f32;
@ -1542,10 +1450,6 @@ namespace glm
#if(defined(GLM_PRECISION_LOWP_FLOAT))
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef lowp_float16 float16;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef lowp_float32 float32;
@ -1554,10 +1458,6 @@ namespace glm
/// @see gtc_type_precision
typedef lowp_float64 float64;
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef lowp_float16 float16_t;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef lowp_float32_t float32_t;
@ -1566,10 +1466,6 @@ namespace glm
/// @see gtc_type_precision
typedef lowp_float64_t float64_t;
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef lowp_f16 f16;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef lowp_f32 f32;
@ -1579,9 +1475,6 @@ namespace glm
typedef lowp_f64 f64;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef mediump_float16 float16;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
@ -1591,10 +1484,6 @@ namespace glm
/// @see gtc_type_precision
typedef mediump_float64 float64;
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef mediump_float16 float16_t;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef mediump_float32 float32_t;
@ -1603,10 +1492,6 @@ namespace glm
/// @see gtc_type_precision
typedef mediump_float64 float64_t;
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef mediump_float16 f16;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef mediump_float32 f32;
@ -1616,9 +1501,6 @@ namespace glm
typedef mediump_float64 f64;
#else//(defined(GLM_PRECISION_HIGHP_FLOAT))
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef highp_float16 float16;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
@ -1628,10 +1510,6 @@ namespace glm
/// @see gtc_type_precision
typedef highp_float64 float64;
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef highp_float16_t float16_t;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef highp_float32_t float32_t;
@ -1640,10 +1518,6 @@ namespace glm
/// @see gtc_type_precision
typedef highp_float64_t float64_t;
/// Default 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef highp_float16_t f16;
/// Default 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef highp_float32_t f32;
@ -1755,57 +1629,6 @@ namespace glm
typedef detail::tvec4<float, highp> highp_fvec4;
/// Low half-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f16, lowp> lowp_f16vec1;
/// Low half-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<f16, lowp> lowp_f16vec2;
/// Low half-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<f16, lowp> lowp_f16vec3;
/// Low half-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<f16, lowp> lowp_f16vec4;
/// Medium half-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f16, mediump> mediump_f16vec1;
/// Medium half-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<f16, mediump> mediump_f16vec2;
/// Medium half-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<f16, mediump> mediump_f16vec3;
/// Medium half-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<f16, mediump> mediump_f16vec4;
/// High half-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f16, highp> highp_f16vec1;
/// High half-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<f16, highp> highp_f16vec2;
/// High half-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<f16, highp> highp_f16vec3;
/// High half-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<f16, highp> highp_f16vec4;
/// Low single-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f32, lowp> lowp_f32vec1;
@ -1855,7 +1678,6 @@ namespace glm
typedef detail::tvec4<f32, highp> highp_f32vec4;
/// Low double-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f64, lowp> lowp_f64vec1;
@ -1904,10 +1726,10 @@ namespace glm
/// @see gtc_type_precision
typedef detail::tvec4<f64, highp> highp_f64vec4;
//////////////////////
// Float matrix types
/// Low single-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef lowp_f32 lowp_fmat1x1;
@ -2080,181 +1902,6 @@ namespace glm
typedef highp_fmat4x4 highp_fmat4;
/// Low half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef lowp_f16 lowp_f16mat1x1;
/// Low half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f16, lowp> lowp_f16mat2x2;
/// Low half-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f16, lowp> lowp_f16mat2x3;
/// Low half-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f16, lowp> lowp_f16mat2x4;
/// Low half-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f16, lowp> lowp_f16mat3x2;
/// Low half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f16, lowp> lowp_f16mat3x3;
/// Low half-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f16, lowp> lowp_f16mat3x4;
/// Low half-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f16, lowp> lowp_f16mat4x2;
/// Low half-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f16, lowp> lowp_f16mat4x3;
/// Low half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f16, lowp> lowp_f16mat4x4;
/// Low half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef lowp_f16mat1x1 lowp_f16mat1;
/// Low half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef lowp_f16mat2x2 lowp_f16mat2;
/// Low half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef lowp_f16mat3x3 lowp_f16mat3;
/// Low half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef lowp_f16mat4x4 lowp_f16mat4;
/// Medium half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef mediump_f16 mediump_f16mat1x1;
/// Medium half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f16, mediump> mediump_f16mat2x2;
/// Medium half-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f16, mediump> mediump_f16mat2x3;
/// Medium half-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f16, mediump> mediump_f16mat2x4;
/// Medium half-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f16, mediump> mediump_f16mat3x2;
/// Medium half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f16, mediump> mediump_f16mat3x3;
/// Medium half-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f16, mediump> mediump_f16mat3x4;
/// Medium half-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f16, mediump> mediump_f16mat4x2;
/// Medium half-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f16, mediump> mediump_f16mat4x3;
/// Medium half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f16, mediump> mediump_f16mat4x4;
/// Medium half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef mediump_f16mat1x1 mediump_f16mat1;
/// Medium half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef mediump_f16mat2x2 mediump_f16mat2;
/// Medium half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef mediump_f16mat3x3 mediump_f16mat3;
/// Medium half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef mediump_f16mat4x4 mediump_f16mat4;
/// High half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef highp_f16 highp_f16mat1x1;
/// High half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f16, highp> highp_f16mat2x2;
/// High half-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f16, highp> highp_f16mat2x3;
/// High half-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f16, highp> highp_f16mat2x4;
/// High half-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f16, highp> highp_f16mat3x2;
/// High half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f16, highp> highp_f16mat3x3;
/// High half-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f16, highp> highp_f16mat3x4;
/// High half-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f16, highp> highp_f16mat4x2;
/// High half-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f16, highp> highp_f16mat4x3;
/// High half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f16, highp> highp_f16mat4x4;
/// High half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef highp_f16mat1x1 highp_f16mat1;
/// High half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef highp_f16mat2x2 highp_f16mat2;
/// High half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef highp_f16mat3x3 highp_f16mat3;
/// High half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef highp_f16mat4x4 highp_f16mat4;
/// Low single-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f32 lowp_f32mat1x1;
@ -2544,8 +2191,6 @@ namespace glm
/// @see gtc_type_precision
typedef mediump_f64mat4x4 mediump_f64mat4;
/// High double-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f64 highp_f64mat1x1;
@ -2602,15 +2247,9 @@ namespace glm
/// @see gtc_type_precision
typedef highp_f64mat4x4 highp_f64mat4;
//////////////////////////
// Quaternion types
/// Low half-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f16, lowp> lowp_f16quat;
/// Low single-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f32, lowp> lowp_f32quat;
@ -2619,10 +2258,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::tquat<f64, lowp> lowp_f64quat;
/// Medium half-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f16, mediump> mediump_f16quat;
/// Medium single-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f32, mediump> mediump_f32quat;
@ -2631,10 +2266,6 @@ namespace glm
/// @see gtc_type_precision
typedef detail::tquat<f64, mediump> mediump_f64quat;
/// High half-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f16, highp> highp_f16quat;
/// High single-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f32, highp> highp_f32quat;
@ -2644,113 +2275,6 @@ namespace glm
typedef detail::tquat<f64, highp> highp_f64quat;
#if(defined(GLM_PRECISION_LOWP_HALF))
typedef lowp_f16vec1 f16vec1;
typedef lowp_f16vec2 f16vec2;
typedef lowp_f16vec3 f16vec3;
typedef lowp_f16vec4 f16vec4;
typedef lowp_f16mat2 f16mat2;
typedef lowp_f16mat3 f16mat3;
typedef lowp_f16mat4 f16mat4;
typedef lowp_f16mat2x2 f16mat2x2;
typedef lowp_f16mat3x2 f16mat3x2;
typedef lowp_f16mat4x2 f16mat4x2;
typedef lowp_f16mat2x3 f16mat2x3;
typedef lowp_f16mat3x3 f16mat3x3;
typedef lowp_f16mat4x3 f16mat4x3;
typedef lowp_f16mat2x4 f16mat2x4;
typedef lowp_f16mat3x4 f16mat3x4;
typedef lowp_f16mat4x4 f16mat4x4;
typedef lowp_f16quat f16quat;
#elif(defined(GLM_PRECISION_MEDIUMP_HALF))
typedef mediump_f16vec1 f16vec1;
typedef mediump_f16vec2 f16vec2;
typedef mediump_f16vec3 f16vec3;
typedef mediump_f16vec4 f16vec4;
typedef mediump_f16mat2 f16mat2;
typedef mediump_f16mat3 f16mat3;
typedef mediump_f16mat4 f16mat4;
typedef mediump_f16mat2x2 f16mat2x2;
typedef mediump_f16mat3x2 f16mat3x2;
typedef mediump_f16mat4x2 f16mat4x2;
typedef mediump_f16mat2x3 f16mat2x3;
typedef mediump_f16mat3x3 f16mat3x3;
typedef mediump_f16mat4x3 f16mat4x3;
typedef mediump_f16mat2x4 f16mat2x4;
typedef mediump_f16mat3x4 f16mat3x4;
typedef mediump_f16mat4x4 f16mat4x4;
typedef mediump_f16quat f16quat;
#else//if(defined(GLM_PRECISION_HIGHP_HALF))
/// Default half-precision floating-point vector of 1 components.
/// @see gtc_type_precision
typedef highp_f16vec1 f16vec1;
/// Default half-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef highp_f16vec2 f16vec2;
/// Default half-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef highp_f16vec3 f16vec3;
/// Default half-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef highp_f16vec4 f16vec4;
/// Default half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef highp_f16mat2x2 f16mat2x2;
/// Default half-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef highp_f16mat2x3 f16mat2x3;
/// Default half-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef highp_f16mat2x4 f16mat2x4;
/// Default half-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef highp_f16mat3x2 f16mat3x2;
/// Default half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef highp_f16mat3x3 f16mat3x3;
/// Default half-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef highp_f16mat3x4 f16mat3x4;
/// Default half-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef highp_f16mat4x2 f16mat4x2;
/// Default half-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef highp_f16mat4x3 f16mat4x3;
/// Default half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef highp_f16mat4x4 f16mat4x4;
/// Default half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef f16mat2x2 f16mat2;
/// Default half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef f16mat3x3 f16mat3;
/// Default half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef f16mat4x4 f16mat4;
/// Default half-precision floating-point quaternion.
/// @see gtc_type_precision
typedef highp_f16quat f16quat;
#endif
#if(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_f32vec1 fvec1;
typedef lowp_f32vec2 fvec2;

34
glm/geometric.hpp Normal file
View File

@ -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/geometric.hpp
/// @date 2013-12-24 / 2013-12-24
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GEOMETRIC_INCLUDED
#define GLM_GEOMETRIC_INCLUDED
#include "detail/func_geometric.hpp"
#endif//GLM_GEOMETRIC_INCLUDED

View File

@ -75,68 +75,31 @@
/// @ingroup core
///////////////////////////////////////////////////////////////////////////////////
#include "core/_fixes.hpp"
#include "detail/_fixes.hpp"
#ifndef glm_glm
#define glm_glm
#ifndef GLM_INCLUDED
#define GLM_INCLUDED
#include <cmath>
#include <climits>
#include <cfloat>
#include <limits>
#include <cassert>
//#include <cstdint>
//#include <type_traits>
#include "fwd.hpp"
#include "core/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED))
# define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED
# pragma message("GLM: Core library included")
#endif//GLM_MESSAGE
#include "./core/_vectorize.hpp"
#include "./detail/func_trigonometric.hpp"
#include "./detail/func_exponential.hpp"
#include "./detail/func_common.hpp"
#include "./detail/func_packing.hpp"
#include "./detail/func_geometric.hpp"
#include "./detail/func_matrix.hpp"
#include "./detail/func_vector_relational.hpp"
#include "./detail/func_integer.hpp"
#include "./detail/func_noise.hpp"
#include "./core/type_half.hpp"
#include "./core/type_float.hpp"
#include "./core/type_int.hpp"
#include "./core/_literals.hpp"
#include "./core/type_vec1.hpp"
#include "./core/type_vec2.hpp"
#include "./core/type_vec3.hpp"
#include "./core/type_vec4.hpp"
#include "./core/type_mat2x2.hpp"
#include "./core/type_mat2x3.hpp"
#include "./core/type_mat2x4.hpp"
#include "./core/type_mat3x2.hpp"
#include "./core/type_mat3x3.hpp"
#include "./core/type_mat3x4.hpp"
#include "./core/type_mat4x2.hpp"
#include "./core/type_mat4x3.hpp"
#include "./core/type_mat4x4.hpp"
#include "./core/func_trigonometric.hpp"
#include "./core/func_exponential.hpp"
#include "./core/func_common.hpp"
#include "./core/func_packing.hpp"
#include "./core/func_geometric.hpp"
#include "./core/func_matrix.hpp"
#include "./core/func_vector_relational.hpp"
#include "./core/func_integer.hpp"
#include "./core/func_noise.hpp"
#include "./core/_swizzle.hpp"
////////////////////
// check type sizes
#ifndef GLM_STATIC_ASSERT_NULL
GLM_STATIC_ASSERT(sizeof(glm::float16) == 2, "float16 size isn't 2 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
#endif//GLM_STATIC_ASSERT_NULL
#endif//glm_glm
#endif//GLM_INCLUDED

View File

@ -37,13 +37,12 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_constants
#define GLM_GTC_constants GLM_VERSION
#define GLM_GTC_constants
// Dependency:
#include "../glm.hpp"
#include "../gtc/half_float.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_constants extension included")
#endif
@ -56,127 +55,127 @@ namespace glm
/// @todo Implement epsilon for half-precision floating point type.
/// @see gtc_constants
template <typename genType>
genType epsilon();
GLM_FUNC_DECL genType epsilon();
/// Return 0.
/// @see gtc_constants
template <typename genType>
genType zero();
GLM_FUNC_DECL genType zero();
/// Return 1.
/// @see gtc_constants
template <typename genType>
genType one();
GLM_FUNC_DECL genType one();
/// Return the pi constant.
/// @see gtc_constants
template <typename genType>
genType pi();
GLM_FUNC_DECL genType pi();
/// Return square root of pi.
/// @see gtc_constants
template <typename genType>
genType root_pi();
GLM_FUNC_DECL genType root_pi();
/// Return pi / 2.
/// @see gtc_constants
template <typename genType>
genType half_pi();
GLM_FUNC_DECL genType half_pi();
/// Return pi / 4.
/// @see gtc_constants
template <typename genType>
genType quarter_pi();
GLM_FUNC_DECL genType quarter_pi();
/// Return 1 / pi.
/// @see gtc_constants
template <typename genType>
genType one_over_pi();
GLM_FUNC_DECL genType one_over_pi();
/// Return 2 / pi.
/// @see gtc_constants
template <typename genType>
genType two_over_pi();
GLM_FUNC_DECL genType two_over_pi();
/// Return 2 / sqrt(pi).
/// @see gtc_constants
template <typename genType>
genType two_over_root_pi();
GLM_FUNC_DECL genType two_over_root_pi();
/// Return 1 / sqrt(2).
/// @see gtc_constants
template <typename genType>
genType one_over_root_two();
GLM_FUNC_DECL genType one_over_root_two();
/// Return sqrt(pi / 2).
/// @see gtc_constants
template <typename genType>
genType root_half_pi();
GLM_FUNC_DECL genType root_half_pi();
/// Return sqrt(2 * pi).
/// @see gtc_constants
template <typename genType>
genType root_two_pi();
GLM_FUNC_DECL genType root_two_pi();
/// Return sqrt(ln(4)).
/// @see gtc_constants
template <typename genType>
genType root_ln_four();
GLM_FUNC_DECL genType root_ln_four();
/// Return e constant.
/// @see gtc_constants
template <typename genType>
genType e();
GLM_FUNC_DECL genType e();
/// Return Euler's constant.
/// @see gtc_constants
template <typename genType>
genType euler();
GLM_FUNC_DECL genType euler();
/// Return sqrt(2).
/// @see gtc_constants
template <typename genType>
genType root_two();
GLM_FUNC_DECL genType root_two();
/// Return sqrt(3).
/// @see gtc_constants
template <typename genType>
genType root_three();
GLM_FUNC_DECL genType root_three();
/// Return sqrt(5).
/// @see gtc_constants
template <typename genType>
genType root_five();
GLM_FUNC_DECL genType root_five();
/// Return ln(2).
/// @see gtc_constants
template <typename genType>
genType ln_two();
GLM_FUNC_DECL genType ln_two();
/// Return ln(10).
/// @see gtc_constants
template <typename genType>
genType ln_ten();
GLM_FUNC_DECL genType ln_ten();
/// Return ln(ln(2)).
/// @see gtc_constants
template <typename genType>
genType ln_ln_two();
GLM_FUNC_DECL genType ln_ln_two();
/// Return 1 / 3.
/// @see gtc_constants
template <typename genType>
genType third();
GLM_FUNC_DECL genType third();
/// Return 2 / 3.
/// @see gtc_constants
template <typename genType>
genType two_thirds();
GLM_FUNC_DECL genType two_thirds();
/// Return the golden ratio constant.
/// @see gtc_constants
template <typename genType>
genType golden_ratio();
GLM_FUNC_DECL genType golden_ratio();
/// @}
} //namespace glm

View File

@ -26,6 +26,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <limits>
namespace glm
{
template <typename genType>
@ -34,12 +36,6 @@ namespace glm
return std::numeric_limits<genType>::epsilon();
}
template <>
GLM_FUNC_QUALIFIER half epsilon()
{
return half(1.19209290e-007);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType zero()
{

View File

@ -38,14 +38,13 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_epsilon
#define GLM_GTC_epsilon GLM_VERSION
#define GLM_GTC_epsilon
// Dependency:
#include "../glm.hpp"
#include "../gtc/half_float.hpp"
#include "../gtc/quaternion.hpp"
// Dependencies
#include "../detail/setup.hpp"
#include "../detail/precision.hpp"
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_epsilon extension included")
#endif
@ -58,18 +57,18 @@ namespace glm
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonEqual(
genType const & x,
genType const & y,
typename genType::value_type const & epsilon);
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> epsilonEqual(
vecType<T, P> const & x,
vecType<T, P> const & y,
T const & epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonEqual(
GLM_FUNC_DECL bool epsilonEqual(
genType const & x,
genType const & y,
genType const & epsilon);
@ -79,7 +78,7 @@ namespace glm
///
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonNotEqual(
GLM_FUNC_DECL typename genType::boolType epsilonNotEqual(
genType const & x,
genType const & y,
typename genType::value_type const & epsilon);
@ -89,7 +88,7 @@ namespace glm
///
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonNotEqual(
GLM_FUNC_DECL bool epsilonNotEqual(
genType const & x,
genType const & y,
genType const & epsilon);

View File

@ -26,18 +26,17 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
// Dependency:
#include "quaternion.hpp"
#include "../vector_relational.hpp"
#include "../common.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
namespace glm
{
GLM_FUNC_QUALIFIER bool epsilonEqual
(
glm::half const & x,
glm::half const & y,
glm::half const & epsilon
)
{
return abs(x - y) < epsilon;
}
template <>
GLM_FUNC_QUALIFIER bool epsilonEqual
(
float const & x,
@ -48,6 +47,7 @@ namespace glm
return abs(x - y) < epsilon;
}
template <>
GLM_FUNC_QUALIFIER bool epsilonEqual
(
double const & x,
@ -58,16 +58,7 @@ namespace glm
return abs(x - y) < epsilon;
}
GLM_FUNC_QUALIFIER bool epsilonNotEqual
(
glm::half const & x,
glm::half const & y,
glm::half const & epsilon
)
{
return abs(x - y) >= epsilon;
}
template <>
GLM_FUNC_QUALIFIER bool epsilonNotEqual
(
float const & x,
@ -78,6 +69,7 @@ namespace glm
return abs(x - y) >= epsilon;
}
template <>
GLM_FUNC_QUALIFIER bool epsilonNotEqual
(
double const & x,
@ -88,170 +80,48 @@ namespace glm
return abs(x - y) >= epsilon;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<bool, P> epsilonEqual
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonEqual
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
T const & epsilon)
{
return detail::tvec2<bool, P>(
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<bool, P> epsilonEqual
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
detail::tvec2<T, P> const & epsilon
)
{
return detail::tvec2<bool, P>(
abs(x.x - y.x) < epsilon.x,
abs(x.y - y.y) < epsilon.y);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<bool, P> epsilonEqual
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
T const & epsilon)
{
return detail::tvec3<bool, P>(
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<bool, P> epsilonEqual
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
detail::tvec3<T, P> const & epsilon
)
{
return detail::tvec3<bool, P>(
abs(x.x - y.x) < epsilon.x,
abs(x.y - y.y) < epsilon.y,
abs(x.z - y.z) < epsilon.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> epsilonEqual
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
vecType<T, P> const & x,
vecType<T, P> const & y,
T const & epsilon
)
{
return detail::tvec4<bool, P>(
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon,
abs(x.w - y.w) < epsilon);
return lessThan(abs(x - y), vecType<T, P>(epsilon));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> epsilonEqual
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonEqual
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
detail::tvec4<T, P> const & epsilon
vecType<T, P> const & x,
vecType<T, P> const & y,
vecType<T, P> const & epsilon
)
{
return detail::tvec4<bool, P>(
abs(x.x - y.x) < epsilon.x,
abs(x.y - y.y) < epsilon.y,
abs(x.z - y.z) < epsilon.z,
abs(x.w - y.w) < epsilon.w);
return lessThan(abs(x - y), vecType<T, P>(epsilon));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<bool, P> epsilonNotEqual
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonNotEqual
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
vecType<T, P> const & x,
vecType<T, P> const & y,
T const & epsilon
)
{
return detail::tvec2<bool, P>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon);
return greaterThanEqual(abs(x - y), vecType<T, P>(epsilon));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<bool, P> epsilonNotEqual
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> epsilonNotEqual
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y,
detail::tvec2<T, P> const & epsilon
vecType<T, P> const & x,
vecType<T, P> const & y,
vecType<T, P> const & epsilon
)
{
return detail::tvec2<bool, P>(
abs(x.x - y.x) >= epsilon.x,
abs(x.y - y.y) >= epsilon.y);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<bool, P> epsilonNotEqual
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
T const & epsilon
)
{
return detail::tvec3<bool, P>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon,
abs(x.z - y.z) >= epsilon);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<bool, P> epsilonNotEqual
(
detail::tvec3<T, P> const & x,
detail::tvec3<T, P> const & y,
detail::tvec3<T, P> const & epsilon
)
{
return detail::tvec3<bool, P>(
abs(x.x - y.x) >= epsilon.x,
abs(x.y - y.y) >= epsilon.y,
abs(x.z - y.z) >= epsilon.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> epsilonNotEqual
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
T const & epsilon
)
{
return detail::tvec4<bool, P>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon,
abs(x.z - y.z) >= epsilon,
abs(x.w - y.w) >= epsilon);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> epsilonNotEqual
(
detail::tvec4<T, P> const & x,
detail::tvec4<T, P> const & y,
detail::tvec4<T, P> const & epsilon
)
{
return detail::tvec4<bool, P>(
abs(x.x - y.x) >= epsilon.x,
abs(x.y - y.y) >= epsilon.y,
abs(x.z - y.z) >= epsilon.z,
abs(x.w - y.w) >= epsilon.w);
return greaterThanEqual(abs(x - y), vecType<T, P>(epsilon));
}
template <typename T, precision P>
@ -262,11 +132,8 @@ namespace glm
T const & epsilon
)
{
return detail::tvec4<bool, P>(
abs(x.x - y.x) < epsilon,
abs(x.y - y.y) < epsilon,
abs(x.z - y.z) < epsilon,
abs(x.w - y.w) < epsilon);
detail::tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return lessThan(abs(v), detail::tvec4<T, P>(epsilon));
}
template <typename T, precision P>
@ -277,10 +144,7 @@ namespace glm
T const & epsilon
)
{
return detail::tvec4<bool, P>(
abs(x.x - y.x) >= epsilon,
abs(x.y - y.y) >= epsilon,
abs(x.z - y.z) >= epsilon,
abs(x.w - y.w) >= epsilon);
detail::tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return greaterThanEqual(abs(v), detail::tvec4<T, P>(epsilon));
}
}//namespace glm

View File

@ -1,683 +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 gtc_half_float
/// @file glm/gtc/half_float.hpp
/// @date 2009-04-29 / 2012-11-06
/// @author Christophe Riccio
///
/// @see core (dependence)
///
/// @defgroup gtc_half_float GLM_GTC_half_float
/// @ingroup gtc
///
/// Defines the half-precision floating-point type, along with various typedefs for vectors and matrices.
/// <glm/gtc/half_float.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_GTC_half_float
#define GLM_GTC_half_float GLM_VERSION
// Dependency:
#include "../glm.hpp"
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_GTC_half_float extension included")
#endif
namespace glm{
namespace detail
{
#if(GLM_COMPONENT == GLM_COMPONENT_CXX98)
template <precision P>
struct tvec2<half, P>
{
enum ctor{_null};
typedef half value_type;
typedef std::size_t size_type;
GLM_FUNC_DECL size_type length() const;
typedef tvec2<half, P> type;
typedef tvec2<bool, P> bool_type;
//////////////////////////////////////
// Data
half x, y;
//////////////////////////////////////
// Accesses
half & operator[](size_type i);
half const & operator[](size_type i) const;
//////////////////////////////////////
// Implicit basic constructors
tvec2();
tvec2(tvec2<half, P> const & v);
//////////////////////////////////////
// Explicit basic constructors
explicit tvec2(ctor){}
explicit tvec2(
half const & s);
explicit tvec2(
half const & s1,
half const & s2);
//////////////////////////////////////
// Swizzle constructors
tvec2(tref2<half, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec2(U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V>
explicit tvec2(U const & x, V const & y);
//////////////////////////////////////
// Convertion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
explicit tvec2(tvec2<U, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
explicit tvec2(tvec3<U, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
explicit tvec2(tvec4<U, Q> const & v);
//////////////////////////////////////
// Unary arithmetic operators
tvec2<half, P>& operator= (tvec2<half, P> const & v);
tvec2<half, P>& operator+=(half const & s);
tvec2<half, P>& operator+=(tvec2<half, P> const & v);
tvec2<half, P>& operator-=(half const & s);
tvec2<half, P>& operator-=(tvec2<half, P> const & v);
tvec2<half, P>& operator*=(half const & s);
tvec2<half, P>& operator*=(tvec2<half, P> const & v);
tvec2<half, P>& operator/=(half const & s);
tvec2<half, P>& operator/=(tvec2<half, P> const & v);
tvec2<half, P>& operator++();
tvec2<half, P>& operator--();
//////////////////////////////////////
// Swizzle operators
half swizzle(comp X) const;
tvec2<half, P> swizzle(comp X, comp Y) const;
tvec3<half, P> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, P> swizzle(comp X, comp Y, comp Z, comp W) const;
tref2<half, P> swizzle(comp X, comp Y);
};
template <precision P>
struct tvec3<half, P>
{
enum ctor{_null};
typedef half value_type;
typedef std::size_t size_type;
GLM_FUNC_DECL size_type length() const;
typedef tvec3<half, P> type;
typedef tvec3<bool, P> bool_type;
//////////////////////////////////////
// Data
half x, y, z;
//////////////////////////////////////
// Accesses
half & operator[](size_type i);
half const & operator[](size_type i) const;
//////////////////////////////////////
// Implicit basic constructors
tvec3();
tvec3(tvec3<half, P> const & v);
//////////////////////////////////////
// Explicit basic constructors
explicit tvec3(ctor){}
explicit tvec3(
half const & s);
explicit tvec3(
half const & s1,
half const & s2,
half const & s3);
//////////////////////////////////////
// Swizzle constructors
tvec3(tref3<half, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec3(U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V, typename W>
explicit tvec3(U const & x, V const & y, W const & z);
//////////////////////////////////////
// Convertion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
explicit tvec3(tvec2<A, Q> const & v, B const & s);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
explicit tvec3(A const & s, tvec2<B, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
explicit tvec3(tvec3<U, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
explicit tvec3(tvec4<U, Q> const & v);
//////////////////////////////////////
// Unary arithmetic operators
tvec3<half, P>& operator= (tvec3<half, P> const & v);
tvec3<half, P>& operator+=(half const & s);
tvec3<half, P>& operator+=(tvec3<half, P> const & v);
tvec3<half, P>& operator-=(half const & s);
tvec3<half, P>& operator-=(tvec3<half, P> const & v);
tvec3<half, P>& operator*=(half const & s);
tvec3<half, P>& operator*=(tvec3<half, P> const & v);
tvec3<half, P>& operator/=(half const & s);
tvec3<half, P>& operator/=(tvec3<half, P> const & v);
tvec3<half, P>& operator++();
tvec3<half, P>& operator--();
//////////////////////////////////////
// Swizzle operators
half swizzle(comp X) const;
tvec2<half, P> swizzle(comp X, comp Y) const;
tvec3<half, P> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, P> swizzle(comp X, comp Y, comp Z, comp W) const;
tref3<half, P> swizzle(comp X, comp Y, comp Z);
};
template <precision P>
struct tvec4<half, P>
{
enum ctor{_null};
typedef half value_type;
typedef std::size_t size_type;
GLM_FUNC_DECL size_type length() const;
typedef tvec4<half, P> type;
typedef tvec4<bool, P> bool_type;
//////////////////////////////////////
// Data
half x, y, z, w;
//////////////////////////////////////
// Accesses
half & operator[](size_type i);
half const & operator[](size_type i) const;
//////////////////////////////////////
// Implicit basic constructors
tvec4();
tvec4(tvec4<half, P> const & v);
//////////////////////////////////////
// Explicit basic constructors
explicit tvec4(ctor){}
explicit tvec4(
half const & s);
explicit tvec4(
half const & s0,
half const & s1,
half const & s2,
half const & s3);
//////////////////////////////////////
// Swizzle constructors
tvec4(tref4<half, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec4(U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, typename D>
explicit tvec4(A const & x, B const & y, C const & z, D const & w);
//////////////////////////////////////
// Convertion vector constructors
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
explicit tvec4(tvec2<A, Q> const & v, B const & s1, C const & s2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
explicit tvec4(A const & s1, tvec2<B, Q> const & v, C const & s2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
explicit tvec4(A const & s1, B const & s2, tvec2<C, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
explicit tvec4(tvec3<A, Q> const & v, B const & s);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
explicit tvec4(A const & s, tvec3<B, Q> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
explicit tvec4(tvec2<A, Q> const & v1, tvec2<B, Q> const & v2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
explicit tvec4(tvec4<U, Q> const & v);
//////////////////////////////////////
// Unary arithmetic operators
tvec4<half, P>& operator= (tvec4<half, P> const & v);
tvec4<half, P>& operator+=(half const & s);
tvec4<half, P>& operator+=(tvec4<half, P> const & v);
tvec4<half, P>& operator-=(half const & s);
tvec4<half, P>& operator-=(tvec4<half, P> const & v);
tvec4<half, P>& operator*=(half const & s);
tvec4<half, P>& operator*=(tvec4<half, P> const & v);
tvec4<half, P>& operator/=(half const & s);
tvec4<half, P>& operator/=(tvec4<half, P> const & v);
tvec4<half, P>& operator++();
tvec4<half, P>& operator--();
//////////////////////////////////////
// Swizzle operators
half swizzle(comp X) const;
tvec2<half, P> swizzle(comp X, comp Y) const;
tvec3<half, P> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, P> swizzle(comp X, comp Y, comp Z, comp W) const;
tref4<half, P> swizzle(comp X, comp Y, comp Z, comp W);
};
#endif//(GLM_COMPONENT == GLM_COMPONENT_CXX98)
}
//namespace detail
/// @addtogroup gtc_half_float
/// @{
//////////////////////////////////////////////
// High half precision floating-point numbers.
/// Vector of 2 high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec2<half_t, highp> highp_hvec2;
/// Vector of 3 high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec3<half_t, highp> highp_hvec3;
/// Vector of 4 high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec4<half_t, highp> highp_hvec4;
/// 2 * 2 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x2<half_t, highp> highp_hmat2;
/// 3 * 3 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x3<half_t, highp> highp_hmat3;
/// 4 * 4 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x4<half_t, highp> highp_hmat4;
/// 2 * 2 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x2<half_t, highp> highp_hmat2x2;
/// 2 * 3 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x3<half_t, highp> highp_hmat2x3;
/// 2 * 4 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x4<half_t, highp> highp_hmat2x4;
/// 3 * 2 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x2<half_t, highp> highp_hmat3x2;
/// 3 * 3 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x3<half_t, highp> highp_hmat3x3;
/// 3 * 4 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x4<half_t, highp> highp_hmat3x4;
/// 4 * 2 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x2<half_t, highp> highp_hmat4x2;
/// 4 * 3 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x3<half_t, highp> highp_hmat4x3;
/// 4 * 4 matrix of high half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x4<half_t, highp> highp_hmat4x4;
//////////////////////////////////////////////
// Medium half precision floating-point numbers.
/// Vector of 2 medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec2<half_t, mediump> mediump_hvec2;
/// Vector of 3 medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec3<half_t, mediump> mediump_hvec3;
/// Vector of 4 medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec4<half_t, mediump> mediump_hvec4;
/// 2 * 2 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x2<half_t, mediump> mediump_hmat2;
/// 3 * 3 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x3<half_t, mediump> mediump_hmat3;
/// 4 * 4 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x4<half_t, mediump> mediump_hmat4;
/// 2 * 2 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x2<half_t, mediump> mediump_hmat2x2;
/// 2 * 3 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x3<half_t, mediump> mediump_hmat2x3;
/// 2 * 4 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x4<half_t, mediump> mediump_hmat2x4;
/// 3 * 2 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x2<half_t, mediump> mediump_hmat3x2;
/// 3 * 3 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x3<half_t, mediump> mediump_hmat3x3;
/// 3 * 4 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x4<half_t, mediump> mediump_hmat3x4;
/// 4 * 2 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x2<half_t, mediump> mediump_hmat4x2;
/// 4 * 3 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x3<half_t, mediump> mediump_hmat4x3;
/// 4 * 4 matrix of medium half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x4<half_t, mediump> mediump_hmat4x4;
//////////////////////////////////////////////
// Low half precision floating-point numbers.
/// Vector of 2 low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec2<half_t, lowp> lowp_hvec2;
/// Vector of 3 low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec3<half_t, lowp> lowp_hvec3;
/// Vector of 4 low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tvec4<half_t, lowp> lowp_hvec4;
/// 2 * 2 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x2<half_t, lowp> lowp_hmat2;
/// 3 * 3 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x3<half_t, lowp> lowp_hmat3;
/// 4 * 4 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x4<half_t, lowp> lowp_hmat4;
/// 2 * 2 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x2<half_t, lowp> lowp_hmat2x2;
/// 2 * 3 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x3<half_t, lowp> lowp_hmat2x3;
/// 2 * 4 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat2x4<half_t, lowp> lowp_hmat2x4;
/// 3 * 2 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x2<half_t, lowp> lowp_hmat3x2;
/// 3 * 3 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x3<half_t, lowp> lowp_hmat3x3;
/// 3 * 4 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat3x4<half_t, lowp> lowp_hmat3x4;
/// 4 * 2 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x2<half_t, lowp> lowp_hmat4x2;
/// 4 * 3 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x3<half_t, lowp> lowp_hmat4x3;
/// 4 * 4 matrix of low half-precision floating-point numbers.
/// @see gtc_half_float
typedef detail::tmat4x4<half_t, lowp> lowp_hmat4x4;
//////////////////////////////////////////////
// Default half precision floating-point numbers.
/// Type for default half-precision floating-point numbers.
/// @see gtc_half_float
typedef half_t half;
#if(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF))
typedef lowp_hvec2 hvec2;
typedef lowp_hvec3 hvec3;
typedef lowp_hvec4 hvec4;
typedef lowp_hmat2 hmat2;
typedef lowp_hmat3 hmat3;
typedef lowp_hmat4 hmat4;
typedef lowp_hmat2x2 hmat2x2;
typedef lowp_hmat2x3 hmat2x3;
typedef lowp_hmat2x4 hmat2x4;
typedef lowp_hmat3x2 hmat3x2;
typedef lowp_hmat3x3 hmat3x3;
typedef lowp_hmat3x4 hmat3x4;
typedef lowp_hmat4x2 hmat4x2;
typedef lowp_hmat4x3 hmat4x3;
typedef lowp_hmat4x4 hmat4x4;
#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
typedef mediump_hvec2 hvec2;
typedef mediump_hvec3 hvec3;
typedef mediump_hvec4 hvec4;
typedef mediump_hmat2 hmat2;
typedef mediump_hmat3 hmat3;
typedef mediump_hmat4 hmat4;
typedef mediump_hmat2x2 hmat2x2;
typedef mediump_hmat2x3 hmat2x3;
typedef mediump_hmat2x4 hmat2x4;
typedef mediump_hmat3x2 hmat3x2;
typedef mediump_hmat3x3 hmat3x3;
typedef mediump_hmat3x4 hmat3x4;
typedef mediump_hmat4x2 hmat4x2;
typedef mediump_hmat4x3 hmat4x3;
typedef mediump_hmat4x4 hmat4x4;
#else //(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
//////////////////////////////////////////////
// Default half precision floating-point numbers.
/// Vector of 2 default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hvec2 hvec2;
/// Vector of 3 default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hvec3 hvec3;
/// Vector of 4 default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hvec4 hvec4;
/// 2 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat2x2 hmat2;
/// 3 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat3x3 hmat3;
/// 4 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat4x4 hmat4;
/// 2 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat2x2 hmat2x2;
/// 2 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat2x3 hmat2x3;
/// 2 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat2x4 hmat2x4;
/// 3 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat3x2 hmat3x2;
/// 3 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat3x3 hmat3x3;
/// 3 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat3x4 hmat3x4;
/// 4 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat4x2 hmat4x2;
/// 4 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat4x3 hmat4x3;
/// 4 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef highp_hmat4x4 hmat4x4;
#endif//GLM_PRECISION
/// Returns the absolute value of a half-precision floating-point value
/// @see gtc_half_float
half abs(half const & x);
/// Returns the absolute value of a half-precision floating-point two dimensional vector
/// @see gtc_half_float
hvec2 abs(hvec2 const & x);
/// Returns the absolute value of a half-precision floating-point three dimensional vector
/// @see gtc_half_float
hvec3 abs(hvec3 const & x);
/// Returns the absolute value of a half-precision floating-point four dimensional vector
/// @see gtc_half_float
hvec4 abs(hvec4 const & x);
/// Selects which vector each returned component comes
/// from. For a component of <a> that is false, the
/// corresponding component of x is returned. For a
/// component of a that is true, the corresponding
/// component of y is returned. Components of x and y that
/// are not selected are allowed to be invalid floating point
/// values and will have no effect on the results. Thus, this
/// provides different functionality than
/// genType mix(genType x, genType y, genType(a))
/// where a is a Boolean vector.
///
/// @see gtc_half_float
half mix(half const & x, half const & y, bool const & a);
/// @}
}// namespace glm
#include "half_float.inl"
#endif//GLM_GTC_half_float

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