Merge pull request #4 from g-truc/master

update from g-truc
This commit is contained in:
Thom de Villa 2015-07-24 17:40:12 +02:00
commit 5100bd76dc
63 changed files with 2003 additions and 957 deletions

47
.gitignore vendored Normal file
View 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

View File

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

View 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()

View 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
View 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()

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -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
@ -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,8 +269,18 @@
# 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
@ -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
@ -633,8 +678,7 @@
#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
@ -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
///////////////////////////////////////////////////////////////////////////////////

View File

@ -54,6 +54,13 @@ 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];
@ -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);

View File

@ -50,6 +50,13 @@ 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
col_type value[2];
@ -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);

View File

@ -50,6 +50,13 @@ 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];
@ -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);

View File

@ -50,6 +50,13 @@ 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];
@ -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);

View File

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

View File

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

View File

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

View File

@ -50,6 +50,13 @@ 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
col_type value[4];
@ -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);

View File

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

View File

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

View File

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

View File

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

View File

@ -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
@ -225,15 +230,9 @@ namespace detail
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

View File

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

View File

@ -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,15 +108,10 @@ namespace glm
GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
//////////////////////////////////////
// Convertions
// Conversions
# 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
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tquat(tquat<U, Q> const & q);
// explicit conversion operators
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS

View File

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

View File

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

View File

@ -64,6 +64,11 @@ 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;
@ -105,13 +110,8 @@ 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);

View File

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

View File

@ -30,6 +30,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "compatibility.hpp" // glm::atan2
namespace glm
{
template <typename T>
@ -158,6 +160,41 @@ 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
)
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
)
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)
@ -102,10 +81,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> repeat
(
tvec3<T, P> const & Texcoord
)
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)
@ -114,10 +90,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> repeat
(
tvec4<T, P> const & Texcoord
)
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;
@ -148,10 +150,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> mirrorRepeat
(
tvec2<T, P> const & Texcoord
)
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)
@ -160,10 +159,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> mirrorRepeat
(
tvec3<T, P> const & Texcoord
)
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)
@ -172,10 +168,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> mirrorRepeat
(
tvec4<T, P> const & Texcoord
)
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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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>
@ -290,6 +293,7 @@ int test_vec2_size()
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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,3 +48,4 @@ glmCreateTestGTC(gtx_string_cast)
glmCreateTestGTC(gtx_type_aligned)
glmCreateTestGTC(gtx_vector_angle)
glmCreateTestGTC(gtx_vector_query)
glmCreateTestGTC(gtx_wrap)

View File

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

View File

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

View File

@ -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
View 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;
}

View File

@ -1,3 +0,0 @@
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindGLM.cmake
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)

View File

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