mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 10:14:35 +00:00
commit
5100bd76dc
47
.gitignore
vendored
Normal file
47
.gitignore
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# CMake
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
*.cmake
|
||||
# ^ May need to add future .cmake files as exceptions
|
||||
|
||||
# Test logs
|
||||
Testing/*
|
||||
|
||||
# Test input
|
||||
test/gtc/*.dds
|
||||
|
||||
# Project Files
|
||||
*.cbp
|
||||
*.user
|
@ -1,10 +1,14 @@
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
|
||||
project(glm)
|
||||
enable_testing()
|
||||
set(GLM_VERSION "0.9.7")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
|
||||
@ -129,7 +133,6 @@ endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
#add_definitions(-S)
|
||||
#add_definitions(-s)
|
||||
add_definitions(-m64)
|
||||
add_definitions(-O2)
|
||||
|
||||
#add_definitions(-fprofile-arcs -ftest-coverage) gcov
|
||||
@ -141,6 +144,56 @@ include_directories("${PROJECT_SOURCE_DIR}/test/external")
|
||||
|
||||
add_subdirectory(glm)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(util)
|
||||
|
||||
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
||||
set(GLM_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm")
|
||||
install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/glmVersion.cmake"
|
||||
VERSION ${GLM_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
# build tree package config
|
||||
configure_file(
|
||||
cmake/glmBuildConfig.cmake.in
|
||||
glmConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# install tree package config
|
||||
configure_package_config_file(
|
||||
cmake/glmConfig.cmake.in
|
||||
${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake
|
||||
INSTALL_DESTINATION ${GLM_INSTALL_CONFIGDIR}
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/glmVersion.cmake"
|
||||
DESTINATION ${GLM_INSTALL_CONFIGDIR}
|
||||
)
|
||||
|
||||
if (NOT CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
add_library(glm INTERFACE)
|
||||
target_include_directories(glm INTERFACE
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
)
|
||||
install(TARGETS glm EXPORT glmTargets)
|
||||
|
||||
export(
|
||||
EXPORT glmTargets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/glmTargets.cmake"
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT glmTargets FILE glmTargets.cmake
|
||||
DESTINATION ${GLM_INSTALL_CONFIGDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
export(PACKAGE glm)
|
||||
|
227
cmake/CMakePackageConfigHelpers.cmake
Normal file
227
cmake/CMakePackageConfigHelpers.cmake
Normal file
@ -0,0 +1,227 @@
|
||||
# - CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE()
|
||||
#
|
||||
# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
|
||||
# [PATH_VARS <var1> <var2> ... <varN>]
|
||||
# [NO_SET_AND_CHECK_MACRO]
|
||||
# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
|
||||
#
|
||||
# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
|
||||
# CONFIGURE_FILE() command when creating the <Name>Config.cmake or <Name>-config.cmake
|
||||
# file for installing a project or library. It helps making the resulting package
|
||||
# relocatable by avoiding hardcoded paths in the installed Config.cmake file.
|
||||
#
|
||||
# In a FooConfig.cmake file there may be code like this to make the
|
||||
# install destinations know to the using project:
|
||||
# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
|
||||
# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
|
||||
# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
|
||||
# ...logic to determine installedPrefix from the own location...
|
||||
# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
|
||||
# All 4 options shown above are not sufficient, since the first 3 hardcode
|
||||
# the absolute directory locations, and the 4th case works only if the logic
|
||||
# to determine the installedPrefix is correct, and if CONFIG_INSTALL_DIR contains
|
||||
# a relative path, which in general cannot be guaranteed.
|
||||
# This has the effect that the resulting FooConfig.cmake file would work poorly
|
||||
# under Windows and OSX, where users are used to choose the install location
|
||||
# of a binary package at install time, independent from how CMAKE_INSTALL_PREFIX
|
||||
# was set at build/cmake time.
|
||||
#
|
||||
# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it makes the
|
||||
# resulting FooConfig.cmake file relocatable.
|
||||
# Usage:
|
||||
# 1. write a FooConfig.cmake.in file as you are used to
|
||||
# 2. insert a line containing only the string "@PACKAGE_INIT@"
|
||||
# 3. instead of SET(FOO_DIR "@SOME_INSTALL_DIR@"), use SET(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")
|
||||
# (this must be after the @PACKAGE_INIT@ line)
|
||||
# 4. instead of using the normal CONFIGURE_FILE(), use CONFIGURE_PACKAGE_CONFIG_FILE()
|
||||
#
|
||||
# The <input> and <output> arguments are the input and output file, the same way
|
||||
# as in CONFIGURE_FILE().
|
||||
#
|
||||
# The <path> given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake
|
||||
# file will be installed to. This can either be a relative or absolute path, both work.
|
||||
#
|
||||
# The variables <var1> to <varN> given as PATH_VARS are the variables which contain
|
||||
# install destinations. For each of them the macro will create a helper variable
|
||||
# PACKAGE_<var...>. These helper variables must be used
|
||||
# in the FooConfig.cmake.in file for setting the installed location. They are calculated
|
||||
# by CONFIGURE_PACKAGE_CONFIG_FILE() so that they are always relative to the
|
||||
# installed location of the package. This works both for relative and also for absolute locations.
|
||||
# For absolute locations it works only if the absolute location is a subdirectory
|
||||
# of CMAKE_INSTALL_PREFIX.
|
||||
#
|
||||
# By default configure_package_config_file() also generates two helper macros,
|
||||
# set_and_check() and check_required_components() into the FooConfig.cmake file.
|
||||
#
|
||||
# set_and_check() should be used instead of the normal set()
|
||||
# command for setting directories and file locations. Additionally to setting the
|
||||
# variable it also checks that the referenced file or directory actually exists
|
||||
# and fails with a FATAL_ERROR otherwise. This makes sure that the created
|
||||
# FooConfig.cmake file does not contain wrong references.
|
||||
# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the
|
||||
# FooConfig.cmake file.
|
||||
#
|
||||
# check_required_components(<package_name>) should be called at the end of the
|
||||
# FooConfig.cmake file if the package supports components.
|
||||
# This macro checks whether all requested, non-optional components have been found,
|
||||
# and if this is not the case, sets the Foo_FOUND variable to FALSE, so that the package
|
||||
# is considered to be not found.
|
||||
# It does that by testing the Foo_<Component>_FOUND variables for all requested
|
||||
# required components.
|
||||
# When using the NO_CHECK_REQUIRED_COMPONENTS option, this macro is not generated
|
||||
# into the FooConfig.cmake file.
|
||||
#
|
||||
# For an example see below the documentation for WRITE_BASIC_PACKAGE_VERSION_FILE().
|
||||
#
|
||||
#
|
||||
# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
|
||||
#
|
||||
# Writes a file for use as <package>ConfigVersion.cmake file to <filename>.
|
||||
# See the documentation of FIND_PACKAGE() for details on this.
|
||||
# filename is the output filename, it should be in the build tree.
|
||||
# major.minor.patch is the version number of the project to be installed
|
||||
# The COMPATIBILITY mode AnyNewerVersion means that the installed package version
|
||||
# will be considered compatible if it is newer or exactly the same as the requested version.
|
||||
# This mode should be used for packages which are fully backward compatible,
|
||||
# also across major versions.
|
||||
# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion
|
||||
# in that the major version number must be the same as requested, e.g. version 2.0 will
|
||||
# not be considered compatible if 1.0 is requested.
|
||||
# This mode should be used for packages which guarantee backward compatibility within the
|
||||
# same major version.
|
||||
# If ExactVersion is used, then the package is only considered compatible if the requested
|
||||
# version matches exactly its own version number (not considering the tweak version).
|
||||
# For example, version 1.2.3 of a package is only considered compatible to requested version 1.2.3.
|
||||
# This mode is for packages without compatibility guarantees.
|
||||
# If your project has more elaborated version matching rules, you will need to write your
|
||||
# own custom ConfigVersion.cmake file instead of using this macro.
|
||||
#
|
||||
# Internally, this macro executes configure_file() to create the resulting
|
||||
# version file. Depending on the COMPATIBLITY, either the file
|
||||
# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in
|
||||
# is used. Please note that these two files are internal to CMake and you should
|
||||
# not call configure_file() on them yourself, but they can be used as starting
|
||||
# point to create more sophisticted custom ConfigVersion.cmake files.
|
||||
#
|
||||
#
|
||||
# Example using both configure_package_config_file() and write_basic_package_version_file():
|
||||
# CMakeLists.txt:
|
||||
# set(INCLUDE_INSTALL_DIR include/ ... CACHE )
|
||||
# set(LIB_INSTALL_DIR lib/ ... CACHE )
|
||||
# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
|
||||
# ...
|
||||
# include(CMakePackageConfigHelpers)
|
||||
# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
|
||||
# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
|
||||
# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
|
||||
# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
|
||||
# VERSION 1.2.3
|
||||
# COMPATIBILITY SameMajorVersion )
|
||||
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
|
||||
# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
|
||||
#
|
||||
# With a FooConfig.cmake.in:
|
||||
# set(FOO_VERSION x.y.z)
|
||||
# ...
|
||||
# @PACKAGE_INIT@
|
||||
# ...
|
||||
# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
|
||||
#
|
||||
# check_required_components(Foo)
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2012 Alexander Neundorf <neundorf@kde.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
include(WriteBasicConfigVersionFile)
|
||||
|
||||
macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
|
||||
write_basic_config_version_file(${ARGN})
|
||||
endmacro()
|
||||
|
||||
|
||||
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
|
||||
set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
set(oneValueArgs INSTALL_DESTINATION )
|
||||
set(multiValueArgs PATH_VARS )
|
||||
|
||||
cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(CCF_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
if(NOT CCF_INSTALL_DESTINATION)
|
||||
message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
|
||||
endif()
|
||||
|
||||
if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
|
||||
set(absInstallDir "${CCF_INSTALL_DESTINATION}")
|
||||
else()
|
||||
set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
|
||||
endif()
|
||||
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
|
||||
|
||||
foreach(var ${CCF_PATH_VARS})
|
||||
if(NOT DEFINED ${var})
|
||||
message(FATAL_ERROR "Variable ${var} does not exist")
|
||||
else()
|
||||
if(IS_ABSOLUTE "${${var}}")
|
||||
string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
|
||||
PACKAGE_${var} "${${var}}")
|
||||
else()
|
||||
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(PACKAGE_INIT "
|
||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||||
get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
|
||||
")
|
||||
|
||||
if(NOT CCF_NO_SET_AND_CHECK_MACRO)
|
||||
set(PACKAGE_INIT "${PACKAGE_INIT}
|
||||
macro(set_and_check _var _file)
|
||||
set(\${_var} \"\${_file}\")
|
||||
if(NOT EXISTS \"\${_file}\")
|
||||
message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
|
||||
endif()
|
||||
endmacro()
|
||||
")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
set(PACKAGE_INIT "${PACKAGE_INIT}
|
||||
macro(check_required_components _NAME)
|
||||
foreach(comp \${\${_NAME}_FIND_COMPONENTS})
|
||||
if(NOT \${_NAME}_\${comp}_FOUND)
|
||||
if(\${_NAME}_FIND_REQUIRED_\${comp})
|
||||
set(\${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach(comp)
|
||||
endmacro()
|
||||
")
|
||||
endif()
|
||||
|
||||
set(PACKAGE_INIT "${PACKAGE_INIT}
|
||||
####################################################################################")
|
||||
|
||||
configure_file("${_inputFile}" "${_outputFile}" @ONLY)
|
||||
|
||||
endfunction()
|
6
cmake/glmBuildConfig.cmake.in
Normal file
6
cmake/glmBuildConfig.cmake.in
Normal file
@ -0,0 +1,6 @@
|
||||
set(GLM_VERSION "@GLM_VERSION@")
|
||||
set(GLM_INCLUDE_DIRS "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||
|
||||
if (NOT CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake")
|
||||
endif()
|
9
cmake/glmConfig.cmake.in
Normal file
9
cmake/glmConfig.cmake.in
Normal file
@ -0,0 +1,9 @@
|
||||
set(GLM_VERSION "@GLM_VERSION@")
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(GLM_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
|
||||
if (NOT CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake")
|
||||
endif()
|
BIN
doc/glm.docx
BIN
doc/glm.docx
Binary file not shown.
@ -4,6 +4,7 @@ file(GLOB ROOT_SOURCE *.cpp)
|
||||
file(GLOB ROOT_INLINE *.inl)
|
||||
file(GLOB ROOT_HEADER *.hpp)
|
||||
file(GLOB ROOT_TEXT ../*.txt)
|
||||
file(GLOB ROOT_MD ../*.md)
|
||||
file(GLOB ROOT_NAT ../util/glm.natvis)
|
||||
|
||||
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
|
||||
@ -18,7 +19,7 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
|
||||
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
|
||||
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
|
||||
|
||||
source_group("Text Files" FILES ${ROOT_TEXT})
|
||||
source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD})
|
||||
source_group("Core Files" FILES ${CORE_SOURCE})
|
||||
source_group("Core Files" FILES ${CORE_INLINE})
|
||||
source_group("Core Files" FILES ${CORE_HEADER})
|
||||
@ -32,7 +33,7 @@ source_group("GTX Files" FILES ${GTX_HEADER})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
if(GLM_TEST_ENABLE)
|
||||
add_executable(${NAME} ${ROOT_TEXT} ${ROOT_NAT}
|
||||
add_executable(${NAME} ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
|
@ -248,10 +248,8 @@ namespace detail
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
|
||||
uint32* PointerMSB = (reinterpret_cast<uint32*>(&Value64) + 1);
|
||||
msb = *PointerMSB;
|
||||
uint32* PointerLSB = (reinterpret_cast<uint32*>(&Value64) + 0);
|
||||
lsb = *PointerLSB;
|
||||
msb = static_cast<uint>(Value64 >> static_cast<uint64>(32));
|
||||
lsb = static_cast<uint>(Value64);
|
||||
}
|
||||
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
@ -270,10 +268,8 @@ namespace detail
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
|
||||
int32* PointerMSB = (reinterpret_cast<int32*>(&Value64) + 1);
|
||||
msb = *PointerMSB;
|
||||
int32* PointerLSB = (reinterpret_cast<int32*>(&Value64));
|
||||
lsb = *PointerLSB;
|
||||
msb = static_cast<int>(Value64 >> static_cast<int64>(32));
|
||||
lsb = static_cast<int>(Value64);
|
||||
}
|
||||
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
|
@ -38,82 +38,178 @@ namespace glm
|
||||
{
|
||||
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
||||
{
|
||||
u16vec2 const Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||
return reinterpret_cast<uint const &>(Topack);
|
||||
union
|
||||
{
|
||||
u16 in[2];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
u16vec2 result(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint p)
|
||||
{
|
||||
vec2 Unpack(reinterpret_cast<u16vec2 const &>(p));
|
||||
return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
u16 out[2];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return vec2(u.out[0], u.out[1]) * 1.5259021896696421759365224689097e-5f;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
||||
{
|
||||
i16vec2 const Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
||||
return reinterpret_cast<uint const &>(Topack);
|
||||
union
|
||||
{
|
||||
i16 in[2];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
i16vec2 result(round(clamp(v, -1.0f, 1.0f) * 32767.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint p)
|
||||
{
|
||||
vec2 const Unpack(reinterpret_cast<i16vec2 const &>(p));
|
||||
return clamp(
|
||||
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
||||
-1.0f, 1.0f);
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
i16 out[2];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return clamp(vec2(u.out[0], u.out[1]) * 3.0518509475997192297128208258309e-5f, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v)
|
||||
{
|
||||
u8vec4 const Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
||||
return reinterpret_cast<uint const &>(Topack);
|
||||
union
|
||||
{
|
||||
u8 in[4];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
u8vec4 result(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
u.in[2] = result[2];
|
||||
u.in[3] = result[3];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint p)
|
||||
{
|
||||
vec4 const Unpack(reinterpret_cast<u8vec4 const&>(p));
|
||||
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
u8 out[4];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return vec4(u.out[0], u.out[1], u.out[2], u.out[3]) * 0.0039215686274509803921568627451f;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
|
||||
{
|
||||
i8vec4 const Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
|
||||
return reinterpret_cast<uint const &>(Topack);
|
||||
union
|
||||
{
|
||||
i8 in[4];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
i8vec4 result(round(clamp(v, -1.0f, 1.0f) * 127.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
u.in[2] = result[2];
|
||||
u.in[3] = result[3];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint p)
|
||||
{
|
||||
vec4 const Unpack(reinterpret_cast<i8vec4 const &>(p));
|
||||
return clamp(
|
||||
Unpack * 0.0078740157480315f, // 1.0f / 127.0f
|
||||
-1.0f, 1.0f);
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
i8 out[4];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return clamp(vec4(u.out[0], u.out[1], u.out[2], u.out[3]) * 0.0078740157480315f, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v)
|
||||
{
|
||||
return reinterpret_cast<double const &>(v);
|
||||
union
|
||||
{
|
||||
uint in[2];
|
||||
double out;
|
||||
} u;
|
||||
|
||||
u.in[0] = v[0];
|
||||
u.in[1] = v[1];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double v)
|
||||
{
|
||||
return reinterpret_cast<uvec2 const &>(v);
|
||||
union
|
||||
{
|
||||
double in;
|
||||
uint out[2];
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return uvec2(u.out[0], u.out[1]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
|
||||
{
|
||||
i16vec2 const Unpack(
|
||||
detail::toFloat16(v.x),
|
||||
detail::toFloat16(v.y));
|
||||
union
|
||||
{
|
||||
i16 in[2];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
return reinterpret_cast<uint const &>(Unpack);
|
||||
u.in[0] = detail::toFloat16(v.x);
|
||||
u.in[1] = detail::toFloat16(v.y);
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint v)
|
||||
{
|
||||
i16vec2 const Unpack(reinterpret_cast<i16vec2 const &>(v));
|
||||
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
i16 out[2];
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return vec2(
|
||||
detail::toFloat32(Unpack.x),
|
||||
detail::toFloat32(Unpack.y));
|
||||
detail::toFloat32(u.out[0]),
|
||||
detail::toFloat32(u.out[1]));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -117,7 +117,7 @@
|
||||
// Compiler
|
||||
|
||||
// User defines: GLM_FORCE_COMPILER_UNKNOWN
|
||||
// TODO ? __llvm__
|
||||
// TODO ? __llvm__
|
||||
|
||||
#define GLM_COMPILER_UNKNOWN 0x00000000
|
||||
|
||||
@ -128,6 +128,7 @@
|
||||
#define GLM_COMPILER_INTEL13 0x00100030
|
||||
#define GLM_COMPILER_INTEL14 0x00100040
|
||||
#define GLM_COMPILER_INTEL15 0x00100050
|
||||
#define GLM_COMPILER_INTEL16 0x00100060
|
||||
|
||||
// Visual C++ defines
|
||||
#define GLM_COMPILER_VC 0x01000000
|
||||
@ -145,6 +146,9 @@
|
||||
#define GLM_COMPILER_GCC48 0x020000F0
|
||||
#define GLM_COMPILER_GCC49 0x02000100
|
||||
#define GLM_COMPILER_GCC50 0x02000200
|
||||
#define GLM_COMPILER_GCC51 0x02000300
|
||||
#define GLM_COMPILER_GCC52 0x02000400
|
||||
#define GLM_COMPILER_GCC53 0x02000500
|
||||
|
||||
// CUDA
|
||||
#define GLM_COMPILER_CUDA 0x10000000
|
||||
@ -154,6 +158,8 @@
|
||||
#define GLM_COMPILER_CUDA50 0x10000070
|
||||
#define GLM_COMPILER_CUDA60 0x10000080
|
||||
#define GLM_COMPILER_CUDA65 0x10000090
|
||||
#define GLM_COMPILER_CUDA70 0x100000A0
|
||||
#define GLM_COMPILER_CUDA75 0x100000B0
|
||||
|
||||
// LLVM
|
||||
#define GLM_COMPILER_LLVM 0x20000000
|
||||
@ -161,6 +167,10 @@
|
||||
#define GLM_COMPILER_LLVM33 0x20000040
|
||||
#define GLM_COMPILER_LLVM34 0x20000050
|
||||
#define GLM_COMPILER_LLVM35 0x20000060
|
||||
#define GLM_COMPILER_LLVM36 0x20000070
|
||||
#define GLM_COMPILER_LLVM37 0x20000080
|
||||
#define GLM_COMPILER_LLVM38 0x20000090
|
||||
#define GLM_COMPILER_LLVM39 0x200000A0
|
||||
|
||||
// Apple Clang
|
||||
#define GLM_COMPILER_APPLE_CLANG 0x40000000
|
||||
@ -170,6 +180,7 @@
|
||||
#define GLM_COMPILER_APPLE_CLANG50 0x40000040
|
||||
#define GLM_COMPILER_APPLE_CLANG51 0x40000050
|
||||
#define GLM_COMPILER_APPLE_CLANG60 0x40000060
|
||||
#define GLM_COMPILER_APPLE_CLANG61 0x40000070
|
||||
|
||||
// Build model
|
||||
#define GLM_MODEL_32 0x00000010
|
||||
@ -190,6 +201,8 @@
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL14
|
||||
# elif __INTEL_COMPILER >= 1500
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL15
|
||||
# elif __INTEL_COMPILER >= 1600
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL16
|
||||
# else
|
||||
# define GLM_COMPILER GLM_COMPILER_INTEL
|
||||
# endif
|
||||
@ -197,7 +210,7 @@
|
||||
// CUDA
|
||||
#elif defined(__CUDACC__)
|
||||
# if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
|
||||
# include <cuda.h> // make sure version is defined since nvcc does not define it itself!
|
||||
# include <cuda.h> // make sure version is defined since nvcc does not define it itself!
|
||||
# endif
|
||||
# if CUDA_VERSION < 3000
|
||||
# error "GLM requires CUDA 3.0 or higher"
|
||||
@ -234,8 +247,14 @@
|
||||
# define GLM_COMPILER GLM_COMPILER_APPLE_CLANG50
|
||||
# elif __clang_major__ == 5 && __clang_minor__ == 1
|
||||
# define GLM_COMPILER GLM_COMPILER_APPLE_CLANG51
|
||||
# elif __clang_major__ >= 6
|
||||
# elif __clang_major__ == 6 && __clang_minor__ == 0
|
||||
# define GLM_COMPILER GLM_COMPILER_APPLE_CLANG60
|
||||
# elif __clang_major__ == 6 && __clang_minor__ >= 1
|
||||
# define GLM_COMPILER GLM_COMPILER_APPLE_CLANG61
|
||||
# elif __clang_major__ >= 7
|
||||
# define GLM_COMPILER GLM_COMPILER_APPLE_CLANG61
|
||||
# else
|
||||
# define GLM_COMPILER GLM_COMPILER_APPLE_CLANG
|
||||
# endif
|
||||
# else
|
||||
# if __clang_major__ == 3 && __clang_minor__ == 0
|
||||
@ -250,12 +269,22 @@
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM34
|
||||
# elif __clang_major__ == 3 && __clang_minor__ == 5
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM35
|
||||
# elif __clang_major__ == 3 && __clang_minor__ == 6
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM36
|
||||
# elif __clang_major__ == 3 && __clang_minor__ == 7
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM37
|
||||
# elif __clang_major__ == 3 && __clang_minor__ == 8
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM38
|
||||
# elif __clang_major__ == 3 && __clang_minor__ >= 9
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM39
|
||||
# elif __clang_major__ >= 4
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM39
|
||||
# else
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM35
|
||||
# define GLM_COMPILER GLM_COMPILER_LLVM
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// G++
|
||||
// G++
|
||||
#elif defined(__GNUC__) || defined(__MINGW32__)
|
||||
# if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC42)
|
||||
@ -273,8 +302,14 @@
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC48)
|
||||
# elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC49)
|
||||
# elif (__GNUC__ > 4 )
|
||||
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 0)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC50)
|
||||
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 1)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC51)
|
||||
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ == 2)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC52)
|
||||
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC53)
|
||||
# else
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC)
|
||||
# endif
|
||||
@ -502,12 +537,22 @@
|
||||
|
||||
#if GLM_PLATFORM == GLM_PLATFORM_ANDROID
|
||||
# define GLM_HAS_CXX11_STL 0
|
||||
#elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_INTEL)
|
||||
# define GLM_HAS_CXX11_STL __has_include("__config")
|
||||
#elif GLM_COMPILER & (GLM_COMPILER_LLVM | GLM_COMPILER_APPLE_CLANG)
|
||||
# if __has_include(<__config>) // libc++
|
||||
# include <__config>
|
||||
//# else // libstdc++
|
||||
//# include <bits/c++config.h>
|
||||
# endif
|
||||
# if defined(_LIBCPP_VERSION)// || defined(__GLIBCXX__)
|
||||
# define GLM_HAS_CXX11_STL 1
|
||||
# else
|
||||
# define GLM_HAS_CXX11_STL 0
|
||||
# endif
|
||||
#else
|
||||
# define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && \
|
||||
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)))
|
||||
#endif
|
||||
|
||||
// N1720
|
||||
@ -624,7 +669,7 @@
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
|
||||
#endif
|
||||
|
||||
//
|
||||
//
|
||||
#if GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_ASSIGNABLE 1
|
||||
#else
|
||||
@ -632,11 +677,10 @@
|
||||
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
|
||||
#endif
|
||||
|
||||
//
|
||||
#define GLM_HAS_TRIVIAL_QUERIES 0//( \
|
||||
//((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
|
||||
//
|
||||
#define GLM_HAS_TRIVIAL_QUERIES 0
|
||||
|
||||
//
|
||||
//
|
||||
#if GLM_LANG & GLM_LANG_CXX11_FLAG
|
||||
# define GLM_HAS_MAKE_SIGNED 1
|
||||
#else
|
||||
@ -644,7 +688,7 @@
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
|
||||
#endif
|
||||
|
||||
//
|
||||
//
|
||||
#if GLM_ARCH == GLM_ARCH_PURE
|
||||
# define GLM_HAS_BITSCAN_WINDOWS 0
|
||||
#else
|
||||
@ -653,7 +697,7 @@
|
||||
#endif
|
||||
|
||||
// OpenMP
|
||||
#ifdef _OPENMP
|
||||
#ifdef _OPENMP
|
||||
# if GLM_COMPILER & GLM_COMPILER_GCC
|
||||
# if GLM_COMPILER >= GLM_COMPILER_GCC47
|
||||
# define GLM_HAS_OPENMP 31
|
||||
@ -675,7 +719,7 @@
|
||||
#define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Platform
|
||||
// Platform
|
||||
|
||||
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
|
||||
|
||||
@ -725,7 +769,7 @@
|
||||
# define GLM_ARCH (GLM_ARCH_PURE)
|
||||
# endif
|
||||
#elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
|
||||
# if defined(__AVX2__)
|
||||
# if defined(__AVX2__)
|
||||
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
|
||||
# elif defined(__AVX__)
|
||||
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
|
||||
@ -881,8 +925,16 @@
|
||||
|
||||
#if GLM_HAS_CONSTEXPR
|
||||
# define GLM_CONSTEXPR constexpr
|
||||
# define GLM_RELAXED_CONSTEXPR constexpr
|
||||
#else
|
||||
# define GLM_CONSTEXPR
|
||||
# define GLM_RELAXED_CONSTEXPR const
|
||||
#endif
|
||||
|
||||
#ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
# define GLM_EXPLICIT explicit
|
||||
#else
|
||||
# define GLM_EXPLICIT
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -54,11 +54,18 @@ namespace glm
|
||||
template <typename U, precision Q>
|
||||
friend tvec2<U, Q> operator/(tvec2<U, Q> const & v, tmat2x2<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 2;
|
||||
static GLM_RELAXED_CONSTEXPR length_t columns = 2;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
col_type value[2];
|
||||
/// @endcond
|
||||
|
||||
|
||||
public:
|
||||
//////////////////////////////////////
|
||||
// Constructors
|
||||
@ -91,13 +98,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat2x2(tmat2x2<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x2<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);
|
||||
@ -130,23 +132,23 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & v);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator+=(tmat2x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator-=(tmat2x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator*=(tmat2x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator/=(tmat2x2<U, P> const & m);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -191,10 +193,10 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat3x2<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat4x2<T, P> const & m2);
|
||||
|
||||
@ -214,7 +216,7 @@ namespace glm
|
||||
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>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m);
|
||||
} //namespace glm
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -50,11 +50,18 @@ namespace glm
|
||||
typedef tmat3x2<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 2;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
/// @cond DETAIL
|
||||
col_type value[2];
|
||||
/// @endcond
|
||||
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat2x3();
|
||||
@ -78,7 +85,7 @@ namespace glm
|
||||
GLM_FUNC_DECL tmat2x3(
|
||||
X1 const & x1, Y1 const & y1, Z1 const & z1,
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2);
|
||||
|
||||
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_DECL tmat2x3(
|
||||
tvec3<U, P> const & v1,
|
||||
@ -87,13 +94,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversion
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat2x3(tmat2x3<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x3<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T, P> const & x);
|
||||
@ -126,19 +128,19 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator=(tmat2x3<T, P> const & m);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator=(tmat2x3<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator+=(tmat2x3<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator-=(tmat2x3<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -181,7 +183,7 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat3x2<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat4x2<T, P> const & m2);
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -50,11 +50,18 @@ namespace glm
|
||||
typedef tmat4x2<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 2;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
col_type value[2];
|
||||
/// @endcond
|
||||
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat2x4();
|
||||
@ -68,7 +75,7 @@ namespace glm
|
||||
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 tmat2x4(
|
||||
col_type const & v0,
|
||||
col_type const & v0,
|
||||
col_type const & v1);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -88,13 +95,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat2x4(tmat2x4<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x4<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x);
|
||||
@ -127,19 +129,19 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator=(tmat2x4<T, P> const & m);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator=(tmat2x4<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator+=(tmat2x4<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator-=(tmat2x4<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -179,7 +181,7 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat4x2<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat2x2<T, P> const & m2);
|
||||
|
||||
@ -189,7 +191,7 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T s);
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator/(T s, tmat2x4<T, P> const & m);
|
||||
|
||||
// Unary constant operators
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -50,11 +50,18 @@ namespace glm
|
||||
typedef tmat2x3<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 3;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 2;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
col_type value[3];
|
||||
/// @endcond
|
||||
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat3x2();
|
||||
@ -84,7 +91,7 @@ namespace glm
|
||||
X1 const & x1, Y1 const & y1,
|
||||
X2 const & x2, Y2 const & y2,
|
||||
X3 const & x3, Y3 const & y3);
|
||||
|
||||
|
||||
template <typename V1, typename V2, typename V3>
|
||||
GLM_FUNC_DECL tmat3x2(
|
||||
tvec2<V1, P> const & v1,
|
||||
@ -94,13 +101,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat3x2(tmat3x2<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x2<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T, P> const & x);
|
||||
@ -133,19 +135,19 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator=(tmat3x2<T, P> const & m);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator=(tmat3x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator+=(tmat3x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator-=(tmat3x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -184,10 +186,10 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat2x3<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat3x3<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat4x3<T, P> const & m2);
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -49,6 +49,13 @@ namespace glm
|
||||
typedef tmat3x3<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 3;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
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>
|
||||
@ -88,7 +95,7 @@ namespace glm
|
||||
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);
|
||||
|
||||
|
||||
template <typename V1, typename V2, typename V3>
|
||||
GLM_FUNC_DECL tmat3x3(
|
||||
tvec3<V1, P> const & v1,
|
||||
@ -98,13 +105,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat3x3(tmat3x3<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x3<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x);
|
||||
@ -198,10 +200,10 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat2x3<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat4x3<T, P> const & m2);
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -50,6 +50,13 @@ namespace glm
|
||||
typedef tmat4x3<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 3;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
col_type value[3];
|
||||
@ -83,7 +90,7 @@ namespace glm
|
||||
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);
|
||||
|
||||
|
||||
template <typename V1, typename V2, typename V3>
|
||||
GLM_FUNC_DECL tmat3x4(
|
||||
tvec4<V1, P> const & v1,
|
||||
@ -93,13 +100,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversion
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat3x4(tmat3x4<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x4<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T, P> const & x);
|
||||
@ -132,19 +134,19 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator=(tmat3x4<T, P> const & m);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator=(tmat3x4<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator+=(tmat3x4<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-=(tmat3x4<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -178,15 +180,15 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
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>
|
||||
template <typename T, precision P>
|
||||
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>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat4x3<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat2x3<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat3x3<T, P> const & m2);
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -50,6 +50,13 @@ namespace glm
|
||||
typedef tmat2x4<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 2;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
col_type value[4];
|
||||
@ -70,7 +77,7 @@ namespace glm
|
||||
T const & x2, T const & y2,
|
||||
T const & x3, T const & y3);
|
||||
GLM_FUNC_DECL tmat4x2(
|
||||
col_type const & v0,
|
||||
col_type const & v0,
|
||||
col_type const & v1,
|
||||
col_type const & v2,
|
||||
col_type const & v3);
|
||||
@ -99,13 +106,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat4x2(tmat4x2<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x2<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);
|
||||
@ -138,19 +140,19 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator=(tmat4x2<T, P> const & m);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator=(tmat4x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator+=(tmat4x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator-=(tmat4x2<U, P> const & m);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -189,10 +191,10 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat2x4<T, P> const & m2);
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -50,8 +50,15 @@ namespace glm
|
||||
typedef tmat3x4<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
private:
|
||||
// Data
|
||||
// Data
|
||||
col_type value[4];
|
||||
|
||||
public:
|
||||
@ -87,7 +94,7 @@ namespace glm
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2,
|
||||
X3 const & x3, Y3 const & y3, Z3 const & z3,
|
||||
X4 const & x4, Y4 const & y4, Z4 const & z4);
|
||||
|
||||
|
||||
template <typename V1, typename V2, typename V3, typename V4>
|
||||
GLM_FUNC_DECL tmat4x3(
|
||||
tvec3<V1, P> const & v1,
|
||||
@ -98,13 +105,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat4x3(tmat4x3<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x3<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T, P> const & x);
|
||||
@ -191,7 +193,7 @@ namespace glm
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -49,6 +49,13 @@ namespace glm
|
||||
typedef tmat4x4<T, P> transpose_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
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>
|
||||
@ -103,13 +110,8 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat4x4(tmat4x4<U, Q> const & m);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x4<U, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);
|
||||
@ -177,13 +179,13 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+(T const & s, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator-(tmat4x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator-(T const & s, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -55,6 +55,11 @@ namespace glm
|
||||
typedef tvec1<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 1;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@ -120,7 +125,7 @@ namespace glm
|
||||
|
||||
//////////////////////////////////////
|
||||
// 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>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec2<U, Q> const & v);
|
||||
@ -131,15 +136,9 @@ namespace glm
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec1<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec1(tvec1<U, Q> const & v);
|
||||
# endif
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec1<U, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
@ -157,23 +156,23 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<T, P> const & v);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator+=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator+=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator-=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator-=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator*=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator*=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator/=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator/=(tvec1<U, P> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -187,29 +186,29 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Unary bit operators
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator%=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator%=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator&=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator&=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator|=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator|=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator^=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator^=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator<<=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator<<=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator>>=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator>>=(tvec1<U, P> const & v);
|
||||
};
|
||||
|
||||
@ -313,7 +312,7 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec1<T, P> operator~(tvec1<T, P> const & v);
|
||||
}//namespace glm
|
||||
|
||||
|
@ -55,6 +55,11 @@ namespace glm
|
||||
typedef tvec2<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 2;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@ -139,15 +144,9 @@ namespace glm
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec2(tvec2<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
|
||||
# endif
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec2<U, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
@ -47,7 +47,7 @@ namespace glm
|
||||
{
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tvec3
|
||||
{
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// Implementation detail
|
||||
|
||||
@ -55,6 +55,11 @@ namespace glm
|
||||
typedef tvec3<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 3;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@ -149,15 +154,9 @@ namespace glm
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec3(tvec3<U, Q> const & v);
|
||||
# endif
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec3<U, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
@ -109,6 +109,11 @@ namespace detail
|
||||
typedef tvec4<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@ -224,16 +229,10 @@ namespace detail
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec4(tvec4<U, Q> const & v);
|
||||
# endif
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tvec4(tvec4<U, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
@ -92,7 +92,7 @@ namespace glm
|
||||
///
|
||||
/// @param m Input matrix multiplied by this rotation matrix.
|
||||
/// @param angle Rotation angle expressed in radians.
|
||||
/// @param axis Rotation axis, recommanded to be normalized.
|
||||
/// @param axis Rotation axis, recommended to be normalized.
|
||||
/// @tparam T Value type used to build the matrix. Supported: half, float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - rotate(tmat4x4<T, P> const & m, T angle, T x, T y, T z)
|
||||
@ -173,7 +173,7 @@ namespace glm
|
||||
|
||||
/// Creates a matrix for a symetric perspective-view frustum based on the default handedness.
|
||||
///
|
||||
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
|
||||
/// @param fovy Specifies the field of view angle in the y direction. Expressed in radians.
|
||||
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
|
||||
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
|
||||
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
|
||||
|
@ -65,6 +65,11 @@ namespace glm
|
||||
typedef tquat<T, P> type;
|
||||
typedef T value_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
public:
|
||||
T x, y, z, w;
|
||||
|
||||
@ -103,24 +108,19 @@ namespace glm
|
||||
GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertions
|
||||
// Conversions
|
||||
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(tquat<U, Q> const & q);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tquat(tquat<U, Q> const & q);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tquat(tquat<U, Q> const & q);
|
||||
# endif
|
||||
|
||||
// explicit conversion operators
|
||||
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
|
||||
GLM_FUNC_DECL explicit operator tmat4x4<T, P>();
|
||||
# endif
|
||||
|
||||
|
||||
/// Create a quaternion from two normalized axis
|
||||
///
|
||||
///
|
||||
/// @param u A first normalized axis
|
||||
/// @param v A second normalized axis
|
||||
/// @see gtc_quaternion
|
||||
|
@ -84,6 +84,7 @@ namespace glm
|
||||
template <typename T, precision P> GLM_FUNC_QUALIFIER tvec4<T, P> atan2(const tvec4<T, P>& x, const tvec4<T, P>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)
|
||||
|
||||
template <typename genType> GLM_FUNC_DECL bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_DECL tvec1<bool, P> isfinite(const tvec1<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_DECL tvec2<bool, P> isfinite(const tvec2<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_DECL tvec3<bool, P> isfinite(const tvec3<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
template <typename T, precision P> GLM_FUNC_DECL tvec4<bool, P> isfinite(const tvec4<T, P>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)
|
||||
|
@ -46,10 +46,21 @@ namespace glm
|
||||
# elif GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID
|
||||
return _isfinite(x) != 0;
|
||||
# else
|
||||
return x >= std::numeric_limits<genType>::min() && x <= std::numeric_limits<genType>::max();
|
||||
if (std::numeric_limits<genType>::is_integer || std::denorm_absent == std::numeric_limits<genType>::has_denorm)
|
||||
return std::numeric_limits<genType>::min() <= x && std::numeric_limits<genType>::max() >= x;
|
||||
else
|
||||
return -std::numeric_limits<genType>::max() <= x && std::numeric_limits<genType>::max() >= x;
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<bool, P> isfinite(
|
||||
tvec1<T, P> const & x)
|
||||
{
|
||||
return tvec1<bool, P>(
|
||||
isfinite(x.x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<bool, P> isfinite(
|
||||
tvec2<T, P> const & x)
|
||||
|
@ -15,7 +15,7 @@
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -63,10 +63,15 @@ namespace glm
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef glm::tquat<T, P> part_type;
|
||||
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 8;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = P;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
public:
|
||||
glm::tquat<T, P> real, dual;
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// Component accesses
|
||||
|
||||
@ -105,17 +110,12 @@ namespace glm
|
||||
//////////////////////////////////////////////////////////////
|
||||
// tdualquat conversions
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tdualquat(tdualquat<U, Q> const & q);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tdualquat(tdualquat<U, Q> const & q);
|
||||
# endif
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tdualquat<U, Q> const & q);
|
||||
|
||||
GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
|
||||
GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
|
||||
|
||||
|
||||
// Operators
|
||||
GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m);
|
||||
|
||||
@ -126,51 +126,51 @@ namespace glm
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s);
|
||||
};
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator- (
|
||||
tquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator+ (
|
||||
tdualquat<T, P> const & q,
|
||||
tdualquat<T, P> const & p);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator* (
|
||||
tdualquat<T, P> const & q,
|
||||
tdualquat<T, P> const & p);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator* (
|
||||
tquat<T, P> const & q,
|
||||
tvec3<T, P> const & v);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator* (
|
||||
tvec3<T, P> const & v,
|
||||
tquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator* (
|
||||
tquat<T, P> const & q,
|
||||
tvec4<T, P> const & v);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator* (
|
||||
tvec4<T, P> const & v,
|
||||
tquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator* (
|
||||
tdualquat<T, P> const & q,
|
||||
T const & s);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator* (
|
||||
T const & s,
|
||||
tdualquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator/ (
|
||||
tdualquat<T, P> const & q,
|
||||
@ -227,17 +227,17 @@ namespace glm
|
||||
GLM_FUNC_DECL tdualquat<T, P> dualquat_cast(
|
||||
tmat3x4<T, P> const & x);
|
||||
|
||||
|
||||
|
||||
/// Dual-quaternion of low single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, lowp> lowp_dualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of medium single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, mediump> mediump_dualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of high single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
@ -248,40 +248,40 @@ namespace glm
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, lowp> lowp_fdualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of medium single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, mediump> mediump_fdualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of high single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, highp> highp_fdualquat;
|
||||
|
||||
|
||||
|
||||
|
||||
/// Dual-quaternion of low double-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<double, lowp> lowp_ddualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of medium double-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<double, mediump> mediump_ddualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of high double-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<double, highp> highp_ddualquat;
|
||||
|
||||
|
||||
|
||||
#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
|
||||
/// Dual-quaternion of floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef highp_fdualquat dualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
@ -298,7 +298,7 @@ namespace glm
|
||||
#else
|
||||
# error "GLM error: multiple default precision requested for single-precision floating-point types"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
|
||||
/// Dual-quaternion of default double-precision floating-point numbers.
|
||||
|
@ -114,6 +114,14 @@ namespace glm
|
||||
T const & angleZ,
|
||||
T const & angleY);
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * Z).
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL tmat4x4<T, defaultp> eulerAngleXYZ(
|
||||
T const & t1,
|
||||
T const & t2,
|
||||
T const & t3);
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
@ -121,7 +129,7 @@ namespace glm
|
||||
T const & yaw,
|
||||
T const & pitch,
|
||||
T const & roll);
|
||||
|
||||
|
||||
/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
@ -150,6 +158,14 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> orientate4(tvec3<T, P> const & angles);
|
||||
|
||||
/// Extracts the (X * Y * Z) Euler angles from the rotation matrix M
|
||||
/// @see gtx_euler_angles
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4<T, defaultp> & M,
|
||||
T & t1,
|
||||
T & t2,
|
||||
T & t3);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "compatibility.hpp" // glm::atan2
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
@ -157,7 +159,42 @@ namespace glm
|
||||
{
|
||||
return eulerAngleZ(angleZ) * eulerAngleY(angleY);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> eulerAngleXYZ
|
||||
(
|
||||
T const & t1,
|
||||
T const & t2,
|
||||
T const & t3
|
||||
)
|
||||
{
|
||||
T c1 = glm::cos(-t1);
|
||||
T c2 = glm::cos(-t2);
|
||||
T c3 = glm::cos(-t3);
|
||||
T s1 = glm::sin(-t1);
|
||||
T s2 = glm::sin(-t2);
|
||||
T s3 = glm::sin(-t3);
|
||||
|
||||
tmat4x4<T, defaultp> Result;
|
||||
Result[0][0] = c2 * c3;
|
||||
Result[0][1] =-c1 * s3 + s1 * s2 * c3;
|
||||
Result[0][2] = s1 * s3 + c1 * s2 * c3;
|
||||
Result[0][3] = static_cast<T>(0);
|
||||
Result[1][0] = c2 * s3;
|
||||
Result[1][1] = c1 * c3 + s1 * s2 * s3;
|
||||
Result[1][2] =-s1 * c3 + c1 * s2 * s3;
|
||||
Result[1][3] = static_cast<T>(0);
|
||||
Result[2][0] =-s2;
|
||||
Result[2][1] = s1 * c2;
|
||||
Result[2][2] = c1 * c2;
|
||||
Result[2][3] = static_cast<T>(0);
|
||||
Result[3][0] = static_cast<T>(0);
|
||||
Result[3][1] = static_cast<T>(0);
|
||||
Result[3][2] = static_cast<T>(0);
|
||||
Result[3][3] = static_cast<T>(1);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> eulerAngleYXZ
|
||||
(
|
||||
@ -284,4 +321,21 @@ namespace glm
|
||||
{
|
||||
return yawPitchRoll(angles.z, angles.x, angles.y);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL void extractEulerAngleXYZ(tmat4x4<T, defaultp> & M,
|
||||
T & t1,
|
||||
T & t2,
|
||||
T & t3)
|
||||
{
|
||||
float T1 = glm::atan2<T, defaultp>(M[2][1], M[2][2]);
|
||||
float C2 = glm::sqrt(M[0][0]*M[0][0] + M[1][0]*M[1][0]);
|
||||
float T2 = glm::atan2<T, defaultp>(-M[2][0], C2);
|
||||
float S1 = glm::sin(T1);
|
||||
float C1 = glm::cos(T1);
|
||||
float T3 = glm::atan2<T, defaultp>(S1*M[0][2] - C1*M[0][1], C1*M[1][1] - S1*M[1][2 ]);
|
||||
t1 = -T1;
|
||||
t2 = -T2;
|
||||
t3 = -T3;
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -33,6 +33,16 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> taylorCos(vecType<T, P> const & x)
|
||||
{
|
||||
return static_cast<T>(1)
|
||||
- (x * x) / 2.f
|
||||
+ (x * x * x * x) / 24.f
|
||||
- (x * x * x * x * x * x) / 720.f
|
||||
+ (x * x * x * x * x * x * x * x) / 40320.f;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T cos_52s(T x)
|
||||
{
|
||||
@ -66,11 +76,11 @@ namespace detail
|
||||
{
|
||||
T const angle(wrapAngle<T>(x));
|
||||
|
||||
if(angle<half_pi<T>())
|
||||
if(angle < half_pi<T>())
|
||||
return detail::cos_52s(angle);
|
||||
if(angle<pi<T>())
|
||||
if(angle < pi<T>())
|
||||
return -detail::cos_52s(pi<T>() - angle);
|
||||
if(angle<(T(3) * half_pi<T>()))
|
||||
if(angle < (T(3) * half_pi<T>()))
|
||||
return -detail::cos_52s(angle - pi<T>());
|
||||
|
||||
return detail::cos_52s(two_pi<T>() - angle);
|
||||
|
@ -41,6 +41,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !GLM_HAS_CXX11_STL
|
||||
# error "GLM_GTX_hash requires C++11 standard library support"
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "../vec2.hpp"
|
||||
|
@ -55,7 +55,7 @@ namespace glm
|
||||
/// @addtogroup gtx_intersect
|
||||
/// @{
|
||||
|
||||
//! Compute the intersection of a ray and a triangle.
|
||||
//! Compute the intersection of a ray and a plane.
|
||||
//! Ray direction and plane normal must be unit length.
|
||||
//! From GLM_GTX_intersect extension.
|
||||
template <typename genType>
|
||||
|
@ -220,6 +220,12 @@ namespace glm
|
||||
std::pair<tmat4x4<T,P> const,
|
||||
tmat4x4<T,P> const> const &);
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_DECL std::basic_ostream<CTy,CTr> & operator<<(
|
||||
std::basic_ostream<CTy,CTr> &,
|
||||
std::pair<tmat4x4<T,P>,
|
||||
tmat4x4<T,P> > const &);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
|
@ -645,4 +645,12 @@ namespace io
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename CTy, typename CTr, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(
|
||||
std::basic_ostream<CTy,CTr> & os,
|
||||
std::pair<tmat4x4<T,P>, tmat4x4<T,P> > const& a)
|
||||
{
|
||||
return operator<<(os, static_cast<std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const&>(a));
|
||||
}
|
||||
}//namespace glm
|
||||
|
@ -67,14 +67,14 @@ namespace glm
|
||||
GLM_FUNC_DECL typename genType::value_type length2(
|
||||
genType const & x);
|
||||
|
||||
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
||||
//! Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
|
||||
//! From GLM_GTX_norm extension.
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL T distance2(
|
||||
T const & p0,
|
||||
T const & p1);
|
||||
|
||||
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
|
||||
//! Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
|
||||
//! From GLM_GTX_norm extension.
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type distance2(
|
||||
|
@ -121,33 +121,28 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> pow
|
||||
(
|
||||
tquat<T, P> const & x,
|
||||
T const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> pow(tquat<T, P> const & x, T const & y)
|
||||
{
|
||||
if(abs(x.w) > (static_cast<T>(1) - epsilon<T>()))
|
||||
return x;
|
||||
T Angle = acos(y);
|
||||
//Raising to the power of 0 should yield 1
|
||||
//Needed to prevent a division by 0 error later on
|
||||
if(y > -epsilon<T>() && y < epsilon<T>())
|
||||
return tquat<T, P>(1,0,0,0);
|
||||
|
||||
//To deal with non-unit quaternions
|
||||
T magnitude = sqrt(x.x * x.x + x.y * x.y + x.z * x.z + x.w *x.w);
|
||||
|
||||
//Equivalent to raising a real number to a power
|
||||
//Needed to prevent a division by 0 error later on
|
||||
if(abs(x.w / magnitude) > static_cast<T>(1) - epsilon<T>() && abs(x.w / magnitude) < static_cast<T>(1) + epsilon<T>())
|
||||
return tquat<T, P>(pow(x.w, y),0,0,0);
|
||||
|
||||
T Angle = acos(x.w / magnitude);
|
||||
T NewAngle = Angle * y;
|
||||
T Div = sin(NewAngle) / sin(Angle);
|
||||
return tquat<T, P>(
|
||||
cos(NewAngle),
|
||||
x.x * Div,
|
||||
x.y * Div,
|
||||
x.z * Div);
|
||||
}
|
||||
T Mag = pow(magnitude, y-1);
|
||||
|
||||
//template <typename T, precision P>
|
||||
//GLM_FUNC_QUALIFIER tquat<T, P> sqrt
|
||||
//(
|
||||
// tquat<T, P> const & q
|
||||
//)
|
||||
//{
|
||||
// T q0 = static_cast<T>(1) - dot(q, q);
|
||||
// return T(2) * (T(1) + q0) * q;
|
||||
//}
|
||||
return tquat<T, P>(cos(NewAngle) * magnitude * Mag, x.x * Div * Mag, x.y * Div * Mag, x.z * Div * Mag);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> rotate
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "../detail/setup.hpp"
|
||||
|
||||
#if !GLM_HAS_TEMPLATE_ALIASES && !(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# error "GLM_GTX_scalar_multiplication requires C++11 suppport or alias templates and if not support for GCC"
|
||||
# error "GLM_GTX_scalar_multiplication requires C++11 support or alias templates and if not support for GCC"
|
||||
#endif
|
||||
|
||||
#include "../vec2.hpp"
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -33,9 +33,9 @@
|
||||
///
|
||||
/// @defgroup gtx_simd_mat4 GLM_GTX_simd_mat4
|
||||
/// @ingroup gtx
|
||||
///
|
||||
///
|
||||
/// @brief SIMD implementation of mat4 type.
|
||||
///
|
||||
///
|
||||
/// <glm/gtx/simd_mat4.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -71,6 +71,13 @@ namespace detail
|
||||
typedef fmat4x4SIMD type;
|
||||
typedef fmat4x4SIMD transpose_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
|
||||
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
GLM_FUNC_DECL length_t length() const;
|
||||
|
||||
fvec4SIMD Data[4];
|
||||
@ -96,7 +103,7 @@ namespace detail
|
||||
__m128 const in[4]);
|
||||
|
||||
// Conversions
|
||||
//template <typename U>
|
||||
//template <typename U>
|
||||
//explicit tmat4x4(tmat4x4<U> const & m);
|
||||
|
||||
//explicit tmat4x4(tmat2x2<T> const & x);
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -33,9 +33,9 @@
|
||||
///
|
||||
/// @defgroup gtx_simd_quat GLM_GTX_simd_quat
|
||||
/// @ingroup gtx
|
||||
///
|
||||
///
|
||||
/// @brief SIMD implementation of quat type.
|
||||
///
|
||||
///
|
||||
/// <glm/gtx/simd_quat.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -76,6 +76,11 @@ namespace detail
|
||||
typedef fquatSIMD type;
|
||||
typedef tquat<bool, defaultp> bool_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
|
||||
union
|
||||
{
|
||||
@ -99,15 +104,15 @@ namespace detail
|
||||
explicit fquatSIMD(
|
||||
ctor);
|
||||
explicit fquatSIMD(
|
||||
float const & w,
|
||||
float const & x,
|
||||
float const & y,
|
||||
float const & w,
|
||||
float const & x,
|
||||
float const & y,
|
||||
float const & z);
|
||||
explicit fquatSIMD(
|
||||
quat const & v);
|
||||
explicit fquatSIMD(
|
||||
vec3 const & eulerAngles);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
@ -124,16 +129,16 @@ namespace detail
|
||||
detail::fquatSIMD operator- (
|
||||
detail::fquatSIMD const & q);
|
||||
|
||||
detail::fquatSIMD operator+ (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & p);
|
||||
detail::fquatSIMD operator+ (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & p);
|
||||
|
||||
detail::fquatSIMD operator* (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & p);
|
||||
detail::fquatSIMD operator* (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & p);
|
||||
|
||||
detail::fvec4SIMD operator* (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fvec4SIMD const & v);
|
||||
|
||||
detail::fvec4SIMD operator* (
|
||||
@ -141,7 +146,7 @@ namespace detail
|
||||
detail::fquatSIMD const & q);
|
||||
|
||||
detail::fquatSIMD operator* (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & q,
|
||||
float s);
|
||||
|
||||
detail::fquatSIMD operator* (
|
||||
@ -149,7 +154,7 @@ namespace detail
|
||||
detail::fquatSIMD const & q);
|
||||
|
||||
detail::fquatSIMD operator/ (
|
||||
detail::fquatSIMD const & q,
|
||||
detail::fquatSIMD const & q,
|
||||
float s);
|
||||
|
||||
}//namespace detail
|
||||
@ -192,64 +197,64 @@ namespace detail
|
||||
detail::fquatSIMD const & q);
|
||||
|
||||
|
||||
/// Returns the length of the quaternion.
|
||||
///
|
||||
/// Returns the length of the quaternion.
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
float length(
|
||||
detail::fquatSIMD const & x);
|
||||
|
||||
/// Returns the normalized quaternion.
|
||||
///
|
||||
/// Returns the normalized quaternion.
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD normalize(
|
||||
detail::fquatSIMD const & x);
|
||||
|
||||
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
|
||||
///
|
||||
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
float dot(
|
||||
detail::fquatSIMD const & q1,
|
||||
detail::fquatSIMD const & q1,
|
||||
detail::fquatSIMD const & q2);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
/// The interpolation is oriented and the rotation is performed at constant speed.
|
||||
/// For short path spherical linear interpolation, use the slerp function.
|
||||
///
|
||||
///
|
||||
/// @param x A quaternion
|
||||
/// @param y A quaternion
|
||||
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtx_simd_quat
|
||||
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
detail::fquatSIMD mix(
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
float const & a);
|
||||
|
||||
/// Linear interpolation of two quaternions.
|
||||
/// Linear interpolation of two quaternions.
|
||||
/// The interpolation is oriented.
|
||||
///
|
||||
///
|
||||
/// @param x A quaternion
|
||||
/// @param y A quaternion
|
||||
/// @param a Interpolation factor. The interpolation is defined in the range [0, 1].
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD lerp(
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
float const & a);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
/// The interpolation always take the short path and the rotation is performed at constant speed.
|
||||
///
|
||||
///
|
||||
/// @param x A quaternion
|
||||
/// @param y A quaternion
|
||||
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD slerp(
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
float const & a);
|
||||
|
||||
|
||||
@ -262,10 +267,10 @@ namespace detail
|
||||
/// This will use the equivalent to fastAcos() and fastSin().
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
/// @see - mix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
/// @see - mix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
detail::fquatSIMD fastMix(
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
float const & a);
|
||||
|
||||
/// Identical to fastMix() except takes the shortest path.
|
||||
@ -273,22 +278,22 @@ namespace detail
|
||||
/// The same rules apply here as those in fastMix(). Both quaternions must be unit length and 'a' must be
|
||||
/// in the range [0, 1].
|
||||
///
|
||||
/// @see - fastMix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
/// @see - fastMix(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
/// @see - slerp(detail::fquatSIMD const & x, detail::fquatSIMD const & y, T const & a)
|
||||
detail::fquatSIMD fastSlerp(
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
detail::fquatSIMD const & x,
|
||||
detail::fquatSIMD const & y,
|
||||
float const & a);
|
||||
|
||||
|
||||
/// Returns the q conjugate.
|
||||
///
|
||||
/// Returns the q conjugate.
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD conjugate(
|
||||
detail::fquatSIMD const & q);
|
||||
|
||||
/// Returns the q inverse.
|
||||
///
|
||||
/// Returns the q inverse.
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD inverse(
|
||||
detail::fquatSIMD const & q);
|
||||
@ -296,14 +301,14 @@ namespace detail
|
||||
/// Build a quaternion from an angle and a normalized axis.
|
||||
///
|
||||
/// @param angle Angle expressed in radians.
|
||||
/// @param axis Axis of the quaternion, must be normalized.
|
||||
/// @param axis Axis of the quaternion, must be normalized.
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD angleAxisSIMD(
|
||||
float const & angle,
|
||||
float const & angle,
|
||||
vec3 const & axis);
|
||||
|
||||
/// Build a quaternion from an angle and a normalized axis.
|
||||
/// Build a quaternion from an angle and a normalized axis.
|
||||
///
|
||||
/// @param angle Angle expressed in radians.
|
||||
/// @param x x component of the x-axis, x, y, z must be a normalized axis
|
||||
@ -312,9 +317,9 @@ namespace detail
|
||||
///
|
||||
/// @see gtx_simd_quat
|
||||
detail::fquatSIMD angleAxisSIMD(
|
||||
float const & angle,
|
||||
float const & x,
|
||||
float const & y,
|
||||
float const & angle,
|
||||
float const & x,
|
||||
float const & y,
|
||||
float const & z);
|
||||
|
||||
// TODO: Move this to somewhere more appropriate. Used with fastMix() and fastSlerp().
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -33,9 +33,9 @@
|
||||
///
|
||||
/// @defgroup gtx_simd_vec4 GLM_GTX_simd_vec4
|
||||
/// @ingroup gtx
|
||||
///
|
||||
///
|
||||
/// @brief SIMD implementation of vec4 type.
|
||||
///
|
||||
///
|
||||
/// <glm/gtx/simd_vec4.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -99,6 +99,11 @@ namespace detail
|
||||
typedef fvec4SIMD type;
|
||||
typedef tvec4<bool, highp> bool_type;
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
static GLM_RELAXED_CONSTEXPR length_t components = 4;
|
||||
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
|
||||
# endif//GLM_META_PROG_HELPERS
|
||||
|
||||
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
|
||||
union
|
||||
{
|
||||
@ -124,9 +129,9 @@ namespace detail
|
||||
explicit fvec4SIMD(
|
||||
float const & s);
|
||||
explicit fvec4SIMD(
|
||||
float const & x,
|
||||
float const & y,
|
||||
float const & z,
|
||||
float const & x,
|
||||
float const & y,
|
||||
float const & z,
|
||||
float const & w);
|
||||
explicit fvec4SIMD(
|
||||
vec4 const & v);
|
||||
@ -213,13 +218,13 @@ namespace detail
|
||||
|
||||
//! Returns a value equal to the nearest integer to x.
|
||||
//! A fractional part of 0.5 will round toward the nearest even
|
||||
//! integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||
//! integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
//detail::fvec4SIMD roundEven(detail::fvec4SIMD const & x);
|
||||
|
||||
//! Returns a value equal to the nearest integer
|
||||
//! that is greater than or equal to x.
|
||||
//! Returns a value equal to the nearest integer
|
||||
//! that is greater than or equal to x.
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD ceil(detail::fvec4SIMD const & x);
|
||||
|
||||
@ -233,7 +238,7 @@ namespace detail
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD mod(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & y);
|
||||
|
||||
//! Modulus. Returns x - y * floor(x / y)
|
||||
@ -241,7 +246,7 @@ namespace detail
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD mod(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & x,
|
||||
float const & y);
|
||||
|
||||
//! Returns the fractional part of x and sets i to the integer
|
||||
@ -250,51 +255,51 @@ namespace detail
|
||||
//! sign as x.
|
||||
//! (From GLM_GTX_simd_vec4 extension, common function)
|
||||
//detail::fvec4SIMD modf(
|
||||
// detail::fvec4SIMD const & x,
|
||||
// detail::fvec4SIMD const & x,
|
||||
// detail::fvec4SIMD & i);
|
||||
|
||||
//! Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD min(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & y);
|
||||
|
||||
detail::fvec4SIMD min(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & x,
|
||||
float const & y);
|
||||
|
||||
//! Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD max(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & y);
|
||||
|
||||
detail::fvec4SIMD max(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & x,
|
||||
float const & y);
|
||||
|
||||
//! Returns min(max(x, minVal), maxVal) for each component in x
|
||||
//! Returns min(max(x, minVal), maxVal) for each component in x
|
||||
//! using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD clamp(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & minVal,
|
||||
detail::fvec4SIMD const & maxVal);
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & minVal,
|
||||
detail::fvec4SIMD const & maxVal);
|
||||
|
||||
detail::fvec4SIMD clamp(
|
||||
detail::fvec4SIMD const & x,
|
||||
float const & minVal,
|
||||
float const & maxVal);
|
||||
detail::fvec4SIMD const & x,
|
||||
float const & minVal,
|
||||
float const & maxVal);
|
||||
|
||||
//! \return If genTypeU is a floating scalar or vector:
|
||||
//! Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
//! x and y using the floating-point value a.
|
||||
//! \return If genTypeU is a floating scalar or vector:
|
||||
//! Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
//! x and y using the floating-point value a.
|
||||
//! The value for a is not restricted to the range [0, 1].
|
||||
//!
|
||||
//! \return If genTypeU is a boolean scalar or vector:
|
||||
//! \return If genTypeU is a boolean scalar or vector:
|
||||
//! 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
|
||||
@ -305,9 +310,9 @@ namespace detail
|
||||
//! provides different functionality than
|
||||
//! genType mix(genType x, genType y, genType(a))
|
||||
//! where a is a Boolean vector.
|
||||
//!
|
||||
//!
|
||||
//! From GLSL 1.30.08 specification, section 8.3
|
||||
//!
|
||||
//!
|
||||
//! \param[in] x Floating point scalar or vector.
|
||||
//! \param[in] y Floating point scalar or vector.
|
||||
//! \param[in] a Floating point or boolean scalar or vector.
|
||||
@ -316,19 +321,19 @@ namespace detail
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD mix(
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & y,
|
||||
detail::fvec4SIMD const & x,
|
||||
detail::fvec4SIMD const & y,
|
||||
detail::fvec4SIMD const & a);
|
||||
|
||||
//! Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD step(
|
||||
detail::fvec4SIMD const & edge,
|
||||
detail::fvec4SIMD const & edge,
|
||||
detail::fvec4SIMD const & x);
|
||||
|
||||
detail::fvec4SIMD step(
|
||||
float const & edge,
|
||||
float const & edge,
|
||||
detail::fvec4SIMD const & x);
|
||||
|
||||
//! Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||
@ -343,13 +348,13 @@ namespace detail
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD smoothstep(
|
||||
detail::fvec4SIMD const & edge0,
|
||||
detail::fvec4SIMD const & edge1,
|
||||
detail::fvec4SIMD const & edge0,
|
||||
detail::fvec4SIMD const & edge1,
|
||||
detail::fvec4SIMD const & x);
|
||||
|
||||
detail::fvec4SIMD smoothstep(
|
||||
float const & edge0,
|
||||
float const & edge1,
|
||||
float const & edge0,
|
||||
float const & edge1,
|
||||
detail::fvec4SIMD const & x);
|
||||
|
||||
//! Returns true if x holds a NaN (not a number)
|
||||
@ -390,8 +395,8 @@ namespace detail
|
||||
///
|
||||
/// @see gtx_simd_vec4
|
||||
detail::fvec4SIMD fma(
|
||||
detail::fvec4SIMD const & a,
|
||||
detail::fvec4SIMD const & b,
|
||||
detail::fvec4SIMD const & a,
|
||||
detail::fvec4SIMD const & b,
|
||||
detail::fvec4SIMD const & c);
|
||||
|
||||
//! Splits x into a floating-point significand in the range
|
||||
|
@ -63,6 +63,11 @@ namespace glm
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType repeat(genType const & Texcoord);
|
||||
|
||||
/// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode
|
||||
/// @see gtx_wrap extension.
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType mirrorClamp(genType const & Texcoord);
|
||||
|
||||
/// Simulate GL_MIRROR_REPEAT OpenGL wrap mode
|
||||
/// @see gtx_wrap extension.
|
||||
template <typename genType>
|
||||
|
129
glm/gtx/wrap.inl
129
glm/gtx/wrap.inl
@ -33,67 +33,46 @@
|
||||
namespace glm
|
||||
{
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType clamp
|
||||
(
|
||||
genType const & Texcoord
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType clamp(genType const & Texcoord)
|
||||
{
|
||||
return glm::clamp(Texcoord, genType(0), genType(1));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> clamp
|
||||
(
|
||||
tvec2<T, P> const & Texcoord
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> clamp(tvec2<T, P> const & Texcoord)
|
||||
{
|
||||
tvec2<T, P> Result;
|
||||
for(typename tvec2<T, P>::size_type i = 0; i < tvec2<T, P>::value_size(); ++i)
|
||||
Result[i] = clamp(Texcoord[i]);
|
||||
Result[i] = clamp_to_edge(Texcoord[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> clamp
|
||||
(
|
||||
tvec3<T, P> const & Texcoord
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> clamp(tvec3<T, P> const & Texcoord)
|
||||
{
|
||||
tvec3<T, P> Result;
|
||||
for(typename tvec3<T, P>::size_type i = 0; i < tvec3<T, P>::value_size(); ++i)
|
||||
Result[i] = clamp(Texcoord[i]);
|
||||
Result[i] = clamp_to_edge(Texcoord[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> clamp
|
||||
(
|
||||
tvec4<T, P> const & Texcoord
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> clamp(tvec4<T, P> const & Texcoord)
|
||||
{
|
||||
tvec4<T, P> Result;
|
||||
for(typename tvec4<T, P>::size_type i = 0; i < tvec4<T, P>::value_size(); ++i)
|
||||
Result[i] = clamp(Texcoord[i]);
|
||||
Result[i] = clamp_to_edge(Texcoord[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// repeat
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType repeat
|
||||
(
|
||||
genType const & Texcoord
|
||||
)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType repeat(genType const & Texcoord)
|
||||
{
|
||||
return glm::fract(Texcoord);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> repeat
|
||||
(
|
||||
tvec2<T, P> const & Texcoord
|
||||
)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> repeat(tvec2<T, P> const & Texcoord)
|
||||
{
|
||||
tvec2<T, P> Result;
|
||||
for(typename tvec2<T, P>::size_type i = 0; i < tvec2<T, P>::value_size(); ++i)
|
||||
@ -101,11 +80,8 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> repeat
|
||||
(
|
||||
tvec3<T, P> const & Texcoord
|
||||
)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> repeat(tvec3<T, P> const & Texcoord)
|
||||
{
|
||||
tvec3<T, P> Result;
|
||||
for(typename tvec3<T, P>::size_type i = 0; i < tvec3<T, P>::value_size(); ++i)
|
||||
@ -113,11 +89,8 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> repeat
|
||||
(
|
||||
tvec4<T, P> const & Texcoord
|
||||
)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> repeat(tvec4<T, P> const & Texcoord)
|
||||
{
|
||||
tvec4<T, P> Result;
|
||||
for(typename tvec4<T, P>::size_type i = 0; i < tvec4<T, P>::value_size(); ++i)
|
||||
@ -125,18 +98,47 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
// mirrorRepeat
|
||||
|
||||
template <typename genType, precision P>
|
||||
GLM_FUNC_QUALIFIER genType mirrorRepeat
|
||||
(
|
||||
genType const & Texcoord
|
||||
)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType mirrorClamp(genType const & Texcoord)
|
||||
{
|
||||
genType const Clamp = genType(int(glm::floor(Texcoord)) % 2);
|
||||
genType const Floor = glm::floor(Texcoord);
|
||||
genType const Rest = Texcoord - Floor;
|
||||
return glm::fract(glm::abs(Texcoord));
|
||||
//return glm::mod(glm::abs(Texcoord), 1.0f);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> mirrorClamp(tvec2<T, P> const & Texcoord)
|
||||
{
|
||||
tvec2<T, P> Result;
|
||||
for(typename tvec2<T, P>::size_type i = 0; i < tvec2<T, P>::value_size(); ++i)
|
||||
Result[i] = mirrorClamp(Texcoord[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> mirrorClamp(tvec3<T, P> const & Texcoord)
|
||||
{
|
||||
tvec3<T, P> Result;
|
||||
for(typename tvec3<T, P>::size_type i = 0; i < tvec3<T, P>::value_size(); ++i)
|
||||
Result[i] = mirrorClamp(Texcoord[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> mirrorClamp(tvec4<T, P> const & Texcoord)
|
||||
{
|
||||
tvec4<T, P> Result;
|
||||
for(typename tvec4<T, P>::size_type i = 0; i < tvec4<T, P>::value_size(); ++i)
|
||||
Result[i] = mirrorClamp(Texcoord[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const & Texcoord)
|
||||
{
|
||||
genType const Abs = glm::abs(Texcoord);
|
||||
genType const Clamp = genType(int(glm::floor(Abs)) % 2);
|
||||
genType const Floor = glm::floor(Abs);
|
||||
genType const Rest = Abs - Floor;
|
||||
genType const Mirror = Clamp + Rest;
|
||||
|
||||
genType Out;
|
||||
@ -147,11 +149,8 @@ namespace glm
|
||||
return Out;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> mirrorRepeat
|
||||
(
|
||||
tvec2<T, P> const & Texcoord
|
||||
)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> mirrorRepeat(tvec2<T, P> const & Texcoord)
|
||||
{
|
||||
tvec2<T, P> Result;
|
||||
for(typename tvec2<T, P>::size_type i = 0; i < tvec2<T, P>::value_size(); ++i)
|
||||
@ -159,11 +158,8 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> mirrorRepeat
|
||||
(
|
||||
tvec3<T, P> const & Texcoord
|
||||
)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> mirrorRepeat(tvec3<T, P> const & Texcoord)
|
||||
{
|
||||
tvec3<T, P> Result;
|
||||
for(typename tvec3<T, P>::size_type i = 0; i < tvec3<T, P>::value_size(); ++i)
|
||||
@ -171,11 +167,8 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> mirrorRepeat
|
||||
(
|
||||
tvec4<T, P> const & Texcoord
|
||||
)
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> mirrorRepeat(tvec4<T, P> const & Texcoord)
|
||||
{
|
||||
tvec4<T, P> Result;
|
||||
for(typename tvec4<T, P>::size_type i = 0; i < tvec4<T, P>::value_size(); ++i)
|
||||
|
@ -1,108 +1,111 @@
|
||||
================================================================================
|
||||
OpenGL Mathematics (GLM)
|
||||
--------------------------------------------------------------------------------
|
||||
GLM can be distributed and/or modified under the terms of either
|
||||
a) The Happy Bunny License, or b) the MIT License.
|
||||
![glm](doc/logo.png)
|
||||
|
||||
================================================================================
|
||||
The Happy Bunny License (Modified MIT License)
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - 2015 G-Truc Creation
|
||||
[OpenGL Mathematics](http://glm.g-truc.net/) (*GLM*) is a header only C++ mathematics library for graphics software based on the [OpenGL Shading Language (GLSL) specifications](https://www.opengl.org/registry/doc/GLSLangSpec.4.50.diff.pdf).
|
||||
|
||||
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:
|
||||
*GLM* provides classes and functions designed and implemented with the same naming conventions and functionalities than *GLSL* so that anyone who knows *GLSL*, can use *GLM* as well in C++.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
This project isn't limited to *GLSL* features. An extension system, based on the *GLSL* extension conventions, provides extended capabilities: matrix transformations, quaternions, data packing, random numbers, noise, etc...
|
||||
|
||||
Restrictions:
|
||||
By making use of the Software for military purposes, you choose to make a
|
||||
Bunny unhappy.
|
||||
This library works perfectly with *[OpenGL](https://www.opengl.org)* but it also ensures interoperability with other third party libraries and SDK. It is a good candidate for software rendering (raytracing / rasterisation), image processing, physic simulations and any development context that requires a simple and convenient mathematics library.
|
||||
|
||||
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.
|
||||
*GLM* is written in C++98 but can take advantage of C++11 when supported by the compiler. It is a platform independent library with no dependence and it officially supports the following compilers:
|
||||
- [Apple Clang 4.0](https://developer.apple.com/library/mac/documentation/CompilerTools/Conceptual/LLVMCompilerOverview/index.html) and higher
|
||||
- [GCC](http://gcc.gnu.org/) 4.2 and higher
|
||||
- [Intel C++ Composer](https://software.intel.com/en-us/intel-compilers) XE 2013 and higher
|
||||
- [LLVM](http://llvm.org/) 3.0 and higher
|
||||
- [Visual C++](http://www.visualstudio.com/) 2010 and higher
|
||||
- [CUDA](https://developer.nvidia.com/about-cuda) 4.0 and higher (experimental)
|
||||
- Any conform C++98 or C++11 compiler
|
||||
|
||||
================================================================================
|
||||
The MIT License
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - 2015 G-Truc Creation
|
||||
For more information about *GLM*, please have a look at the [manual](http://glm.g-truc.net/0.9.6/glm-0.9.6.pdf) and the [API reference documentation](http://glm.g-truc.net/0.9.6/api/index.html).
|
||||
The source code and the documentation are licensed under the [Happy Bunny License (Modified MIT) or the MIT License](./copying.txt).
|
||||
|
||||
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:
|
||||
Thanks for contributing to the project by [submitting issues](https://github.com/g-truc/glm/issues) for bug reports and feature requests. Any feedback is welcome at [glm@g-truc.net](mailto://glm@g-truc.net).
|
||||
|
||||
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.
|
||||
```c++
|
||||
#include <glm/vec3.hpp> // glm::vec3
|
||||
#include <glm/vec4.hpp> // glm::vec4
|
||||
#include <glm/mat4x4.hpp> // glm::mat4
|
||||
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
|
||||
|
||||
================================================================================
|
||||
GLM Usage
|
||||
--------------------------------------------------------------------------------
|
||||
GLM is a header only library, there is nothing to build, just include it.
|
||||
#include <glm/glm.hpp>
|
||||
glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
||||
{
|
||||
glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);
|
||||
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
|
||||
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
|
||||
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
|
||||
return Projection * View * Model;
|
||||
}
|
||||
```
|
||||
|
||||
More informations in GLM manual:
|
||||
http://glm.g-truc.net/glm.pdf
|
||||
## Project Health
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.7.0: 2015-XX-XX
|
||||
--------------------------------------------------------------------------------
|
||||
Features:
|
||||
| Service | System | Compiler | Status |
|
||||
| ------- | ------ | -------- | ------ |
|
||||
| [Drone](https://drone.io/github.com/g-truc/glm) | Linux 64 bits | GCC 4.6.3 | [![Build Status](https://drone.io/github.com/g-truc/glm/status.png)](https://drone.io/github.com/g-truc/glm/latest) |
|
||||
|
||||
## [Lastest release](https://github.com/g-truc/glm/releases/latest)
|
||||
|
||||
## Release notes
|
||||
|
||||
#### GLM 0.9.7.0 - 2015-XX-XX
|
||||
##### Features:
|
||||
- Added GTC_color: convertRgbToSrgb and convertSrgbToRgb functions
|
||||
- Added 'fmod' overload to GTX_common with tests #308
|
||||
- Left handed perspective and lookAt functions #314
|
||||
- Added functions eulerAngleXYZ and extractEulerAngleXYZ #311
|
||||
- Added <glm/gtx/hash.hpp> to perform std::hash on GLM types #320
|
||||
- Added <glm/gtx/wrap.hpp> for texcoord wrapping
|
||||
- Added static components and precision members to all vector and quat types #350
|
||||
- Added .gitignore #349
|
||||
|
||||
Improvements:
|
||||
##### Improvements:
|
||||
- Changed usage of __has_include to support Intel compiler #307
|
||||
- Specialized integer implementation of YCoCg-R #310
|
||||
- Don't show status message in 'FindGLM' if 'QUIET' option is set. #317
|
||||
- Added master branch continuous integration service on Linux 64 #332
|
||||
- Clarified manual regarding angle unit in GLM, added FAQ 11 #326
|
||||
- Updated list of compiler versions
|
||||
|
||||
Deprecation:
|
||||
##### Fixes:
|
||||
- Fixed (u)int64 MSB/LSB handling on BE archs #306
|
||||
- Fixed multi-line comment warning in g++. #315
|
||||
- Fixed specifier removal by 'std::make_pair<>' #333
|
||||
- Fixed perspective fovy argument documentation #327
|
||||
- Removed -m64 causing build issues on Linux 32 #331
|
||||
- Fixed isfinite with C++98 compilers #343
|
||||
- Fixed Intel compiler build error on Linux #354
|
||||
- Fixed use of libstdc++ with Clang #351
|
||||
- Fixed quaternion pow #346
|
||||
|
||||
##### Deprecation:
|
||||
- Removed integer specification for 'mod' in GTC_integer #308
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.6.4: 2015-0X-XX
|
||||
--------------------------------------------------------------------------------
|
||||
Fixes:
|
||||
#### GLM 0.9.6.4 - 2015-0X-XX
|
||||
##### Fixes:
|
||||
- Fixed default precision for quat and dual_quat type #312
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.6.3: 2015-02-15
|
||||
--------------------------------------------------------------------------------
|
||||
#### [GLM 0.9.6.3 - 2015-02-15](https://github.com/g-truc/glm/releases/tag/0.9.6.3)
|
||||
- Fixed Android doesn't have C++ 11 STL #284
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.6.2: 2015-02-15
|
||||
--------------------------------------------------------------------------------
|
||||
Features:
|
||||
#### GLM 0.9.6.2 - 2015-02-15
|
||||
##### Features:
|
||||
- Added display of GLM version with other GLM_MESSAGES
|
||||
- Added ARM instruction set detection
|
||||
|
||||
Improvements:
|
||||
--------------------------------------------------------------------------------
|
||||
##### Improvements:
|
||||
- Removed assert for perspective with zFar < zNear #298
|
||||
- Added Visual Studio natvis support for vec1, quat and dualqual types
|
||||
- Cleaned up C++11 feature detections
|
||||
- Clarify GLM licensing
|
||||
|
||||
Fixes:
|
||||
##### Fixes:
|
||||
- Fixed faceforward build #289
|
||||
- Fixed conflict with Xlib #define True 1 #293
|
||||
- Fixed decompose function VS2010 templating issues #294
|
||||
@ -115,17 +118,16 @@ Fixes:
|
||||
- Fixed functions not inlined with Clang #302
|
||||
- Fixed memory corruption (undefined behaviour) #303
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.6.1: 2014-12-10
|
||||
--------------------------------------------------------------------------------
|
||||
Features:
|
||||
#### GLM 0.9.6.1 - 2014-12-10
|
||||
##### Features:
|
||||
- Added GLM_LANG_CXX14_FLAG and GLM_LANG_CXX1Z_FLAG language feature flags
|
||||
- Added C++14 detection
|
||||
|
||||
Improvements:
|
||||
##### Improvements:
|
||||
- Clean up GLM_MESSAGES compilation log to report only detected capabilities
|
||||
|
||||
Fixes:
|
||||
##### Fixes:
|
||||
- Fixed scalar uaddCarry build error with Cuda #276
|
||||
- Fixed C++11 explicit conversion operators detection #282
|
||||
- Fixed missing explicit convertion when using integer log2 with *vec1 types
|
||||
@ -138,10 +140,9 @@ Fixes:
|
||||
- Fixed conflict between GTX_compatibility and GTC_quaternion #286
|
||||
- Fixed C++ language restriction using GLM_FORCE_CXX**
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.6.0: 2014-11-30
|
||||
--------------------------------------------------------------------------------
|
||||
Features:
|
||||
#### GLM 0.9.6.0 - 2014-11-30
|
||||
##### Features:
|
||||
- Exposed template vector and matrix types in 'glm' namespace #239, #244
|
||||
- Added GTX_scalar_multiplication for C++ 11 compiler only #242
|
||||
- Added GTX_range for C++ 11 compiler only #240
|
||||
@ -161,7 +162,7 @@ Features:
|
||||
- Added GLM_FORCE_EXPLICIT_CTOR to require explicit type conversions #269
|
||||
- Added GTX_type_aligned for aligned vector, matrix and quaternion types
|
||||
|
||||
Improvements:
|
||||
##### Improvements:
|
||||
- Rely on C++11 to implement isinf and isnan
|
||||
- Removed GLM_FORCE_CUDA, Cuda is implicitly detected
|
||||
- Separated Apple Clang and LLVM compiler detection
|
||||
@ -181,7 +182,7 @@ Improvements:
|
||||
- Optimized sign function #272
|
||||
- Added explicit cast from quat to mat3 and mat4 #275
|
||||
|
||||
Fixes:
|
||||
##### Fixes:
|
||||
- Fixed std::nextafter not supported with C++11 on Android #217
|
||||
- Fixed missing value_type for dual quaternion
|
||||
- Fixed return type of dual quaternion length
|
||||
@ -192,7 +193,7 @@ Fixes:
|
||||
- Fixed uaddCarray #253
|
||||
- Fixed float comparison warnings #270
|
||||
|
||||
Deprecation:
|
||||
##### Deprecation:
|
||||
- Removed degrees for function parameters
|
||||
- Removed GLM_FORCE_RADIANS, active by default
|
||||
- Removed VC 2005 / 8 and 2008 / 9 support
|
||||
@ -201,9 +202,8 @@ Deprecation:
|
||||
- Removed LLVM 2.6 to 3.1 support
|
||||
- Removed CUDA 3.0 to 3.2 support
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.4: 2014-06-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### [GLM 0.9.5.4 - 2014-06-21](https://github.com/g-truc/glm/releases/tag/0.9.5.4)
|
||||
- Fixed non-utf8 character #196
|
||||
- Added FindGLM install for CMake #189
|
||||
- Fixed GTX_color_space - saturation #195
|
||||
@ -223,9 +223,8 @@ GLM 0.9.5.4: 2014-06-21
|
||||
- Fixed std::nextafter not supported with C++11 on Android #213
|
||||
- Fixed corner cases in exp and log functions for quaternions #199
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.3: 2014-04-02
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.5.3 - 2014-04-02
|
||||
- Added instruction set auto detection with Visual C++ using _M_IX86_FP - /arch
|
||||
compiler argument
|
||||
- Fixed GTX_raw_data code dependency
|
||||
@ -240,9 +239,8 @@ GLM 0.9.5.3: 2014-04-02
|
||||
- Added full tests for eulerAngle*** functions (#173)
|
||||
- Added workaround for a CUDA compiler bug (#186, #185)
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.2: 2014-02-08
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.5.2 - 2014-02-08
|
||||
- Fixed initializer list ambiguity (#159, #160)
|
||||
- Fixed warnings with the Android NDK 9c
|
||||
- Fixed non power of two matrix products
|
||||
@ -254,9 +252,8 @@ GLM 0.9.5.2: 2014-02-08
|
||||
- Tentative fix for strict aliasing warning in GCC 4.8.1 / Android NDK 9c (#152)
|
||||
- Fixed GLM_GTC_constants description brief (#162)
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.1: 2014-01-11
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.5.1 - 2014-01-11
|
||||
- Fixed angle and orientedAngle that sometimes return NaN values (#145)
|
||||
- Deprecated degrees for function parameters and display a message
|
||||
- Added possible static_cast conversion of GLM types (#72)
|
||||
@ -267,9 +264,8 @@ GLM 0.9.5.1: 2014-01-11
|
||||
- Added intersectRayPlane function (#153)
|
||||
- Fixed outerProduct return type (#155)
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.0: 2013-12-25
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.5.0 - 2013-12-25
|
||||
- Added forward declarations (glm/fwd.hpp) for faster compilations
|
||||
- Added per feature headers
|
||||
- Minimized GLM internal dependencies
|
||||
@ -307,9 +303,8 @@ GLM 0.9.5.0: 2013-12-25
|
||||
- Improved GLM messages enabled when defining GLM_MESSAGES
|
||||
- Hidden matrix _inverse function implementation detail into private section
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.6: 2013-09-20
|
||||
--------------------------------------------------------------------------------
|
||||
#### [GLM 0.9.4.6 - 2013-09-20](https://github.com/g-truc/glm/releases/tag/0.9.4.6)
|
||||
- Fixed detection to select the last known compiler if newer version #106
|
||||
- Fixed is_int and is_uint code duplication with GCC and C++11 #107
|
||||
- Fixed test suite build while using Clang in C++11 mode
|
||||
@ -323,9 +318,8 @@ GLM 0.9.4.6: 2013-09-20
|
||||
- Fixed const ref issue on assignment operator taking a scalar parameter #116
|
||||
- Fixed glm::eulerAngleY implementation #117
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.5: 2013-08-12
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.4.5 - 2013-08-12
|
||||
- Fixed CUDA support
|
||||
- Fixed inclusion of intrinsics in "pure" mode #92
|
||||
- Fixed language detection on GCC when the C++0x mode isn't enabled #95
|
||||
@ -334,9 +328,8 @@ GLM 0.9.4.5: 2013-08-12
|
||||
- Added Windows CE detection #92
|
||||
- Added missing value_ptr for quaternions #99
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.4: 2013-05-29
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.4.4 - 2013-05-29
|
||||
- Fixed slerp when costheta is close to 1 #65
|
||||
- Fixed mat4x2 value_type constructor #70
|
||||
- Fixed glm.natvis for Visual C++ 12 #82
|
||||
@ -347,9 +340,8 @@ GLM 0.9.4.4: 2013-05-29
|
||||
- Fixed GLM_GTX_multiple with negative values #79
|
||||
- Fixed glm::perspective when zNear is zero #71
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.3: 2013-03-20
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.4.3 - 2013-03-20
|
||||
- Detected qualifier for Clang
|
||||
- Fixed C++11 mode for GCC, couldn't be enabled without MS extensions
|
||||
- Fixed squad, intermediate and exp quaternion functions
|
||||
@ -361,9 +353,8 @@ GLM 0.9.4.3: 2013-03-20
|
||||
- Autodetected C++ version using __cplusplus value
|
||||
- Fixed mix for bool and bvec* third parameter
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.2: 2013-02-14
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.4.2 - 2013-02-14
|
||||
- Fixed compAdd from GTX_component_wise
|
||||
- Fixed SIMD support for Intel compiler on Windows
|
||||
- Fixed isnan and isinf for CUDA compiler
|
||||
@ -376,9 +367,8 @@ GLM 0.9.4.2: 2013-02-14
|
||||
- Fixed documentation warnings
|
||||
- Fixed CUDA warnings
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.1: 2012-12-22
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.4.1 - 2012-12-22
|
||||
- Improved half support: -0.0 case and implicit conversions
|
||||
- Fixed Intel Composer Compiler support on Linux
|
||||
- Fixed interaction between quaternion and euler angles
|
||||
@ -389,9 +379,8 @@ GLM 0.9.4.1: 2012-12-22
|
||||
- Fixed assert messages
|
||||
- Added slerp and lerp quaternion functions and tests
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.0: 2012-11-18
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.4.0 - 2012-11-18
|
||||
- Added Intel Composer Compiler support
|
||||
- Promoted GTC_espilon extension
|
||||
- Promoted GTC_ulp extension
|
||||
@ -400,9 +389,8 @@ GLM 0.9.4.0: 2012-11-18
|
||||
- Fixed detection of Clang and LLVM GCC on MacOS X
|
||||
- Added debugger visualizers for Visual C++ 2012
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.4: 2012-06-30
|
||||
--------------------------------------------------------------------------------
|
||||
#### [GLM 0.9.3.4 - 2012-06-30](https://github.com/g-truc/glm/releases/tag/0.9.3.4)
|
||||
- Added SSE4 and AVX2 detection.
|
||||
- Removed VIRTREV_xstream and the incompatibility generated with GCC
|
||||
- Fixed C++11 compiler option for GCC
|
||||
@ -411,9 +399,8 @@ GLM 0.9.3.4: 2012-06-30
|
||||
- Fixed warnings
|
||||
- Fixed SSE includes
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.3: 2012-05-10
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.3.3 - 2012-05-10
|
||||
- Fixed isinf and isnan
|
||||
- Improved compatibility with Intel compiler
|
||||
- Added CMake test build options: SIMD, C++11, fast math and MS land ext
|
||||
@ -424,32 +411,28 @@ GLM 0.9.3.3: 2012-05-10
|
||||
- Fixed various warnings
|
||||
- Added VC11 support
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.2: 2012-03-15
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.3.2 - 2012-03-15
|
||||
- Fixed doxygen documentation
|
||||
- Fixed Clang version detection
|
||||
- Fixed simd mat4 /= operator
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.1: 2012-01-25
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.3.1 - 2012-01-25
|
||||
- Fixed platform detection
|
||||
- Fixed warnings
|
||||
- Removed detail code from Doxygen doc
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.0: 2012-01-09
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.3.0 - 2012-01-09
|
||||
- Added CPP Check project
|
||||
- Fixed conflict with Windows headers
|
||||
- Fixed isinf implementation
|
||||
- Fixed Boost conflict
|
||||
- Fixed warnings
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.B: 2011-12-12
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.3.B - 2011-12-12
|
||||
- Added support for Chrone Native Client
|
||||
- Added epsilon constant
|
||||
- Removed value_size function from vector types
|
||||
@ -459,9 +442,8 @@ GLM 0.9.3.B: 2011-12-12
|
||||
- Fixed step function accuracy
|
||||
- Fixed outerProduct
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.3.A: 2011-11-11
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.3.A - 2011-11-11
|
||||
- Improved doxygen documentation
|
||||
- Added new swizzle operators for C++11 compilers
|
||||
- Added new swizzle operators declared as functions
|
||||
@ -475,55 +457,47 @@ generation distribution
|
||||
- Fixed half based type contructors
|
||||
- Added GLSL core noise functions
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.7: 2011-10-24
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.7 - 2011-10-24
|
||||
- Added more swizzling constructors
|
||||
- Added missing none-squared matrix products
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.6: 2011-10-01
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.6 - 2011-10-01
|
||||
- Fixed half based type build on old GCC
|
||||
- Fixed /W4 warnings on Visual C++
|
||||
- Fixed some missing l-value swizzle operators
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.5: 2011-09-20
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.5 - 2011-09-20
|
||||
- Fixed floatBitToXint functions
|
||||
- Fixed pack and unpack functions
|
||||
- Fixed round functions
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.4: 2011-09-03
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.4 - 2011-09-03
|
||||
- Fixed extensions bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.3: 2011-06-08
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.3 - 2011-06-08
|
||||
- Fixed build issues
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.2: 2011-06-02
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.2 - 2011-06-02
|
||||
- Expend matrix constructors flexibility
|
||||
- Improved quaternion implementation
|
||||
- Fixed many warnings across platforms and compilers
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.1: 2011-05-24
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.1 - 2011-05-24
|
||||
- Automatically detect CUDA support
|
||||
- Improved compiler detection
|
||||
- Fixed errors and warnings in VC with C++ extensions disabled
|
||||
- Fixed and tested GLM_GTX_vector_angle
|
||||
- Fixed and tested GLM_GTX_rotate_vector
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.2.0: 2011-05-09
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.2.0 - 2011-05-09
|
||||
- Added CUDA support
|
||||
- Added CTest test suite
|
||||
- Added GLM_GTX_ulp extension
|
||||
@ -531,42 +505,35 @@ GLM 0.9.2.0: 2011-05-09
|
||||
- Added GLM_GTX_matrix_interpolation extension
|
||||
- Updated quaternion slerp interpolation
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.1.3: 2011-05-07
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.1.3 - 2011-05-07
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.1.2: 2011-04-15
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.1.2 - 2011-04-15
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.1.1: 2011-03-17
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.1.1 - 2011-03-17
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.1.0: 2011-03-03
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.1.0 - 2011-03-03
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.1.B: 2011-02-13
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.1.B - 2011-02-13
|
||||
- Updated API documentation
|
||||
- Improved SIMD implementation
|
||||
- Fixed Linux build
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.8: 2011-02-13
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.8 - 2011-02-13
|
||||
- Added quaternion product operator.
|
||||
- Clarify that GLM is a header only library.
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.1.A: 2011-01-31
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.1.A - 2011-01-31
|
||||
- Added SIMD support
|
||||
- Added new swizzle functions
|
||||
- Improved static assert error message with C++0x static_assert
|
||||
@ -574,315 +541,261 @@ GLM 0.9.1.A: 2011-01-31
|
||||
- Reduced branching
|
||||
- Fixed trunc implementation
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.7: 2011-01-30
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.7 - 2011-01-30
|
||||
- Added GLSL 4.10 packing functions
|
||||
- Added == and != operators for every types.
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.6: 2010-12-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.6 - 2010-12-21
|
||||
- Many matrices bugs fixed
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.5: 2010-11-01
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.5 - 2010-11-01
|
||||
- Improved Clang support
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.4: 2010-10-04
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.4 - 2010-10-04
|
||||
- Added autoexp for GLM
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.3: 2010-08-26
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.3 - 2010-08-26
|
||||
- Fixed non-squared matrix operators
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.2: 2010-07-08
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.2 - 2010-07-08
|
||||
- Added GLM_GTX_int_10_10_10_2
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.1: 2010-06-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.1 - 2010-06-21
|
||||
- Fixed extensions errors
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.0.0: 2010-05-25
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.0.0 - 2010-05-25
|
||||
- Objective-C support
|
||||
- Fixed warnings
|
||||
- Updated documentation
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.B.2: 2010-04-30
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.B.2 - 2010-04-30
|
||||
- Git transition
|
||||
- Removed experimental code from releases
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.B.1: 2010-04-03
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.B.1 - 2010-04-03
|
||||
- Based on GLSL 4.00 specification
|
||||
- Added the new core functions
|
||||
- Added some implicit conversion support
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.A.2: 2010-02-20
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.A.2 - 2010-02-20
|
||||
- Improved some possible errors messages
|
||||
- Improved declarations and definitions match
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.A.1: 2010-02-09
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.9.A.1 - 2010-02-09
|
||||
- Removed deprecated features
|
||||
- Internal redesign
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.4.4 final: 2010-01-25
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.4.4 final - 2010-01-25
|
||||
- Fixed warnings
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.4.3 final: 2009-11-16
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.4.3 final - 2009-11-16
|
||||
- Fixed Half float arithmetic
|
||||
- Fixed setup defines
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.4.2 final: 2009-10-19
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.4.2 final - 2009-10-19
|
||||
- Fixed Half float adds
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.4.1 final: 2009-10-05
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.4.1 final - 2009-10-05
|
||||
- Updated documentation
|
||||
- Fixed MacOS X build
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.4.0 final: 2009-09-16
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.4.0 final - 2009-09-16
|
||||
- Added GCC 4.4 and VC2010 support
|
||||
- Added matrix optimizations
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.3.5 final: 2009-08-11
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.3.5 final - 2009-08-11
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.3.4 final: 2009-08-10
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.3.4 final - 2009-08-10
|
||||
- Updated GLM according GLSL 1.5 spec
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.3.3 final: 2009-06-25
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.3.3 final - 2009-06-25
|
||||
- Fixed bugs
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.3.2 final: 2009-06-04
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.3.2 final - 2009-06-04
|
||||
- Added GLM_GTC_quaternion
|
||||
- Added GLM_GTC_type_precision
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.3.1 final: 2009-05-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.3.1 final - 2009-05-21
|
||||
- Fixed old extension system.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.3.0 final: 2009-05-06
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.3.0 final - 2009-05-06
|
||||
- Added stable extensions.
|
||||
- Added new extension system.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.2.3 final: 2009-04-01
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.2.3 final - 2009-04-01
|
||||
- Fixed bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.2.2 final: 2009-02-24
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.2.2 final - 2009-02-24
|
||||
- Fixed bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.2.1 final: 2009-02-13
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.2.1 final - 2009-02-13
|
||||
- Fixed bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.2 final: 2009-01-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.2 final - 2009-01-21
|
||||
- Fixed bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.1 final: 2008-10-30
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.1 final - 2008-10-30
|
||||
- Fixed bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.0 final: 2008-10-23
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.0 final - 2008-10-23
|
||||
- New method to use extension.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.0 beta3: 2008-10-10
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.0 beta3 - 2008-10-10
|
||||
- Added CMake support for GLM tests.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.0 beta2: 2008-10-04
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.0 beta2 - 2008-10-04
|
||||
- Improved half scalars and vectors support.
|
||||
|
||||
================================================================================
|
||||
GLM 0.8.0 beta1: 2008-09-26
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.8.0 beta1 - 2008-09-26
|
||||
- Improved GLSL conformance
|
||||
- Added GLSL 1.30 support
|
||||
- Improved API documentation
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.6 final: 2008-08-08
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.6 final - 2008-08-08
|
||||
- Improved C++ standard comformance
|
||||
- Added Static assert for types checking
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.5 final: 2008-07-05
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.5 final - 2008-07-05
|
||||
- Added build message system with Visual Studio
|
||||
- Pedantic build with GCC
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.4 final: 2008-06-01
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.4 final - 2008-06-01
|
||||
- Added external dependencies system.
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.3 final: 2008-05-24
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.3 final - 2008-05-24
|
||||
- Fixed bugs
|
||||
- Added new extension group
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.2 final: 2008-04-27
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.2 final - 2008-04-27
|
||||
- Updated documentation
|
||||
- Added preprocessor options
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.1 final: 2008-03-24
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.1 final - 2008-03-24
|
||||
- Disabled half on GCC
|
||||
- Fixed extensions
|
||||
|
||||
================================================================================
|
||||
GLM 0.7.0 final: 2008-03-22
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.7.0 final - 2008-03-22
|
||||
- Changed to MIT license
|
||||
- Added new documentation
|
||||
|
||||
================================================================================
|
||||
GLM 0.6.4 : 2007-12-10
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.6.4 - 2007-12-10
|
||||
- Fixed swizzle operators
|
||||
|
||||
================================================================================
|
||||
GLM 0.6.3 : 2007-11-05
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.6.3 - 2007-11-05
|
||||
- Fixed type data accesses
|
||||
- Fixed 3DSMax sdk conflict
|
||||
|
||||
================================================================================
|
||||
GLM 0.6.2 : 2007-10-08
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.6.2 - 2007-10-08
|
||||
- Fixed extension
|
||||
|
||||
================================================================================
|
||||
GLM 0.6.1 : 2007-10-07
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.6.1 - 2007-10-07
|
||||
- Fixed a namespace error
|
||||
- Added extensions
|
||||
|
||||
================================================================================
|
||||
GLM 0.6.0 : 2007-09-16
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.6.0 : 2007-09-16
|
||||
- Added new extension namespace mecanium
|
||||
- Added Automatic compiler detection
|
||||
|
||||
================================================================================
|
||||
GLM 0.5.1 : 2007-02-19
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.5.1 - 2007-02-19
|
||||
- Fixed swizzle operators
|
||||
|
||||
================================================================================
|
||||
GLM 0.5.0 : 2007-01-06
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.5.0 - 2007-01-06
|
||||
- Upgrated to GLSL 1.2
|
||||
- Added swizzle operators
|
||||
- Added setup settings
|
||||
|
||||
================================================================================
|
||||
GLM 0.4.1 : 2006-05-22
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.4.1 - 2006-05-22
|
||||
- Added OpenGL examples
|
||||
|
||||
================================================================================
|
||||
GLM 0.4.0 : 2006-05-17
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.4.0 - 2006-05-17
|
||||
- Added missing operators to vec* and mat*
|
||||
- Added first GLSL 1.2 features
|
||||
- Fixed windows.h before glm.h when windows.h required
|
||||
|
||||
================================================================================
|
||||
GLM 0.3.2 : 2006-04-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.3.2 - 2006-04-21
|
||||
- Fixed texcoord components access.
|
||||
- Fixed mat4 and imat4 division operators.
|
||||
|
||||
================================================================================
|
||||
GLM 0.3.1 : 2006-03-28
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.3.1 - 2006-03-28
|
||||
- Added GCC 4.0 support under MacOS X.
|
||||
- Added GCC 4.0 and 4.1 support under Linux.
|
||||
- Added code optimisations.
|
||||
|
||||
================================================================================
|
||||
GLM 0.3 : 2006-02-19
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.3 - 2006-02-19
|
||||
- Improved GLSL type conversion and construction compliance.
|
||||
- Added experimental extensions.
|
||||
- Added Doxygen Documentation.
|
||||
- Added code optimisations.
|
||||
- Fixed bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.2: 2005-05-05
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.2 - 2005-05-05
|
||||
- Improve adaptative from GLSL.
|
||||
- Add experimental extensions based on OpenGL extension process.
|
||||
- Fixe bugs.
|
||||
|
||||
================================================================================
|
||||
GLM 0.1: 2005-02-21
|
||||
--------------------------------------------------------------------------------
|
||||
#### GLM 0.1 - 2005-02-21
|
||||
- Add vec2, vec3, vec4 GLSL types
|
||||
- Add ivec2, ivec3, ivec4 GLSL types
|
||||
- Add bvec2, bvec3, bvec4 GLSL types
|
||||
- Add mat2, mat3, mat4 GLSL types
|
||||
- Add almost all functions
|
||||
|
||||
================================================================================
|
@ -168,6 +168,22 @@ namespace mod_
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
{
|
||||
float A(1.5f);
|
||||
float B(1.0f);
|
||||
float C = glm::mod(A, B);
|
||||
|
||||
Error += glm::abs(C - 0.5f) < 0.00001f ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
float A(-0.2f);
|
||||
float B(1.0f);
|
||||
float C = glm::mod(A, B);
|
||||
|
||||
Error += glm::abs(C - 0.8f) < 0.00001f ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
float A(3.0);
|
||||
float B(2.0f);
|
||||
|
@ -210,7 +210,7 @@ int main()
|
||||
# ifdef NDEBUG
|
||||
|
||||
int i, n;
|
||||
static int test[] = {0,0, 1,1, 2,1, 3,2, 4,1, 5,2, 6,2, 7,3,
|
||||
static unsigned test[] = {0,0, 1,1, 2,1, 3,2, 4,1, 5,2, 6,2, 7,3,
|
||||
8,1, 9,2, 10,2, 11,3, 12,2, 13,3, 14,3, 15,4, 16,1, 17,2,
|
||||
0x3F,6, 0x40,1, 0x41,2, 0x7f,7, 0x80,1, 0x81,2, 0xfe,7, 0xff,8,
|
||||
0x4000,1, 0x4001,2, 0x7000,3, 0x7fff,15,
|
||||
@ -230,7 +230,7 @@ int main()
|
||||
if (pop0(test[i]) != test[i+1]) error(test[i], pop0(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop0: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop0: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -238,7 +238,7 @@ int main()
|
||||
if (pop1(test[i]) != test[i+1]) error(test[i], pop1(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop1: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop1: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -246,7 +246,7 @@ int main()
|
||||
if (pop2(test[i]) != test[i+1]) error(test[i], pop2(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop2: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop2: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -254,7 +254,7 @@ int main()
|
||||
if (pop3(test[i]) != test[i+1]) error(test[i], pop3(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop3: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop3: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -262,7 +262,7 @@ int main()
|
||||
if (pop4(test[i]) != test[i+1]) error(test[i], pop4(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop4: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop4: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -270,7 +270,7 @@ int main()
|
||||
if (pop5(test[i]) != test[i+1]) error(test[i], pop5(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop5: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop5: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -278,7 +278,7 @@ int main()
|
||||
if (pop5a(test[i]) != test[i+1]) error(test[i], pop5a(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop5a: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop5a: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -286,7 +286,7 @@ int main()
|
||||
if (pop6(test[i]) != test[i+1]) error(test[i], pop6(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop6: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop6: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -295,7 +295,7 @@ int main()
|
||||
if (pop7(test[i]) != test[i+1]) error(test[i], pop7(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop7: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop7: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -304,7 +304,7 @@ int main()
|
||||
if (pop8(test[i]) != test[i+1]) error(test[i], pop8(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop8: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop8: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
TimestampBeg = std::clock();
|
||||
for (std::size_t k = 0; k < Count; ++k)
|
||||
@ -313,7 +313,7 @@ int main()
|
||||
if (pop9(test[i]) != test[i+1]) error(test[i], pop9(test[i]));}
|
||||
TimestampEnd = std::clock();
|
||||
|
||||
printf("pop9: %d clocks\n", TimestampEnd - TimestampBeg);
|
||||
printf("pop9: %ld clocks\n", TimestampEnd - TimestampBeg);
|
||||
|
||||
if (errors == 0)
|
||||
printf("Passed all %d cases.\n", sizeof(test)/8);
|
||||
|
@ -30,17 +30,12 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/trigonometric.hpp>
|
||||
/*
|
||||
float sin(float x) {
|
||||
float temp;
|
||||
temp = (x + M_PI) / ((2 * M_PI) - M_PI);
|
||||
return limited_sin((x + M_PI) - ((2 * M_PI) - M_PI) * temp));
|
||||
}
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
int Failed = 0;
|
||||
int Error = 0;
|
||||
|
||||
return Failed;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,15 @@ int test_compiler()
|
||||
case GLM_COMPILER_GCC50:
|
||||
std::printf("GLM_COMPILER_GCC50\n");
|
||||
break;
|
||||
case GLM_COMPILER_GCC51:
|
||||
std::printf("GLM_COMPILER_GCC51\n");
|
||||
break;
|
||||
case GLM_COMPILER_GCC52:
|
||||
std::printf("GLM_COMPILER_GCC52\n");
|
||||
break;
|
||||
case GLM_COMPILER_GCC53:
|
||||
std::printf("GLM_COMPILER_GCC53\n");
|
||||
break;
|
||||
default:
|
||||
std::printf("GCC version not detected\n");
|
||||
Error += 1;
|
||||
@ -94,6 +103,9 @@ int test_compiler()
|
||||
case GLM_COMPILER_APPLE_CLANG60:
|
||||
std::printf("GLM_COMPILER_APPLE_CLANG60\n");
|
||||
break;
|
||||
case GLM_COMPILER_APPLE_CLANG61:
|
||||
std::printf("GLM_COMPILER_APPLE_CLANG61\n");
|
||||
break;
|
||||
default:
|
||||
std::printf("Apple Clang version not detected\n");
|
||||
break;
|
||||
@ -115,6 +127,18 @@ int test_compiler()
|
||||
case GLM_COMPILER_LLVM35:
|
||||
std::printf("GLM_COMPILER_LLVM35\n");
|
||||
break;
|
||||
case GLM_COMPILER_LLVM36:
|
||||
std::printf("GLM_COMPILER_LLVM36\n");
|
||||
break;
|
||||
case GLM_COMPILER_LLVM37:
|
||||
std::printf("GLM_COMPILER_LLVM37\n");
|
||||
break;
|
||||
case GLM_COMPILER_LLVM38:
|
||||
std::printf("GLM_COMPILER_LLVM38\n");
|
||||
break;
|
||||
case GLM_COMPILER_LLVM39:
|
||||
std::printf("GLM_COMPILER_LLVM39\n");
|
||||
break;
|
||||
default:
|
||||
std::printf("LLVM version not detected\n");
|
||||
break;
|
||||
@ -139,6 +163,9 @@ int test_compiler()
|
||||
case GLM_COMPILER_INTEL15:
|
||||
std::printf("GLM_COMPILER_INTEL15\n");
|
||||
break;
|
||||
case GLM_COMPILER_INTEL16:
|
||||
std::printf("GLM_COMPILER_INTEL16\n");
|
||||
break;
|
||||
default:
|
||||
std::printf("Intel compiler version not detected\n");
|
||||
Error += 1;
|
||||
@ -196,7 +223,7 @@ int test_instruction_set()
|
||||
|
||||
int test_cpp_version()
|
||||
{
|
||||
std::printf("__cplusplus: %d\n", __cplusplus);
|
||||
std::printf("__cplusplus: %ld\n", __cplusplus);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,6 +29,9 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# define GLM_META_PROG_HELPERS
|
||||
#endif
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/gtc/vec1.hpp>
|
||||
@ -131,6 +134,7 @@ int test_vec1_size()
|
||||
Error += 8 == sizeof(glm::highp_dvec1) ? 0 : 1;
|
||||
Error += glm::vec1().length() == 1 ? 0 : 1;
|
||||
Error += glm::dvec1().length() == 1 ? 0 : 1;
|
||||
Error += glm::vec1::components == 1 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
@ -169,6 +173,10 @@ int main()
|
||||
glm::vec1 v;
|
||||
assert(v.length() == 1);
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
assert(glm::vec1::components == 1);
|
||||
# endif
|
||||
|
||||
Error += test_vec1_size();
|
||||
Error += test_vec1_ctor();
|
||||
Error += test_vec1_operators();
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -29,6 +29,9 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# define GLM_META_PROG_HELPERS
|
||||
#endif
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
@ -102,81 +105,81 @@ int test_vec2_operators()
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B(4.0f, 5.0f);
|
||||
|
||||
|
||||
glm::vec2 C = A + B;
|
||||
Error += C == glm::vec2(5, 7) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 D = B - A;
|
||||
Error += D == glm::vec2(3, 3) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 E = A * B;
|
||||
Error += E == glm::vec2(4, 10) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 F = B / A;
|
||||
Error += F == glm::vec2(4, 2.5) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 G = A + 1.0f;
|
||||
Error += G == glm::vec2(2, 3) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 H = B - 1.0f;
|
||||
Error += H == glm::vec2(3, 4) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 I = A * 2.0f;
|
||||
Error += I == glm::vec2(2, 4) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 J = B / 2.0f;
|
||||
Error += J == glm::vec2(2, 2.5) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 K = 1.0f + A;
|
||||
Error += K == glm::vec2(2, 3) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 L = 1.0f - B;
|
||||
Error += L == glm::vec2(-3, -4) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 M = 2.0f * A;
|
||||
Error += M == glm::vec2(2, 4) ? 0 : 1;
|
||||
|
||||
|
||||
glm::vec2 N = 2.0f / B;
|
||||
Error += N == glm::vec2(0.5, 2.0 / 5.0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B(4.0f, 5.0f);
|
||||
|
||||
|
||||
A += B;
|
||||
Error += A == glm::vec2(5, 7) ? 0 : 1;
|
||||
|
||||
|
||||
A += 1.0f;
|
||||
Error += A == glm::vec2(6, 8) ? 0 : 1;
|
||||
}
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B(4.0f, 5.0f);
|
||||
|
||||
|
||||
B -= A;
|
||||
Error += B == glm::vec2(3, 3) ? 0 : 1;
|
||||
|
||||
|
||||
B -= 1.0f;
|
||||
Error += B == glm::vec2(2, 2) ? 0 : 1;
|
||||
}
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B(4.0f, 5.0f);
|
||||
|
||||
|
||||
A *= B;
|
||||
Error += A == glm::vec2(4, 10) ? 0 : 1;
|
||||
|
||||
|
||||
A *= 2.0f;
|
||||
Error += A == glm::vec2(8, 20) ? 0 : 1;
|
||||
}
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B(4.0f, 5.0f);
|
||||
|
||||
|
||||
B /= A;
|
||||
Error += B == glm::vec2(4, 2.5) ? 0 : 1;
|
||||
|
||||
|
||||
B /= 2.0f;
|
||||
Error += B == glm::vec2(2, 1.25) ? 0 : 1;
|
||||
}
|
||||
@ -186,39 +189,39 @@ int test_vec2_operators()
|
||||
B /= B.y;
|
||||
Error += B == glm::vec2(1.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B = -A;
|
||||
Error += B == glm::vec2(-1.0f, -2.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B = --A;
|
||||
Error += B == glm::vec2(0.0f, 1.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B = A--;
|
||||
Error += B == glm::vec2(1.0f, 2.0f) ? 0 : 1;
|
||||
Error += A == glm::vec2(0.0f, 1.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B = ++A;
|
||||
Error += B == glm::vec2(2.0f, 3.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
glm::vec2 A(1.0f, 2.0f);
|
||||
glm::vec2 B = A++;
|
||||
Error += B == glm::vec2(1.0f, 2.0f) ? 0 : 1;
|
||||
Error += A == glm::vec2(2.0f, 3.0f) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
@ -283,14 +286,15 @@ int test_vec2_ctor()
|
||||
int test_vec2_size()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
|
||||
Error += sizeof(glm::vec2) == sizeof(glm::mediump_vec2) ? 0 : 1;
|
||||
Error += 8 == sizeof(glm::mediump_vec2) ? 0 : 1;
|
||||
Error += sizeof(glm::dvec2) == sizeof(glm::highp_dvec2) ? 0 : 1;
|
||||
Error += 16 == sizeof(glm::highp_dvec2) ? 0 : 1;
|
||||
Error += glm::vec2().length() == 2 ? 0 : 1;
|
||||
Error += glm::dvec2().length() == 2 ? 0 : 1;
|
||||
|
||||
Error += glm::vec2::components == 2 ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
@ -328,6 +332,10 @@ int main()
|
||||
glm::vec2 v;
|
||||
assert(v.length() == 2);
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
assert(glm::vec2::components == 2);
|
||||
# endif
|
||||
|
||||
Error += test_vec2_size();
|
||||
Error += test_vec2_ctor();
|
||||
Error += test_vec2_operators();
|
||||
|
@ -29,6 +29,9 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# define GLM_META_PROG_HELPERS
|
||||
#endif
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/geometric.hpp>
|
||||
@ -263,7 +266,7 @@ int test_vec3_size()
|
||||
Error += 24 == sizeof(glm::highp_dvec3) ? 0 : 1;
|
||||
Error += glm::vec3().length() == 3 ? 0 : 1;
|
||||
Error += glm::dvec3().length() == 3 ? 0 : 1;
|
||||
|
||||
Error += glm::vec3::components == 3 ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
@ -494,6 +497,13 @@ int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::vec3 v;
|
||||
assert(v.length() == 3);
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
assert(glm::vec3::components == 3);
|
||||
# endif
|
||||
|
||||
Error += test_vec3_ctor();
|
||||
Error += test_vec3_operators();
|
||||
Error += test_vec3_size();
|
||||
|
@ -30,6 +30,9 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#define GLM_FORCE_AVX2
|
||||
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# define GLM_META_PROG_HELPERS
|
||||
#endif
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
@ -398,7 +401,7 @@ int test_vec4_perf_AoS(std::size_t Size)
|
||||
|
||||
std::clock_t EndTime = std::clock();
|
||||
|
||||
std::printf("AoS: %d\n", EndTime - StartTime);
|
||||
std::printf("AoS: %ld\n", EndTime - StartTime);
|
||||
|
||||
return Error;
|
||||
}
|
||||
@ -437,18 +440,48 @@ int test_vec4_perf_SoA(std::size_t Size)
|
||||
|
||||
std::clock_t EndTime = std::clock();
|
||||
|
||||
std::printf("SoA: %d\n", EndTime - StartTime);
|
||||
std::printf("SoA: %ld\n", EndTime - StartTime);
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
namespace heap
|
||||
{
|
||||
class A
|
||||
{
|
||||
float f;
|
||||
};
|
||||
|
||||
class B : public A
|
||||
{
|
||||
float g;
|
||||
glm::vec4 v;
|
||||
};
|
||||
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
A* p = new B;
|
||||
delete p;
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace heap
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
std::size_t const Size(1000000);
|
||||
glm::vec4 v;
|
||||
assert(v.length() == 4);
|
||||
|
||||
# ifdef GLM_META_PROG_HELPERS
|
||||
assert(glm::vec4::components == 4);
|
||||
# endif
|
||||
|
||||
# ifdef NDEBUG
|
||||
std::size_t const Size(1000000);
|
||||
Error += test_vec4_perf_AoS(Size);
|
||||
Error += test_vec4_perf_SoA(Size);
|
||||
# endif//NDEBUG
|
||||
@ -458,6 +491,7 @@ int main()
|
||||
Error += test_vec4_operators();
|
||||
Error += test_vec4_swizzle_partial();
|
||||
Error += test_operator_increment();
|
||||
Error += heap::test();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
@ -631,11 +631,13 @@ namespace bitfieldInterleave
|
||||
std::printf("glm::detail::bitfieldInterleave Time %d clocks\n", static_cast<unsigned int>(Time));
|
||||
}
|
||||
|
||||
# if(GLM_ARCH != GLM_ARCH_PURE)
|
||||
# if(GLM_ARCH != GLM_ARCH_PURE && !(GLM_COMPILER & GLM_COMPILER_GCC))
|
||||
{
|
||||
// SIMD
|
||||
std::vector<__m128i> SimdData(x_max * y_max);
|
||||
std::vector<__m128i> SimdParam(x_max * y_max);
|
||||
std::vector<__m128i> SimdData;
|
||||
SimdData.resize(x_max * y_max);
|
||||
std::vector<__m128i> SimdParam;
|
||||
SimdParam.resize(x_max * y_max);
|
||||
for(int i = 0; i < SimdParam.size(); ++i)
|
||||
SimdParam[i] = _mm_set_epi32(i % x_max, 0, i / y_max, 0);
|
||||
|
||||
|
@ -39,20 +39,34 @@ namespace srgb
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
glm::vec4 const ColorSourceRGB(1.0, 0.5, 0.0, 1.0);
|
||||
glm::vec3 const ColorSourceRGB(1.0, 0.5, 0.0);
|
||||
|
||||
{
|
||||
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB);
|
||||
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB);
|
||||
glm::vec3 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB);
|
||||
glm::vec3 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB);
|
||||
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB, 2.8f);
|
||||
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f);
|
||||
glm::vec3 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGB, 2.8f);
|
||||
glm::vec3 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f);
|
||||
Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
glm::vec4 const ColorSourceRGBA(1.0, 0.5, 0.0, 1.0);
|
||||
|
||||
{
|
||||
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGBA);
|
||||
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB);
|
||||
Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::vec4 const ColorSRGB = glm::convertRgbToSrgb(ColorSourceRGBA, 2.8f);
|
||||
glm::vec4 const ColorRGB = glm::convertSrgbToRgb(ColorSRGB, 2.8f);
|
||||
Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace srgb
|
||||
|
@ -99,7 +99,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<int>: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<int>: %ld clocks\n", End - Begin);
|
||||
}
|
||||
|
||||
{
|
||||
@ -113,7 +113,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<ivec4>: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<ivec4>: %ld clocks\n", End - Begin);
|
||||
}
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
@ -135,7 +135,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<ivec4> inlined: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<ivec4> inlined: %ld clocks\n", End - Begin);
|
||||
}
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<ivec4> inlined no cast: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<ivec4> inlined no cast: %ld clocks\n", End - Begin);
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<ivec4> reinterpret: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<ivec4> reinterpret: %ld clocks\n", End - Begin);
|
||||
}
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
|
||||
@ -190,7 +190,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<float>: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<float>: %ld clocks\n", End - Begin);
|
||||
}
|
||||
|
||||
{
|
||||
@ -204,7 +204,7 @@ namespace log2_
|
||||
|
||||
std::clock_t End = clock();
|
||||
|
||||
printf("glm::log2<vec4>: %d clocks\n", End - Begin);
|
||||
printf("glm::log2<vec4>: %ld clocks\n", End - Begin);
|
||||
}
|
||||
|
||||
return Error;
|
||||
|
@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@ -29,6 +29,7 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_META_PROG_HELPERS
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <glm/vector_relational.hpp>
|
||||
@ -324,6 +325,8 @@ int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
assert(glm::quat::components == 4);
|
||||
|
||||
Error += test_quat_ctr();
|
||||
Error += test_quat_mul_vec();
|
||||
Error += test_quat_two_axis_ctr();
|
||||
|
@ -48,3 +48,4 @@ glmCreateTestGTC(gtx_string_cast)
|
||||
glmCreateTestGTC(gtx_type_aligned)
|
||||
glmCreateTestGTC(gtx_vector_angle)
|
||||
glmCreateTestGTC(gtx_vector_query)
|
||||
glmCreateTestGTC(gtx_wrap)
|
||||
|
@ -35,5 +35,15 @@ int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += glm::isfinite(1.0f) ? 0 : 1;
|
||||
Error += glm::isfinite(1.0) ? 0 : 1;
|
||||
Error += glm::isfinite(-1.0f) ? 0 : 1;
|
||||
Error += glm::isfinite(-1.0) ? 0 : 1;
|
||||
|
||||
Error += glm::all(glm::isfinite(glm::vec4(1.0f))) ? 0 : 1;
|
||||
Error += glm::all(glm::isfinite(glm::dvec4(1.0))) ? 0 : 1;
|
||||
Error += glm::all(glm::isfinite(glm::vec4(-1.0f))) ? 0 : 1;
|
||||
Error += glm::all(glm::isfinite(glm::dvec4(-1.0))) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
@ -31,10 +31,16 @@
|
||||
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtx/fast_trigonometry.hpp>
|
||||
#include <glm/gtx/integer.hpp>
|
||||
#include <glm/gtx/common.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/gtc/ulp.hpp>
|
||||
#include <glm/gtc/vec1.hpp>
|
||||
#include <glm/trigonometric.hpp>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
||||
namespace fastCos
|
||||
{
|
||||
@ -43,12 +49,15 @@ namespace fastCos
|
||||
const float begin = -glm::pi<float>();
|
||||
const float end = glm::pi<float>();
|
||||
float result = 0.f;
|
||||
|
||||
const std::clock_t timestamp1 = std::clock();
|
||||
for(float i=begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::fastCos(i);
|
||||
|
||||
const std::clock_t timestamp2 = std::clock();
|
||||
for(float i=begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::cos(i);
|
||||
|
||||
const std::clock_t timestamp3 = std::clock();
|
||||
const std::clock_t time_fast = timestamp2 - timestamp1;
|
||||
const std::clock_t time_default = timestamp3 - timestamp2;
|
||||
@ -74,12 +83,15 @@ namespace fastSin
|
||||
const float begin = -glm::pi<float>();
|
||||
const float end = glm::pi<float>();
|
||||
float result = 0.f;
|
||||
|
||||
const std::clock_t timestamp1 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::fastSin(i);
|
||||
|
||||
const std::clock_t timestamp2 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::sin(i);
|
||||
|
||||
const std::clock_t timestamp3 = std::clock();
|
||||
const std::clock_t time_fast = timestamp2 - timestamp1;
|
||||
const std::clock_t time_default = timestamp3 - timestamp2;
|
||||
@ -97,12 +109,15 @@ namespace fastTan
|
||||
const float begin = -glm::pi<float>();
|
||||
const float end = glm::pi<float>();
|
||||
float result = 0.f;
|
||||
|
||||
const std::clock_t timestamp1 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::fastTan(i);
|
||||
|
||||
const std::clock_t timestamp2 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for (float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::tan(i);
|
||||
|
||||
const std::clock_t timestamp3 = std::clock();
|
||||
const std::clock_t time_fast = timestamp2 - timestamp1;
|
||||
const std::clock_t time_default = timestamp3 - timestamp2;
|
||||
@ -120,15 +135,19 @@ namespace fastAcos
|
||||
const float begin = -glm::pi<float>();
|
||||
const float end = glm::pi<float>();
|
||||
float result = 0.f;
|
||||
|
||||
const std::clock_t timestamp1 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::fastAcos(i);
|
||||
|
||||
const std::clock_t timestamp2 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::acos(i);
|
||||
|
||||
const std::clock_t timestamp3 = std::clock();
|
||||
const std::clock_t time_fast = timestamp2 - timestamp1;
|
||||
const std::clock_t time_default = timestamp3 - timestamp2;
|
||||
|
||||
std::printf("fastAcos Time %d clocks\n", static_cast<unsigned int>(time_fast));
|
||||
std::printf("acos Time %d clocks\n", static_cast<unsigned int>(time_default));
|
||||
|
||||
@ -144,10 +163,10 @@ namespace fastAsin
|
||||
const float end = glm::pi<float>();
|
||||
float result = 0.f;
|
||||
const std::clock_t timestamp1 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::fastAsin(i);
|
||||
const std::clock_t timestamp2 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::asin(i);
|
||||
const std::clock_t timestamp3 = std::clock();
|
||||
const std::clock_t time_fast = timestamp2 - timestamp1;
|
||||
@ -167,10 +186,10 @@ namespace fastAtan
|
||||
const float end = glm::pi<float>();
|
||||
float result = 0.f;
|
||||
const std::clock_t timestamp1 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::fastAtan(i);
|
||||
const std::clock_t timestamp2 = std::clock();
|
||||
for (float i = begin; i<end; i = glm::next_float(i, end))
|
||||
for(float i = begin; i < end; i = glm::next_float(i))
|
||||
result = glm::atan(i);
|
||||
const std::clock_t timestamp3 = std::clock();
|
||||
const std::clock_t time_fast = timestamp2 - timestamp1;
|
||||
@ -182,10 +201,269 @@ namespace fastAtan
|
||||
}
|
||||
}//namespace fastAtan
|
||||
|
||||
namespace taylorCos
|
||||
{
|
||||
glm::vec4 const AngleShift(0.0f, glm::pi<float>() * 0.5f, glm::pi<float>() * 1.0f, glm::pi<float>() * 1.5f);
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> taylorSeriesNewCos(vecType<T, P> const & x)
|
||||
{
|
||||
vecType<T, P> const Powed2(x * x);
|
||||
vecType<T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<T, P> const Powed6(Powed4 * Powed2);
|
||||
vecType<T, P> const Powed8(Powed4 * Powed4);
|
||||
|
||||
return static_cast<T>(1)
|
||||
- Powed2 * static_cast<T>(0.5)
|
||||
+ Powed4 * static_cast<T>(0.04166666666666666666666666666667)
|
||||
- Powed6 * static_cast<T>(0.00138888888888888888888888888889)
|
||||
+ Powed8 * static_cast<T>(2.4801587301587301587301587301587e-5);
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> taylorSeriesNewCos6(vecType<T, P> const & x)
|
||||
{
|
||||
vecType<T, P> const Powed2(x * x);
|
||||
vecType<T, P> const Powed4(Powed2 * Powed2);
|
||||
vecType<T, P> const Powed6(Powed4 * Powed2);
|
||||
|
||||
return static_cast<T>(1)
|
||||
- Powed2 * static_cast<T>(0.5)
|
||||
+ Powed4 * static_cast<T>(0.04166666666666666666666666666667)
|
||||
- Powed6 * static_cast<T>(0.00138888888888888888888888888889);
|
||||
}
|
||||
|
||||
template <glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<float, P> fastAbs(vecType<float, P> x)
|
||||
{
|
||||
int* Pointer = reinterpret_cast<int*>(&x[0]);
|
||||
Pointer[0] &= 0x7fffffff;
|
||||
Pointer[1] &= 0x7fffffff;
|
||||
Pointer[2] &= 0x7fffffff;
|
||||
Pointer[3] &= 0x7fffffff;
|
||||
return x;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> fastCosNew(vecType<T, P> const & x)
|
||||
{
|
||||
vecType<T, P> const Angle0_PI(fastAbs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
return taylorSeriesNewCos6(x);
|
||||
/*
|
||||
vecType<bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<T, P> const RevertAngle(mix(vecType<T, P>(glm::pi<T>()), vecType<T, P>(0), FirstQuarterPi));
|
||||
vecType<T, P> const ReturnSign(mix(vecType<T, P>(-1), vecType<T, P>(1), FirstQuarterPi));
|
||||
vecType<T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesNewCos(SectionAngle);
|
||||
*/
|
||||
}
|
||||
|
||||
int perf_fastCosNew(float Begin, float End, std::size_t Samples)
|
||||
{
|
||||
std::vector<glm::vec4> Results;
|
||||
Results.resize(Samples);
|
||||
|
||||
float Steps = (End - Begin) / Samples;
|
||||
|
||||
std::clock_t const TimeStampBegin = std::clock();
|
||||
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Results[i] = fastCosNew(AngleShift + glm::vec4(Begin + Steps * i));
|
||||
|
||||
std::clock_t const TimeStampEnd = std::clock();
|
||||
|
||||
std::printf("fastCosNew %ld clocks\n", TimeStampEnd - TimeStampBegin);
|
||||
|
||||
int Error = 0;
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Error += Results[i].x >= -1.0f && Results[i].x <= 1.0f ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> deterministic_fmod(vecType<T, P> const & x, T y)
|
||||
{
|
||||
return x - y * trunc(x / y);
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> fastCosDeterminisctic(vecType<T, P> const & x)
|
||||
{
|
||||
vecType<T, P> const Angle0_PI(abs(deterministic_fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
vecType<bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<T, P> const RevertAngle(mix(vecType<T, P>(glm::pi<T>()), vecType<T, P>(0), FirstQuarterPi));
|
||||
vecType<T, P> const ReturnSign(mix(vecType<T, P>(-1), vecType<T, P>(1), FirstQuarterPi));
|
||||
vecType<T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesNewCos(SectionAngle);
|
||||
}
|
||||
|
||||
int perf_fastCosDeterminisctic(float Begin, float End, std::size_t Samples)
|
||||
{
|
||||
std::vector<glm::vec4> Results;
|
||||
Results.resize(Samples);
|
||||
|
||||
float Steps = (End - Begin) / Samples;
|
||||
|
||||
std::clock_t const TimeStampBegin = std::clock();
|
||||
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Results[i] = taylorCos::fastCosDeterminisctic(AngleShift + glm::vec4(Begin + Steps * i));
|
||||
|
||||
std::clock_t const TimeStampEnd = std::clock();
|
||||
|
||||
std::printf("fastCosDeterminisctic %ld clocks\n", TimeStampEnd - TimeStampBegin);
|
||||
|
||||
int Error = 0;
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Error += Results[i].x >= -1.0f && Results[i].x <= 1.0f ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> taylorSeriesRefCos(vecType<T, P> const & x)
|
||||
{
|
||||
return static_cast<T>(1)
|
||||
- (x * x) / glm::factorial(static_cast<T>(2))
|
||||
+ (x * x * x * x) / glm::factorial(static_cast<T>(4))
|
||||
- (x * x * x * x * x * x) / glm::factorial(static_cast<T>(6))
|
||||
+ (x * x * x * x * x * x * x * x) / glm::factorial(static_cast<T>(8));
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> fastRefCos(vecType<T, P> const & x)
|
||||
{
|
||||
vecType<T, P> const Angle0_PI(glm::abs(fmod(x + glm::pi<T>(), glm::two_pi<T>()) - glm::pi<T>()));
|
||||
// return taylorSeriesRefCos(Angle0_PI);
|
||||
|
||||
vecType<bool, P> const FirstQuarterPi(lessThanEqual(Angle0_PI, vecType<T, P>(glm::half_pi<T>())));
|
||||
|
||||
vecType<T, P> const RevertAngle(mix(vecType<T, P>(glm::pi<T>()), vecType<T, P>(0), FirstQuarterPi));
|
||||
vecType<T, P> const ReturnSign(mix(vecType<T, P>(-1), vecType<T, P>(1), FirstQuarterPi));
|
||||
vecType<T, P> const SectionAngle(RevertAngle - Angle0_PI);
|
||||
|
||||
return ReturnSign * taylorSeriesRefCos(SectionAngle);
|
||||
}
|
||||
|
||||
int perf_fastCosRef(float Begin, float End, std::size_t Samples)
|
||||
{
|
||||
std::vector<glm::vec4> Results;
|
||||
Results.resize(Samples);
|
||||
|
||||
float Steps = (End - Begin) / Samples;
|
||||
|
||||
std::clock_t const TimeStampBegin = std::clock();
|
||||
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Results[i] = taylorCos::fastRefCos(AngleShift + glm::vec4(Begin + Steps * i));
|
||||
|
||||
std::clock_t const TimeStampEnd = std::clock();
|
||||
|
||||
std::printf("fastCosRef %ld clocks\n", TimeStampEnd - TimeStampBegin);
|
||||
|
||||
int Error = 0;
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Error += Results[i].x >= -1.0f && Results[i].x <= 1.0f ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int perf_fastCosOld(float Begin, float End, std::size_t Samples)
|
||||
{
|
||||
std::vector<glm::vec4> Results;
|
||||
Results.resize(Samples);
|
||||
|
||||
float Steps = (End - Begin) / Samples;
|
||||
|
||||
std::clock_t const TimeStampBegin = std::clock();
|
||||
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Results[i] = glm::fastCos(AngleShift + glm::vec4(Begin + Steps * i));
|
||||
|
||||
std::clock_t const TimeStampEnd = std::clock();
|
||||
|
||||
std::printf("fastCosOld %ld clocks\n", TimeStampEnd - TimeStampBegin);
|
||||
|
||||
int Error = 0;
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Error += Results[i].x >= -1.0f && Results[i].x <= 1.0f ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int perf_cos(float Begin, float End, std::size_t Samples)
|
||||
{
|
||||
std::vector<glm::vec4> Results;
|
||||
Results.resize(Samples);
|
||||
|
||||
float Steps = (End - Begin) / Samples;
|
||||
|
||||
std::clock_t const TimeStampBegin = std::clock();
|
||||
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Results[i] = glm::cos(AngleShift + glm::vec4(Begin + Steps * i));
|
||||
|
||||
std::clock_t const TimeStampEnd = std::clock();
|
||||
|
||||
std::printf("cos %ld clocks\n", TimeStampEnd - TimeStampBegin);
|
||||
|
||||
int Error = 0;
|
||||
for(std::size_t i = 0; i < Samples; ++i)
|
||||
Error += Results[i].x >= -1.0f && Results[i].x <= 1.0f ? 0 : 1;
|
||||
return Error;
|
||||
}
|
||||
|
||||
int perf()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
float const Begin = -glm::pi<float>();
|
||||
float const End = glm::pi<float>();
|
||||
std::size_t const Samples = 10000000;
|
||||
|
||||
Error += perf_cos(Begin, End, Samples);
|
||||
Error += perf_fastCosOld(Begin, End, Samples);
|
||||
Error += perf_fastCosRef(Begin, End, Samples);
|
||||
//Error += perf_fastCosNew(Begin, End, Samples);
|
||||
Error += perf_fastCosDeterminisctic(Begin, End, Samples);
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
//for(float Angle = -4.0f * glm::pi<float>(); Angle < 4.0f * glm::pi<float>(); Angle += 0.1f)
|
||||
//for(float Angle = -720.0f; Angle < 720.0f; Angle += 0.1f)
|
||||
for(float Angle = 0.0f; Angle < 180.0f; Angle += 0.1f)
|
||||
{
|
||||
float const modAngle = std::fmod(glm::abs(Angle), 360.f);
|
||||
assert(modAngle >= 0.0f && modAngle <= 360.f);
|
||||
float const radAngle = glm::radians(modAngle);
|
||||
float const Cos0 = std::cos(radAngle);
|
||||
|
||||
float const Cos1 = taylorCos::fastRefCos(glm::fvec1(radAngle)).x;
|
||||
Error += glm::abs(Cos1 - Cos0) < 0.1f ? 0 : 1;
|
||||
|
||||
float const Cos2 = taylorCos::fastCosNew(glm::fvec1(radAngle)).x;
|
||||
//Error += glm::abs(Cos2 - Cos0) < 0.1f ? 0 : 1;
|
||||
|
||||
assert(!Error);
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace taylorCos
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += ::taylorCos::test();
|
||||
Error += ::taylorCos::perf();
|
||||
|
||||
# ifdef NDEBUG
|
||||
Error += ::fastCos::perf();
|
||||
Error += ::fastSin::perf();
|
||||
|
@ -47,7 +47,7 @@ int test_decl()
|
||||
glm::vec4 B;
|
||||
};
|
||||
|
||||
printf("vec4 - Aligned: %d, unaligned: %d\n", sizeof(S1), sizeof(S2));
|
||||
printf("vec4 - Aligned: %ld, unaligned: %ld\n", sizeof(S1), sizeof(S2));
|
||||
|
||||
Error += sizeof(S1) >= sizeof(S2) ? 0 : 1;
|
||||
}
|
||||
@ -65,7 +65,7 @@ int test_decl()
|
||||
glm::aligned_vec3 B;
|
||||
};
|
||||
|
||||
printf("vec3: %d, aligned: %d\n", sizeof(S1), sizeof(S2));
|
||||
printf("vec3: %ld, aligned: %ld\n", sizeof(S1), sizeof(S2));
|
||||
|
||||
Error += sizeof(S1) <= sizeof(S2) ? 0 : 1;
|
||||
}
|
||||
@ -83,7 +83,7 @@ int test_decl()
|
||||
glm::vec4 B;
|
||||
};
|
||||
|
||||
printf("vec4 - Aligned: %d, unaligned: %d\n", sizeof(S1), sizeof(S2));
|
||||
printf("vec4 - Aligned: %ld, unaligned: %ld\n", sizeof(S1), sizeof(S2));
|
||||
|
||||
Error += sizeof(S1) >= sizeof(S2) ? 0 : 1;
|
||||
}
|
||||
@ -101,7 +101,7 @@ int test_decl()
|
||||
glm::dvec4 B;
|
||||
};
|
||||
|
||||
printf("dvec4 - Aligned: %d, unaligned: %d\n", sizeof(S1), sizeof(S2));
|
||||
printf("dvec4 - Aligned: %ld, unaligned: %ld\n", sizeof(S1), sizeof(S2));
|
||||
|
||||
Error += sizeof(S1) >= sizeof(S2) ? 0 : 1;
|
||||
}
|
||||
|
172
test/gtx/gtx_wrap.cpp
Normal file
172
test/gtx/gtx_wrap.cpp
Normal file
@ -0,0 +1,172 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @file test/gtx/gtx_normal.cpp
|
||||
/// @date 2013-10-25 / 2014-11-25
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/gtx/wrap.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
|
||||
namespace clamp
|
||||
{
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
float A = glm::clamp(0.5f);
|
||||
Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float B = glm::clamp(0.0f);
|
||||
Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float C = glm::clamp(1.0f);
|
||||
Error += glm::epsilonEqual(C, 1.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float D = glm::clamp(-0.5f);
|
||||
Error += glm::epsilonEqual(D, 0.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float E = glm::clamp(1.5f);
|
||||
Error += glm::epsilonEqual(E, 1.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace clamp
|
||||
|
||||
namespace repeat
|
||||
{
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
float A = glm::repeat(0.5f);
|
||||
Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float B = glm::repeat(0.0f);
|
||||
Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float C = glm::repeat(1.0f);
|
||||
Error += glm::epsilonEqual(C, 0.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float D = glm::repeat(-0.5f);
|
||||
Error += glm::epsilonEqual(D, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float E = glm::repeat(1.5f);
|
||||
Error += glm::epsilonEqual(E, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float F = glm::repeat(0.9f);
|
||||
Error += glm::epsilonEqual(F, 0.9f, 0.00001f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace repeat
|
||||
|
||||
namespace mirrorClamp
|
||||
{
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
float A = glm::mirrorClamp(0.5f);
|
||||
Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float B = glm::mirrorClamp(0.0f);
|
||||
Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float C = glm::mirrorClamp(1.1f);
|
||||
Error += glm::epsilonEqual(C, 0.1f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float D = glm::mirrorClamp(-0.5f);
|
||||
Error += glm::epsilonEqual(D, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float E = glm::mirrorClamp(1.5f);
|
||||
Error += glm::epsilonEqual(E, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float F = glm::mirrorClamp(0.9f);
|
||||
Error += glm::epsilonEqual(F, 0.9f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float G = glm::mirrorClamp(3.1f);
|
||||
Error += glm::epsilonEqual(G, 0.1f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float H = glm::mirrorClamp(-3.1f);
|
||||
Error += glm::epsilonEqual(H, 0.1f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float I = glm::mirrorClamp(-0.9f);
|
||||
Error += glm::epsilonEqual(I, 0.9f, 0.00001f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace mirrorClamp
|
||||
|
||||
namespace mirrorRepeat
|
||||
{
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
float A = glm::mirrorRepeat(0.5f);
|
||||
Error += glm::epsilonEqual(A, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float B = glm::mirrorRepeat(0.0f);
|
||||
Error += glm::epsilonEqual(B, 0.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float C = glm::mirrorRepeat(1.0f);
|
||||
Error += glm::epsilonEqual(C, 1.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float D = glm::mirrorRepeat(-0.5f);
|
||||
Error += glm::epsilonEqual(D, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float E = glm::mirrorRepeat(1.5f);
|
||||
Error += glm::epsilonEqual(E, 0.5f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float F = glm::mirrorRepeat(0.9f);
|
||||
Error += glm::epsilonEqual(F, 0.9f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float G = glm::mirrorRepeat(3.0f);
|
||||
Error += glm::epsilonEqual(G, 1.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float H = glm::mirrorRepeat(-3.0f);
|
||||
Error += glm::epsilonEqual(H, 1.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
float I = glm::mirrorRepeat(-1.0f);
|
||||
Error += glm::epsilonEqual(I, 1.0f, 0.00001f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace mirrorRepeat
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += clamp::test();
|
||||
Error += repeat::test();
|
||||
Error += mirrorClamp::test();
|
||||
Error += mirrorRepeat::test();
|
||||
|
||||
return Error;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindGLM.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
|
||||
|
@ -1,63 +0,0 @@
|
||||
# FindGLM - attempts to locate the glm matrix/vector library.
|
||||
#
|
||||
# This module defines the following variables (on success):
|
||||
# GLM_INCLUDE_DIRS - where to find glm/glm.hpp
|
||||
# GLM_FOUND - if the library was successfully located
|
||||
#
|
||||
# It is trying a few standard installation locations, but can be customized
|
||||
# with the following variables:
|
||||
# GLM_ROOT_DIR - root directory of a glm installation
|
||||
# Headers are expected to be found in either:
|
||||
# <GLM_ROOT_DIR>/glm/glm.hpp OR
|
||||
# <GLM_ROOT_DIR>/include/glm/glm.hpp
|
||||
# This variable can either be a cmake or environment
|
||||
# variable. Note however that changing the value
|
||||
# of the environment varible will NOT result in
|
||||
# re-running the header search and therefore NOT
|
||||
# adjust the variables set by this module.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2012 Carsten Neumann
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# default search dirs
|
||||
SET(_glm_HEADER_SEARCH_DIRS
|
||||
"/usr/include"
|
||||
"/usr/local/include")
|
||||
|
||||
# check environment variable
|
||||
SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
|
||||
|
||||
IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
|
||||
SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
|
||||
ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
|
||||
|
||||
# put user specified location at beginning of search
|
||||
IF(GLM_ROOT_DIR)
|
||||
SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
|
||||
"${GLM_ROOT_DIR}/include"
|
||||
${_glm_HEADER_SEARCH_DIRS})
|
||||
ENDIF(GLM_ROOT_DIR)
|
||||
|
||||
# locate header
|
||||
FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
|
||||
PATHS ${_glm_HEADER_SEARCH_DIRS})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
|
||||
GLM_INCLUDE_DIR)
|
||||
|
||||
IF(GLM_FOUND)
|
||||
SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
|
||||
|
||||
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
|
||||
ENDIF(GLM_FOUND)
|
Loading…
Reference in New Issue
Block a user