Merge remote-tracking branch 'upstream/master'

This commit is contained in:
jan p springer 2016-03-14 12:35:35 +00:00
commit ca7a4ed4fe
85 changed files with 1263 additions and 1815 deletions

View File

@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_policy(VERSION 2.6)
if (NOT CMAKE_VERSION VERSION_LESS "3.1")
cmake_policy(SET CMP0054 NEW)
endif()
project(glm)
set(GLM_VERSION "0.9.7")
set(GLM_VERSION "0.9.8")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -12,6 +16,16 @@ enable_testing()
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF)
if(NOT GLM_STATIC_LIBRARY_ENABLE)
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_STATIC_LIBRARY_ENABLE with ON to build an optional static library")
endif()
option(GLM_DYNAMIC_LIBRARY_ENABLE "GLM static library" OFF)
if(NOT GLM_DYNAMIC_LIBRARY_ENABLE)
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_DYNAMIC_LIBRARY_ENABLE with ON to build an optional dynamic library")
endif()
option(GLM_TEST_ENABLE "GLM test" OFF)
if(NOT GLM_TEST_ENABLE)
message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
@ -49,6 +63,12 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}"
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_CXX_FLAGS "-std=c++98")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# GLM is using GCC 64 bits integer extension
add_definitions(-Wno-long-long)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-Wno-c++11-long-long)
endif()
endif()
endif()

View File

@ -1,13 +0,0 @@
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "GLM")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=GLM")
set(CTEST_DROP_SITE_CDASH TRUE)

Binary file not shown.

View File

@ -40,5 +40,18 @@ if(GLM_TEST_ENABLE)
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
endif(GLM_TEST_ENABLE)
#add_library(glm STATIC glm.cpp)
#add_library(glm_shared SHARED glm.cpp)
if(GLM_STATIC_LIBRARY_ENABLE)
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
endif(GLM_STATIC_LIBRARY_ENABLE)
if(GLM_DYNAMIC_LIBRARY_ENABLE)
add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
endif(GLM_DYNAMIC_LIBRARY_ENABLE)

View File

@ -32,7 +32,7 @@
/// GLM is a header only library. There is nothing to compile.
/// dummy.cpp exist only a wordaround for CMake file.
///////////////////////////////////////////////////////////////////////////////////
/*
#define GLM_MESSAGES
#include <glm/glm.hpp>
#include <glm/ext.hpp>
@ -149,6 +149,8 @@ struct intersection
glm::vec4 position;
glm::vec3 normal;
};
*/
/*
// Sample 4
@ -191,7 +193,7 @@ glm::vec3 lighting
}
*/
/*
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
{
@ -211,9 +213,10 @@ typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
{
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
}
*/
int main()
{
/*
glm::vec1 o(1);
glm::vec2 a(1);
glm::vec3 b(1);
@ -227,6 +230,6 @@ int main()
float a0 = normalizeDotA(a, a);
float b0 = normalizeDotB(b, b);
float c0 = normalizeDotC(c, c);
*/
return 0;
}

View File

@ -548,14 +548,16 @@ namespace detail
# if GLM_HAS_CXX11_STL
return std::isnan(x);
# elif GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)
# elif GLM_COMPILER & GLM_COMPILER_VC
return _isnan(x) != 0;
# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
# if GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L
# elif GLM_COMPILER & GLM_COMPILER_INTEL
# if GLM_PLATFORM & GLM_PLATFORM_WINDOWS
return _isnan(x) != 0;
# else
return std::isnan(x);
return ::isnan(x) != 0;
# endif
# elif (GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))) && (GLM_PLATFORM & GLM_PLATFORM_ANDROID) && __cplusplus < 201103L
return _isnan(x) != 0;
# elif GLM_COMPILER & GLM_COMPILER_CUDA
return isnan(x) != 0;
# else
@ -583,7 +585,11 @@ namespace detail
# if GLM_HAS_CXX11_STL
return std::isinf(x);
# elif GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
# else
return ::isinf(x);
# endif
# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
return _isinf(x) != 0;
@ -662,7 +668,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'frexp' only accept floating-point inputs");
return std::frexp(x, exp);
return std::frexp(x, &exp);
}
template <typename T, precision P>
@ -670,7 +676,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
return tvec1<T, P>(std::frexp(x.x, exp.x));
return tvec1<T, P>(std::frexp(x.x, &exp.x));
}
template <typename T, precision P>
@ -706,7 +712,7 @@ namespace detail
frexp(x.w, exp.w));
}
template <typename genType, precision P>
template <typename genType>
GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'ldexp' only accept floating-point inputs");

View File

@ -72,19 +72,19 @@ namespace detail
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec3>
{
typedef tmat2x3<T, P> type;
typedef tmat3x2<T, P> type;
};
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec2, tvec4>
{
typedef tmat2x4<T, P> type;
typedef tmat4x2<T, P> type;
};
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec2>
{
typedef tmat3x2<T, P> type;
typedef tmat2x3<T, P> type;
};
template <typename T, precision P>
@ -96,19 +96,19 @@ namespace detail
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec3, tvec4>
{
typedef tmat3x4<T, P> type;
typedef tmat4x3<T, P> type;
};
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec2>
{
typedef tmat4x2<T, P> type;
typedef tmat2x4<T, P> type;
};
template <typename T, precision P>
struct outerProduct_trait<T, P, tvec4, tvec3>
{
typedef tmat4x3<T, P> type;
typedef tmat3x4<T, P> type;
};
template <typename T, precision P>

View File

@ -170,7 +170,7 @@ namespace glm
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(abs(x) + sqrt(static_cast<genType>(1) + x * x));
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(std::abs(x) + sqrt(static_cast<genType>(1) + x * x));
}
# endif
@ -210,7 +210,7 @@ namespace glm
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
if(abs(x) >= static_cast<genType>(1))
if(std::abs(x) >= static_cast<genType>(1))
return 0;
return static_cast<genType>(0.5) * log((static_cast<genType>(1) + x) / (static_cast<genType>(1) - x));
}

View File

@ -42,12 +42,4 @@ namespace glm
simd,
defaultp = highp
};
template <typename T, precision P, template <typename, precision> class genType>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm

View File

@ -151,6 +151,7 @@
#define GLM_COMPILER_GCC51 0x02000300
#define GLM_COMPILER_GCC52 0x02000400
#define GLM_COMPILER_GCC53 0x02000500
#define GLM_COMPILER_GCC60 0x02000600
// CUDA
#define GLM_COMPILER_CUDA 0x10000000
@ -201,7 +202,7 @@
# define GLM_COMPILER GLM_COMPILER_INTEL13
# elif __INTEL_COMPILER == 1400
# define GLM_COMPILER GLM_COMPILER_INTEL14
# elif __INTEL_COMPILER >= 1500
# elif __INTEL_COMPILER == 1500
# define GLM_COMPILER GLM_COMPILER_INTEL15
# elif __INTEL_COMPILER >= 1600
# define GLM_COMPILER GLM_COMPILER_INTEL16
@ -312,6 +313,8 @@
# define GLM_COMPILER (GLM_COMPILER_GCC52)
# elif (__GNUC__ == 5) && (__GNUC_MINOR__ >= 3)
# define GLM_COMPILER (GLM_COMPILER_GCC53)
# elif (__GNUC__ >= 6)
# define GLM_COMPILER (GLM_COMPILER_GCC60)
# else
# define GLM_COMPILER (GLM_COMPILER_GCC)
# endif
@ -371,7 +374,7 @@
///////////////////////////////////////////////////////////////////////////////////
// Platform
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 GLM_FORCE_AVX2
#define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_ARM 0x0001
@ -381,9 +384,12 @@
#define GLM_ARCH_SSE4 0x0010
#define GLM_ARCH_AVX 0x0020
#define GLM_ARCH_AVX2 0x0040
#define GLM_ARCH_AVX512 0x0080 // Skylake set
#if defined(GLM_FORCE_PURE)
# define GLM_ARCH GLM_ARCH_PURE
#elif defined(GLM_FORCE_AVX512)
# define GLM_ARCH (GLM_ARCH_AVX512 | GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_AVX2)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_AVX)
@ -395,13 +401,16 @@
#elif defined(GLM_FORCE_SSE2)
# define GLM_ARCH (GLM_ARCH_SSE2)
#elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX))
# if(__AVX2__)
// This is Skylake set of instruction set
# if defined(__AVX512BW__) && defined(__AVX512F__) && defined(__AVX512CD__) && defined(__AVX512VL__) && defined(__AVX512DQ__)
# define GLM_ARCH (GLM_ARCH_AVX512 | GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__AVX__)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__SSE3__)
# elif defined(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__SSE2__)
# elif defined(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH GLM_ARCH_PURE
@ -457,13 +466,6 @@
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE2
# include <emmintrin.h>
# if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
# endif
#endif//GLM_ARCH
#if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
@ -581,22 +583,18 @@
# ifdef _MSC_EXTENSIONS
# define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG
# else
# define GLM_MSC_EXT
# endif
# if __INTEL_CXX11_MODE__
# if __cplusplus >= 201402L
# define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG)
# elif __cplusplus >= 201103L
# define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG)
# else
# define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG)
# endif
# define GLM_MSC_EXT 0
# endif
# if __cplusplus >= 201402L
# define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT)
# elif __cplusplus >= 201103L
# define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT)
# elif __INTEL_CXX11_MODE__
# define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
# elif __cplusplus >= 199711L
# define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
# else
# if __cplusplus >= 199711L
# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
# else
# define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG)
# endif
# define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT)
# endif
# else // Unkown compiler
# if __cplusplus >= 201402L
@ -805,7 +803,7 @@
# define GLM_HAS_BITSCAN_WINDOWS 0
#else
# define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))))
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))))
#endif
// OpenMP
@ -894,6 +892,39 @@
# endif
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////
// Clip control
#ifdef GLM_DEPTH_ZERO_TO_ONE // Legacy 0.9.8 development
# error Define GLM_FORCE_DEPTH_ZERO_TO_ONE instead of GLM_DEPTH_ZERO_TO_ONE to use 0 to 1 clip space.
#endif
#define GLM_DEPTH_ZERO_TO_ONE 0x00000001
#define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002
#ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE
# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_ZERO_TO_ONE
#else
# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE
#endif
///////////////////////////////////////////////////////////////////////////////////
// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM
// to use left handed coordinate system by default.
#ifdef GLM_LEFT_HANDED // Legacy 0.9.8 development
# error Define GLM_FORCE_LEFT_HANDED instead of GLM_LEFT_HANDED left handed coordinate system by default.
#endif
#define GLM_LEFT_HANDED 0x00000001 // For DirectX, Metal, Vulkan
#define GLM_RIGHT_HANDED 0x00000002 // For OpenGL, default in GLM
#ifdef GLM_FORCE_LEFT_HANDED
# define GLM_COORDINATE_SYSTEM GLM_LEFT_HANDED
#else
# define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED
#endif
///////////////////////////////////////////////////////////////////////////////////
// Qualifiers
@ -1008,7 +1039,7 @@ namespace detail
}
}//namespace glm
# define GLM_COUNTOF(arr) glm::countof(arr)
#elif _MSC_VER
#elif defined(_MSC_VER)
# define GLM_COUNTOF(arr) _countof(arr)
#else
# define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])

View File

@ -52,12 +52,12 @@ namespace detail
i(0)
{}
GLM_FUNC_QUALIFIER uif32(float f) :
f(f)
GLM_FUNC_QUALIFIER uif32(float f_) :
f(f_)
{}
GLM_FUNC_QUALIFIER uif32(uint32 i) :
i(i)
GLM_FUNC_QUALIFIER uif32(uint32 i_) :
i(i_)
{}
float f;

View File

@ -54,17 +54,6 @@ 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 cols = 2;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -102,30 +91,22 @@ namespace glm
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);
GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x2(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -229,16 +210,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
} //namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -50,13 +50,6 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ 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 = 2;
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -99,30 +87,22 @@ namespace glm
template <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);
GLM_FUNC_DECL explicit tmat2x3(tmat4x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x3(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -207,16 +187,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ 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 = 2;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -101,30 +89,22 @@ namespace glm
template <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);
GLM_FUNC_DECL explicit tmat2x4(tmat4x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat2x4(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -197,7 +177,7 @@ namespace glm
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat3x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T s);
GLM_FUNC_DECL tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, const T& s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(T s, tmat2x4<T, P> const & m);
@ -209,16 +189,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -500,7 +493,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T s)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, const T& s)
{
return tmat2x4<T, P>(
m[0] / s,

View File

@ -50,18 +50,6 @@ 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 = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];
@ -106,30 +94,22 @@ namespace glm
template <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);
GLM_FUNC_DECL explicit tmat3x2(tmat4x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -215,15 +195,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -49,18 +49,6 @@ 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
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
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>
@ -110,30 +98,22 @@ namespace glm
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);
GLM_FUNC_DECL explicit tmat3x3(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x3(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -237,16 +217,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -56,14 +56,6 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ 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 = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];
@ -106,30 +94,22 @@ namespace glm
template <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);
GLM_FUNC_DECL explicit tmat3x4(tmat4x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat3x4(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -214,16 +194,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -50,18 +50,6 @@ 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 = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];
@ -111,30 +99,22 @@ namespace glm
template <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);
GLM_FUNC_DECL explicit tmat4x2(tmat4x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x2(tmat3x4<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -197,15 +177,15 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator*(typename tmat4x2<T, P>::col_type const & v, tmat4x2<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat2x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat3x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat4x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat2x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T const & s);
@ -219,16 +199,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -50,18 +50,6 @@ 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 = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];
@ -111,30 +99,22 @@ namespace glm
template <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);
GLM_FUNC_DECL explicit tmat4x3(tmat4x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x3(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x3(tmat3x4<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -219,16 +199,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -49,18 +49,6 @@ 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
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
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>
@ -115,30 +103,22 @@ namespace glm
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);
GLM_FUNC_DECL explicit tmat4x4(tmat2x3<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat3x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat2x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T, P> const & x);
GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x3<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat2x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x2<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat3x4<T, P> const & x);
GLM_FUNC_DECL GLM_EXPLICIT tmat4x4(tmat4x3<T, P> const & x);
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](size_type i);
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL col_type & operator[](length_type i);
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
// -- Unary arithmetic operators --
@ -242,16 +222,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -92,13 +92,6 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -54,15 +54,6 @@ 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
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -94,21 +85,12 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
// -- Implicit basic constructors --
@ -126,13 +108,13 @@ namespace glm
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec2<U, Q> const & v);
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec2<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec3<U, Q> const & v);
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec3<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
GLM_FUNC_DECL GLM_EXPLICIT tvec1(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
@ -322,16 +304,6 @@ namespace glm
template <precision P>
GLM_FUNC_DECL tvec1<bool, P> operator||(tvec1<bool, P> const & v1, tvec1<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec1>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,13 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::X(static_cast<T>(1));
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::ZERO(static_cast<T>(0));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -102,47 +95,25 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::size_type tvec1<T, P>::size() const
{
return 1;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::length_type tvec1<T, P>::length() const
{
return 1;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::length_type tvec1<T, P>::length() const
{
return 1;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
// -- Unary arithmetic operators --

View File

@ -49,21 +49,9 @@ namespace glm
{
// -- Implementation detail --
typedef T value_type;
typedef tvec2<T, P> type;
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
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type XY;
# endif
// -- Data --
@ -97,21 +85,12 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
// -- Implicit basic constructors --
@ -138,10 +117,10 @@ namespace glm
/// 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(tvec3<U, Q> const & v);
GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec3<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
GLM_FUNC_DECL GLM_EXPLICIT tvec2(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
@ -305,9 +284,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & scalar);
@ -414,16 +390,6 @@ namespace glm
template <precision P>
GLM_FUNC_DECL tvec2<bool, P> operator||(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec2>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -53,22 +53,6 @@ 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
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type XY;
static const type XZ;
static const type YZ;
static const type XYZ;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -102,21 +86,12 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
// -- Implicit basic constructors --
@ -143,19 +118,19 @@ namespace glm
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & a, B const & b);
GLM_FUNC_DECL tvec3(tvec2<A, Q> const & a, B const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
GLM_FUNC_DECL tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(A const & a, tvec2<B, Q> const & b);
GLM_FUNC_DECL tvec3(A const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
GLM_FUNC_DECL tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
/// 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(tvec4<U, Q> const & v);
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
@ -437,16 +412,6 @@ namespace glm
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> operator||(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -103,33 +103,9 @@ namespace detail
{
// -- Implementation detail --
typedef T value_type;
typedef tvec4<T, P> type;
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
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Data --
@ -167,21 +143,12 @@ namespace detail
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
// -- Implicit basic constructors --
@ -208,37 +175,37 @@ namespace detail
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, B b, C c);
GLM_FUNC_DECL tvec4(tvec2<A, Q> const & a, B b, C c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
GLM_FUNC_DECL tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(A a, tvec2<B, Q> const & b, C c);
GLM_FUNC_DECL tvec4(A a, tvec2<B, Q> const & b, C c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
GLM_FUNC_DECL tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(A a, B b, tvec2<C, Q> const & c);
GLM_FUNC_DECL tvec4(A a, B b, tvec2<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
GLM_FUNC_DECL tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & a, B b);
GLM_FUNC_DECL tvec4(tvec3<A, Q> const & a, B b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
GLM_FUNC_DECL tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(A a, tvec3<B, Q> const & b);
GLM_FUNC_DECL tvec4(A a, tvec3<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
GLM_FUNC_DECL tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
GLM_FUNC_DECL tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
@ -379,52 +346,52 @@ namespace detail
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, const T& scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, const T& scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, const T& scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar);
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, const T& scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
@ -438,12 +405,6 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL bool operator==(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, T scalar);
@ -550,16 +511,6 @@ namespace detail
template <precision P>
GLM_FUNC_DECL tvec4<bool, P> operator||(tvec4<bool, P> const & v1, tvec4<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec4>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,72 +32,6 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::X
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Y
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::W
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XY
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZ
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZW
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZ
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -270,47 +204,25 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::size_type tvec4<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::length_type tvec4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec4<T, P>::length_type tvec4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
// -- Unary arithmetic operators --
@ -730,7 +642,7 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x + scalar,
@ -739,6 +651,16 @@ namespace glm
v.w + scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec1<T, P> const & v2)
{
return tvec4<T, P>(
v1.x + v2.x,
v1.y + v2.x,
v1.z + v2.x,
v1.w + v2.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(T scalar, tvec4<T, P> const & v)
{
@ -749,6 +671,16 @@ namespace glm
scalar + v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec1<T, P> const & v1, tvec4<T, P> const & v2)
{
return tvec4<T, P>(
v1.x + v2.x,
v1.x + v2.y,
v1.x + v2.z,
v1.x + v2.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
@ -760,7 +692,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x - scalar,
@ -769,6 +701,16 @@ namespace glm
v.w - scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec1<T, P> const & v2)
{
return tvec4<T, P>(
v1.x - v2.x,
v1.y - v2.x,
v1.z - v2.x,
v1.w - v2.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(T scalar, tvec4<T, P> const & v)
{
@ -779,6 +721,16 @@ namespace glm
scalar - v.w);
}
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & v1, tvec4<T, P> const & v2)
{
return tvec4<T, P>(
v1.x - v2.x,
v1.x - v2.y,
v1.x - v2.z,
v1.x - v2.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
@ -790,7 +742,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x * scalar,
@ -799,6 +751,16 @@ namespace glm
v.w * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec1<T, P> const & v2)
{
return tvec4<T, P>(
v1.x * v2.x,
v1.y * v2.x,
v1.z * v2.x,
v1.w * v2.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(T scalar, tvec4<T, P> const & v)
{
@ -809,6 +771,16 @@ namespace glm
scalar * v.w);
}
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & v1, tvec4<T, P> const & v2)
{
return tvec4<T, P>(
v1.x * v2.x,
v1.x * v2.y,
v1.x * v2.z,
v1.x * v2.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
@ -820,7 +792,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar)
GLM_FUNC_QUALIFIER tvec4<T, P> operator/(tvec4<T, P> const & v, const T& scalar)
{
return tvec4<T, P>(
v.x / scalar,

View File

@ -87,20 +87,20 @@ namespace detail
glm::uint64 REG1(x);
glm::uint64 REG2(y);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFFull);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFFull);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FFull);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FFull);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0Full);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0Full);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333ull);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333ull);
REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);
REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);
REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555ull);
REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555ull);
return REG1 | (REG2 << 1);
}
@ -138,25 +138,25 @@ namespace detail
glm::uint64 REG2(y);
glm::uint64 REG3(z);
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF);
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF);
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF);
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull);
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull);
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF);
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull);
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F);
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full);
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3);
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull);
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249);
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull);
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull);
return REG1 | (REG2 << 1) | (REG3 << 2);
}
@ -168,25 +168,25 @@ namespace detail
glm::uint64 REG2(y);
glm::uint64 REG3(z);
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF);
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF);
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF);
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull);
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull);
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF);
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull);
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F);
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full);
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3);
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull);
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249);
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull);
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull);
return REG1 | (REG2 << 1) | (REG3 << 2);
}
@ -225,25 +225,25 @@ namespace detail
glm::uint64 REG3(z);
glm::uint64 REG4(w);
REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FF);
REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FF);
REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FF);
REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FF);
REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FFull);
REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FFull);
REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FFull);
REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FFull);
REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000F);
REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000F);
REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000F);
REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000F);
REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000Full);
REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000Full);
REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000Full);
REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000Full);
REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303);
REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303);
REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303);
REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303);
REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303ull);
REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303ull);
REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303ull);
REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303ull);
REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111);
REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111);
REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111);
REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111);
REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111ull);
REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111ull);
REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111ull);
REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111ull);
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
}

View File

@ -99,6 +99,32 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y);
/// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the
/// implementation, presumably the direction that is fastest.
///
/// @param x The values of the argument must be greater or equal to zero.
/// @tparam T floating point scalar types.
/// @tparam vecType vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see gtc_integer
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<int, P> iround(vecType<T, P> const & x);
/// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the
/// implementation, presumably the direction that is fastest.
///
/// @param x The values of the argument must be greater or equal to zero.
/// @tparam T floating point scalar types.
/// @tparam vecType vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see gtc_integer
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<uint, P> uround(vecType<T, P> const & x);
/// @}
} //namespace glm

View File

@ -62,4 +62,39 @@ namespace detail
};
# endif//GLM_HAS_BITSCAN_WINDOWS
}//namespace detail
template <typename genType>
GLM_FUNC_QUALIFIER int iround(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'iround' only accept floating-point inputs");
assert(static_cast<genType>(0.0) <= x);
return static_cast<int>(x + static_cast<genType>(0.5));
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<int, P> iround(vecType<T, P> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs");
assert(all(lessThanEqual(vecType<T, P>(0), x)));
return vecType<int, P>(x + static_cast<T>(0.5));
}
template <typename genType>
GLM_FUNC_QUALIFIER uint uround(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'uround' only accept floating-point inputs");
assert(static_cast<genType>(0.0) <= x);
return static_cast<uint>(x + static_cast<genType>(0.5));
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint, P> uround(vecType<T, P> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs");
assert(all(lessThanEqual(vecType<T, P>(0), x)));
return vecType<uint, P>(x + static_cast<T>(0.5));
}
}//namespace glm

View File

@ -150,30 +150,24 @@ namespace glm
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> ortho
(
T left,
T right,
T bottom,
T top,
T zNear,
T zFar
T left, T right,
T bottom, T top,
T zNear, T zFar
)
{
#ifdef GLM_LEFT_HANDED
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return orthoLH(left, right, bottom, top, zNear, zFar);
#else
# else
return orthoRH(left, right, bottom, top, zNear, zFar);
#endif
# endif
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> orthoLH
(
T left,
T right,
T bottom,
T top,
T zNear,
T zFar
T left, T right,
T bottom, T top,
T zNear, T zFar
)
{
tmat4x4<T, defaultp> Result(1);
@ -182,25 +176,23 @@ namespace glm
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = static_cast<T>(1) / (zFar - zNear);
Result[3][2] = - zNear / (zFar - zNear);
#else
Result[2][2] = static_cast<T>(2) / (zFar - zNear);
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = static_cast<T>(1) / (zFar - zNear);
Result[3][2] = - zNear / (zFar - zNear);
# else
Result[2][2] = static_cast<T>(2) / (zFar - zNear);
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
# endif
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> orthoRH
(
T left,
T right,
T bottom,
T top,
T zNear,
T zFar
T left, T right,
T bottom, T top,
T zNear, T zFar
)
{
tmat4x4<T, defaultp> Result(1);
@ -209,61 +201,54 @@ namespace glm
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = - static_cast<T>(1) / (zFar - zNear);
Result[3][2] = - zNear / (zFar - zNear);
#else
Result[2][2] = - static_cast<T>(2) / (zFar - zNear);
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = - static_cast<T>(1) / (zFar - zNear);
Result[3][2] = - zNear / (zFar - zNear);
# else
Result[2][2] = - static_cast<T>(2) / (zFar - zNear);
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
# endif
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> ortho
(
T left,
T right,
T bottom,
T top
T left, T right,
T bottom, T top
)
{
tmat4x4<T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - static_cast<T>(1);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
return Result;
tmat4x4<T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - static_cast<T>(1);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustum
(
T left,
T right,
T bottom,
T top,
T nearVal,
T farVal
T left, T right,
T bottom, T top,
T nearVal, T farVal
)
{
#ifdef GLM_LEFT_HANDED
return frustumLH(left, right, bottom, top, nearVal, farVal);
#else
return frustumRH(left, right, bottom, top, nearVal, farVal);
#endif
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return frustumLH(left, right, bottom, top, nearVal, farVal);
# else
return frustumRH(left, right, bottom, top, nearVal, farVal);
# endif
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustumLH
(
T left,
T right,
T bottom,
T top,
T nearVal,
T farVal
T left, T right,
T bottom, T top,
T nearVal, T farVal
)
{
tmat4x4<T, defaultp> Result(0);
@ -273,25 +258,23 @@ namespace glm
Result[2][1] = (top + bottom) / (top - bottom);
Result[2][3] = static_cast<T>(1);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = farVal / (zFar - nearVal);
Result[3][2] = -(farVal * nearVal) / (zFar - nearVal);
#else
Result[2][2] = (farVal + nearVal) / (farVal - nearVal);
Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = farVal / (farVal - nearVal);
Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
# else
Result[2][2] = (farVal + nearVal) / (farVal - nearVal);
Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
# endif
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustumRH
(
T left,
T right,
T bottom,
T top,
T nearVal,
T farVal
T left, T right,
T bottom, T top,
T nearVal, T farVal
)
{
tmat4x4<T, defaultp> Result(0);
@ -301,13 +284,14 @@ namespace glm
Result[2][1] = (top + bottom) / (top - bottom);
Result[2][3] = static_cast<T>(-1);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = farVal / (nearVal - farVal);
Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
#else
Result[2][2] = - (farVal + nearVal) / (farVal - nearVal);
Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = farVal / (nearVal - farVal);
Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
# else
Result[2][2] = - (farVal + nearVal) / (farVal - nearVal);
Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
# endif
return Result;
}
@ -320,11 +304,11 @@ namespace glm
T zFar
)
{
#ifdef GLM_LEFT_HANDED
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return perspectiveLH(fovy, aspect, zNear, zFar);
#else
# else
return perspectiveRH(fovy, aspect, zNear, zFar);
#endif
# endif
}
template <typename T>
@ -332,8 +316,7 @@ namespace glm
(
T fovy,
T aspect,
T zNear,
T zFar
T zNear, T zFar
)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
@ -345,24 +328,24 @@ namespace glm
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][3] = - static_cast<T>(1);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zNear - zFar);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
#else
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zNear - zFar);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
# else
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
# endif
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveLH
(
(
T fovy,
T aspect,
T zNear,
T zFar
)
T zNear, T zFar
)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
@ -373,13 +356,14 @@ namespace glm
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][3] = static_cast<T>(1);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zFar - zNear);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
#else
Result[2][2] = (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zFar - zNear);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
# else
Result[2][2] = (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
# endif
return Result;
}
@ -387,27 +371,23 @@ namespace glm
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveFov
(
T fov,
T width,
T height,
T zNear,
T zFar
T width, T height,
T zNear, T zFar
)
{
#ifdef GLM_LEFT_HANDED
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return perspectiveFovLH(fov, width, height, zNear, zFar);
#else
# else
return perspectiveFovRH(fov, width, height, zNear, zFar);
#endif
# endif
}
template <typename T>
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveFovRH
(
T fov,
T width,
T height,
T zNear,
T zFar
T width, T height,
T zNear, T zFar
)
{
assert(width > static_cast<T>(0));
@ -423,13 +403,14 @@ namespace glm
Result[1][1] = h;
Result[2][3] = - static_cast<T>(1);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zNear - zFar);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
#else
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zNear - zFar);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
# else
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
# endif
return Result;
}
@ -437,10 +418,8 @@ namespace glm
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveFovLH
(
T fov,
T width,
T height,
T zNear,
T zFar
T width, T height,
T zNear, T zFar
)
{
assert(width > static_cast<T>(0));
@ -456,13 +435,13 @@ namespace glm
Result[1][1] = h;
Result[2][3] = static_cast<T>(1);
#ifdef GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zFar - zNear);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
#else
Result[2][2] = (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
#endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
Result[2][2] = zFar / (zFar - zNear);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
# else
Result[2][2] = (zFar + zNear) / (zFar - zNear);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
# endif
return Result;
}
@ -475,11 +454,11 @@ namespace glm
T zNear
)
{
#ifdef GLM_LEFT_HANDED
return infinitePerspectiveLH(fovy, aspect, zNear);
#else
return infinitePerspectiveRH(fovy, aspect, zNear);
#endif
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return infinitePerspectiveLH(fovy, aspect, zNear);
# else
return infinitePerspectiveRH(fovy, aspect, zNear);
# endif
}
template <typename T>
@ -578,7 +557,12 @@ namespace glm
tmp = proj * tmp;
tmp /= tmp.w;
tmp = tmp * T(0.5) + T(0.5);
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
tmp.x = tmp.x * T(0.5) + T(0.5);
tmp.y = tmp.y * T(0.5) + T(0.5);
# else
tmp = tmp * T(0.5) + T(0.5);
# endif
tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
@ -599,7 +583,12 @@ namespace glm
tvec4<T, P> tmp = tvec4<T, P>(win, T(1));
tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
tmp = tmp * T(2) - T(1);
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
tmp.x = tmp.x * T(2) - T(1);
tmp.y = tmp.y * T(2) - T(1);
# else
tmp = tmp * T(2) - T(1);
# endif
tvec4<T, P> obj = Inverse * tmp;
obj /= obj.w;
@ -639,11 +628,11 @@ namespace glm
tvec3<T, P> const & up
)
{
#ifdef GLM_LEFT_HANDED
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
return lookAtLH(eye, center, up);
#else
# else
return lookAtRH(eye, center, up);
#endif
# endif
}
template <typename T, precision P>

View File

@ -67,52 +67,18 @@ 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
// -- Data --
T x, y, z, w;
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
typedef length_t length_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
typedef length_t length_type;
/// Return the count of components of a quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
// -- Implicit basic constructors --
@ -124,7 +90,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tquat(ctor);
GLM_FUNC_DECL explicit tquat(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tquat(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tquat(T const & w, T const & x, T const & y, T const & z);
// -- Conversion constructors --
@ -144,12 +110,12 @@ namespace glm
/// @param v A second normalized axis
/// @see gtc_quaternion
/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
GLM_FUNC_DECL explicit tquat(tvec3<T, P> const & u, tvec3<T, P> const & v);
GLM_FUNC_DECL tquat(tvec3<T, P> const & u, tvec3<T, P> const & v);
/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.
GLM_FUNC_DECL explicit tquat(tvec3<T, P> const & eulerAngles);
GLM_FUNC_DECL explicit tquat(tmat3x3<T, P> const & m);
GLM_FUNC_DECL explicit tquat(tmat4x4<T, P> const & m);
GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3<T, P> const & eulerAngles);
GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3<T, P> const & m);
GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4<T, P> const & m);
// -- Unary arithmetic operators --
@ -279,7 +245,7 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tquat<T, P> rotate(tquat<T, P> const & q, T const & angle, tvec3<T, P> const & axis);
/// Returns euler angles, yitch as x, yaw as y, roll as z.
/// Returns euler angles, pitch as x, yaw as y, roll as z.
/// The result is expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
///
/// @see gtc_quaternion
@ -397,16 +363,6 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y);
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "quaternion.inl"

View File

@ -49,116 +49,27 @@ namespace detail
};
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P> const tquat<T, P> tquat<T, P>::IDENTITY;
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::X
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Y
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::W
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XY
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::size_type tquat<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::length_type tquat<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tquat<T, P>::length_type tquat<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
// -- Implicit basic constructors --
@ -664,7 +575,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER T yaw(tquat<T, P> const & q)
{
return asin(T(-2) * (q.x * q.z - q.w * q.y));
return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1)));
}
template <typename T, precision P>

View File

@ -66,32 +66,18 @@ 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 = 2;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
// -- Data --
glm::tquat<T, P> real, dual;
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t size_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
typedef length_t length_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL part_type & operator[](size_type i);
GLM_FUNC_DECL part_type const & operator[](size_type i) const;
# else
typedef length_t length_type;
/// Return the count of components of a dual quaternion
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL part_type & operator[](length_type i);
GLM_FUNC_DECL part_type const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
GLM_FUNC_DECL part_type & operator[](length_type i);
GLM_FUNC_DECL part_type const & operator[](length_type i) const;
// -- Implicit basic constructors --
@ -103,7 +89,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tdualquat(ctor);
GLM_FUNC_DECL explicit tdualquat(tquat<T, P> const & real);
GLM_FUNC_DECL tdualquat(tquat<T, P> const & real);
GLM_FUNC_DECL tdualquat(tquat<T, P> const & orientation, tvec3<T, P> const & translation);
GLM_FUNC_DECL tdualquat(tquat<T, P> const & real, tquat<T, P> const & dual);
@ -112,8 +98,8 @@ namespace glm
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);
GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat2x4<T, P> const & holder_mat);
GLM_FUNC_DECL GLM_EXPLICIT tdualquat(tmat3x4<T, P> const & aug_mat);
// -- Unary arithmetic operators --
@ -295,16 +281,6 @@ namespace glm
#endif
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tdualquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "dual_quaternion.inl"

View File

@ -43,8 +43,12 @@
#pragma once
// Dependency:
#include <cfloat>
#include <limits>
#include "../glm.hpp"
#include "../geometric.hpp"
#include "../gtx/closest_point.hpp"
#include "../gtx/vector_query.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_closest_point extension included")

View File

@ -7,10 +7,6 @@
// File : glm/gtx/intersect.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include <cfloat>
#include <limits>
namespace glm
{
template <typename genType>

View File

@ -53,15 +53,15 @@ namespace glm
/// @addtogroup gtx_log_base
/// @{
//! Logarithm for any base.
//! From GLM_GTX_log_base.
/// Logarithm for any base.
/// From GLM_GTX_log_base.
template <typename genType>
GLM_FUNC_DECL genType log(
genType x,
genType base);
genType const & x,
genType const & base);
//! Logarithm for any base.
//! From GLM_GTX_log_base.
/// Logarithm for any base.
/// From GLM_GTX_log_base.
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> sign(
vecType<T, P> const & x,

View File

@ -45,6 +45,7 @@
#include "../mat4x4.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../geometric.hpp"
#include "../gtc/quaternion.hpp"
#include "../gtc/matrix_transform.hpp"

View File

@ -30,7 +30,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
namespace glm
namespace glm{
namespace detail
{
/// Make a linear combination of two vectors and return the result.
// result = (a * ascl) + (b * bscl)
@ -44,24 +45,15 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER void v3Scale(tvec3<T, P> & v, T desiredLength)
GLM_FUNC_QUALIFIER tvec3<T, P> scale(tvec3<T, P> const& v, T desiredLength)
{
T len = glm::length(v);
if(len != 0)
{
T l = desiredLength / len;
v[0] *= l;
v[1] *= l;
v[2] *= l;
}
return v * desiredLength / length(v);
}
}//namespace detail
/**
* Matrix decompose
* http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp
* Decomposes the mode matrix to translations,rotation scale components
*
*/
// Matrix decompose
// http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp
// Decomposes the mode matrix to translations,rotation scale components
template <typename T, precision P>
GLM_FUNC_QUALIFIER bool decompose(tmat4x4<T, P> const & ModelMatrix, tvec3<T, P> & Scale, tquat<T, P> & Orientation, tvec3<T, P> & Translation, tvec3<T, P> & Skew, tvec4<T, P> & Perspective)
@ -131,26 +123,26 @@ namespace glm
// Compute X scale factor and normalize first row.
Scale.x = length(Row[0]);// v3Length(Row[0]);
v3Scale(Row[0], static_cast<T>(1));
Row[0] = detail::scale(Row[0], static_cast<T>(1));
// Compute XY shear factor and make 2nd row orthogonal to 1st.
Skew.z = dot(Row[0], Row[1]);
Row[1] = combine(Row[1], Row[0], static_cast<T>(1), -Skew.z);
Row[1] = detail::combine(Row[1], Row[0], static_cast<T>(1), -Skew.z);
// Now, compute Y scale and normalize 2nd row.
Scale.y = length(Row[1]);
v3Scale(Row[1], static_cast<T>(1));
Row[1] = detail::scale(Row[1], static_cast<T>(1));
Skew.z /= Scale.y;
// Compute XZ and YZ shears, orthogonalize 3rd row.
Skew.y = glm::dot(Row[0], Row[2]);
Row[2] = combine(Row[2], Row[0], static_cast<T>(1), -Skew.y);
Row[2] = detail::combine(Row[2], Row[0], static_cast<T>(1), -Skew.y);
Skew.x = glm::dot(Row[1], Row[2]);
Row[2] = combine(Row[2], Row[1], static_cast<T>(1), -Skew.x);
Row[2] = detail::combine(Row[2], Row[1], static_cast<T>(1), -Skew.x);
// Next, get Z scale and normalize 3rd row.
Scale.z = length(Row[2]);
v3Scale(Row[2], static_cast<T>(1));
Row[2] = detail::scale(Row[2], static_cast<T>(1));
Skew.y /= Scale.z;
Skew.x /= Scale.z;

View File

@ -43,7 +43,7 @@ namespace glm
T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z));
return tvec3<T, P>(
atan(xz_dist, tmp.y), // latitude
asin(tmp.y), // latitude
atan(tmp.x, tmp.z), // longitude
xz_dist); // xz distance
}

View File

@ -76,18 +76,6 @@ namespace detail
typedef tvec4<float, defaultp> pure_col_type;
typedef tmat4x4<float, defaultp> pure_transpose_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR length_t cols = 4;
static GLM_RELAXED_CONSTEXPR length_t rows = 4;
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
GLM_FUNC_DECL length_t length() const;
fvec4SIMD Data[4];

View File

@ -61,11 +61,6 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
return this->Data[i];
}
#ifdef GLM_STATIC_CONST_MEMBERS
const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast<float>(0));
const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast<float>(1));
#endif
//////////////////////////////////////////////////////////////
// Constructors

View File

@ -76,11 +76,6 @@ namespace detail
typedef tquat<bool, defaultp> bool_type;
typedef tquat<float, defaultp> pure_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 4;
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
union
{
@ -91,26 +86,6 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -51,26 +51,6 @@ void print(const fvec4SIMD &v)
}
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0);
const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0);
const fquatSIMD fquatSIMD::X(0, 1, 0, 0);
const fquatSIMD fquatSIMD::Y(0, 0, 1, 0);
const fquatSIMD fquatSIMD::Z(0, 0, 0, 1);
const fquatSIMD fquatSIMD::W(1, 0, 0, 0);
const fquatSIMD fquatSIMD::XY(0, 1, 1, 0);
const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1);
const fquatSIMD fquatSIMD::XW(1, 1, 0, 0);
const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1);
const fquatSIMD fquatSIMD::YW(1, 0, 1, 0);
const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1);
const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1);
const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0);
const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1);
const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1);
const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -99,11 +99,6 @@ namespace detail
typedef tvec4<float, defaultp> pure_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
{
@ -114,25 +109,6 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -16,25 +16,6 @@ struct shuffle_mask
enum{value = Value};
};
# ifdef GLM_STATIC_CONST_MEMBERS
const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0);
const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0);
const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0);
const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0);
const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1);
const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0);
const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0);
const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1);
const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0);
const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1);
const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1);
const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0);
const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1);
const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1);
const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1);
const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -64,7 +64,7 @@ namespace glm
GLM_FUNC_DECL tmat4x4<T, P> translate(
tvec3<T, P> const & v);
/// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees.
/// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians.
/// @see gtc_matrix_transform
/// @see gtx_transform
template <typename T, precision P>

224
glm/gtx/type_trait.hpp Normal file
View File

@ -0,0 +1,224 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2016 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_type_info
/// @file glm/gtx/type_info.hpp
/// @date 2016-03-12 / 2016-03-12
/// @author Christophe Riccio
///
/// @see core (dependence)
///
/// @defgroup gtx_type_info GLM_GTX_type_info
/// @ingroup gtx
///
/// @brief Defines aligned types.
///
/// <glm/gtx/type_aligned.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#pragma once
// Dependency:
#include "../detail/precision.hpp"
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTX_type_info extension included")
#endif
namespace glm
{
/// @addtogroup gtx_type_info
/// @{
template <typename T, precision P> struct tvec1;
template <typename T, precision P> struct tvec2;
template <typename T, precision P> struct tvec3;
template <typename T, precision P> struct tvec4;
template <typename T, precision P> struct tmat2x2;
template <typename T, precision P> struct tmat2x3;
template <typename T, precision P> struct tmat2x4;
template <typename T, precision P> struct tmat3x2;
template <typename T, precision P> struct tmat3x3;
template <typename T, precision P> struct tmat3x4;
template <typename T, precision P> struct tmat4x2;
template <typename T, precision P> struct tmat4x3;
template <typename T, precision P> struct tmat4x4;
template <typename T, precision P> struct tquat;
template <typename T, precision P> struct tdualquat;
template <template <typename, precision> class genType>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 0;
};
template <>
struct type<tvec1>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 1;
};
template <>
struct type<tvec2>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
};
template <>
struct type<tvec4>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tmat2x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tmat2x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tmat2x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 2;
};
template <>
struct type<tmat3x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR length_t cols = 3;
static GLM_RELAXED_CONSTEXPR length_t rows = 2;
};
template <>
struct type<tmat3x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
};
template <>
struct type<tmat3x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 3;
};
template <>
struct type<tmat4x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tmat4x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tmat4x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
static GLM_RELAXED_CONSTEXPR length_t components = 4;
};
template <>
struct type<tdualquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
static GLM_RELAXED_CONSTEXPR length_t components = 8;
};
/// @}
}//namespace glm
#include "type_trait.inl"

0
glm/gtx/type_trait.inl Normal file
View File

View File

@ -51,8 +51,9 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
## Release notes
#### [GLM 0.9.8.0](https://github.com/g-truc/glm/releases/latest) - 201X-XX-XX
#### [GLM 0.9.8.0](https://github.com/g-truc/glm/releases/latest) - 2016-XX-XX
##### Features:
- Added right and left handed projection and clip control support #447 #415 #119
- Added compNormalize and compScale functions to GTX_component_wise
- Added packF3x9_E1x5 and unpackF3x9_E1x5 to GTC_packing for RGB9E5 #416
- Added (un)packHalf to GTC_packing
@ -60,21 +61,50 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Added 16bit pack and unpack to GTC_packing
- Added 8bit pack and unpack to GTC_packing
- Added missing bvec* && and || operators
- Added iround and uround to GTC_integer, fast round on positive values
##### Improvements:
- Improved GTC_random linearRand documentation
- Improved GTC_reciprocal documentation
- Added unary + operator #435
- Improved GLM_FORCE_EXPLICIT_CTOR coverage #481
##### Fixes:
- Fixed GTX_extended_min_max filename typo #386
- Fixed intersectRayTriangle to not do any unintentional backface culling
- Fixed long long warnings when using C++98 on GCC and Clang #482
#### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX
##### Deprecation:
- Removed GLM_FORCE_SIZE_FUNC define
#### [GLM 0.9.7.4](https://github.com/g-truc/glm/tree/0.9.7) - 2016-XX-XX
##### Fixes:
- Fixed asinh and atanh warning with C++98 STL #484
- Fixed polar coordinates function latitude #485
- Fixed outerProduct defintions and operator signatures for mat2x4 and vec4 #475
- Fixed eulerAngles precision error, returns NaN #451
- Fixed undefined reference errors #489
#### [GLM 0.9.7.3](https://github.com/g-truc/glm/releases/tag/0.9.7.3) - 2016-02-21
##### Improvements:
- Added AVX512 detection
##### Fixes:
- Fixed CMake policy warning
- Fixed GCC 6.0 detection #477
- Fixed Clang build on Windows #479
- Fixed 64 bits constants warnings on GCC #463
#### [GLM 0.9.7.2](https://github.com/g-truc/glm/releases/tag/0.9.7.2) - 2016-01-03
##### Fixes:
- Fixed GTC_round floorMultiple/ceilMultiple #412
- Fixed GTC_packing unpackUnorm3x10_1x2 #414
- Fixed GTC_matrix_inverse affineInverse #192
- Fixed ICC on Linux build errors #449
- Fixed ldexp and frexp compilation errors
- Fixed "Declaration shadows a field" warning #468
- Fixed 'GLM_COMPILER_VC2005 is not defined' warning #468
- Fixed various 'X is not defined' warnings #468
- Fixed missing unary + operator #435
- Fixed Cygwin build errors when using C++11 #405
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
@ -403,7 +433,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Fixed isnan and isinf for CUDA compiler
- Fixed GLM_FORCE_RADIANS on glm::perspective
- Fixed GCC warnings
- Fixed packDouble2x32 on XCode
- Fixed packDouble2x32 on Xcode
- Fixed mix for vec4 SSE implementation
- Fixed 0x2013 dash character in comments that cause issue in Windows
Japanese mode

View File

@ -3,7 +3,6 @@ glmCreateTestGTC(core_type_ctor)
glmCreateTestGTC(core_type_float)
glmCreateTestGTC(core_type_int)
glmCreateTestGTC(core_type_length)
glmCreateTestGTC(core_type_length_size)
glmCreateTestGTC(core_type_mat2x2)
glmCreateTestGTC(core_type_mat2x3)
glmCreateTestGTC(core_type_mat2x4)

View File

@ -599,7 +599,7 @@ namespace round_
int test()
{
int Error = 0;
{
float A = glm::round(0.0f);
Error += A == 0.0f ? 0 : 1;
@ -1153,6 +1153,86 @@ namespace sign
}
}//namespace sign
namespace frexp_
{
int test()
{
int Error(0);
{
glm::vec1 x(1024);
glm::ivec1 exp;
glm::vec1 A = glm::frexp(x, exp);
Error += glm::all(glm::epsilonEqual(A, glm::vec1(0.5), 0.00001f)) ? 0 : 1;
Error += glm::all(glm::equal(exp, glm::ivec1(11))) ? 0 : 1;
}
{
glm::vec2 x(1024, 0.24);
glm::ivec2 exp;
glm::vec2 A = glm::frexp(x, exp);
Error += glm::all(glm::epsilonEqual(A, glm::vec2(0.5, 0.96), 0.00001f)) ? 0 : 1;
Error += glm::all(glm::equal(exp, glm::ivec2(11, -2))) ? 0 : 1;
}
{
glm::vec3 x(1024, 0.24, 0);
glm::ivec3 exp;
glm::vec3 A = glm::frexp(x, exp);
Error += glm::all(glm::epsilonEqual(A, glm::vec3(0.5, 0.96, 0.0), 0.00001f)) ? 0 : 1;
Error += glm::all(glm::equal(exp, glm::ivec3(11, -2, 0))) ? 0 : 1;
}
{
glm::vec4 x(1024, 0.24, 0, -1.33);
glm::ivec4 exp;
glm::vec4 A = glm::frexp(x, exp);
Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1;
Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1;
}
return Error;
}
}//namespace frexp_
namespace ldexp_
{
int test()
{
int Error(0);
{
glm::vec1 A = glm::vec1(0.5);
glm::ivec1 exp = glm::ivec1(11);
glm::vec1 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec1(1024),0.00001f)) ? 0 : 1;
}
{
glm::vec2 A = glm::vec2(0.5, 0.96);
glm::ivec2 exp = glm::ivec2(11, -2);
glm::vec2 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec2(1024, .24),0.00001f)) ? 0 : 1;
}
{
glm::vec3 A = glm::vec3(0.5, 0.96, 0.0);
glm::ivec3 exp = glm::ivec3(11, -2, 0);
glm::vec3 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec3(1024, .24, 0),0.00001f)) ? 0 : 1;
}
{
glm::vec4 A = glm::vec4(0.5, 0.96, 0.0, -0.665);
glm::ivec4 exp = glm::ivec4(11, -2, 0, 1);
glm::vec4 x = glm::ldexp(A, exp);
Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 0 : 1;
}
return Error;
}
}//namespace ldexp_
int main()
{
int Error(0);
@ -1171,6 +1251,8 @@ int main()
Error += roundEven::test();
Error += isnan_::test();
Error += isinf_::test();
Error += frexp_::test();
Error += ldexp_::test();
# ifdef NDEBUG
std::size_t Samples = 1000;

View File

@ -101,7 +101,18 @@ int test_matrixCompMult()
int test_outerProduct()
{
glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f));
{ glm::mat2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec2(1.0f)); }
{ glm::mat3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec3(1.0f)); }
{ glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f)); }
{ glm::mat2x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec2(1.0f)); }
{ glm::mat2x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec2(1.0f)); }
{ glm::mat3x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec3(1.0f)); }
{ glm::mat3x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec3(1.0f)); }
{ glm::mat4x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec4(1.0f)); }
{ glm::mat4x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec4(1.0f)); }
return 0;
}

View File

@ -80,7 +80,13 @@ int test_packSnorm2x16()
int test_packUnorm4x8()
{
int Error = 0;
glm::uint32 Packed = glm::packUnorm4x8(glm::vec4(1.0f, 0.5f, 0.0f, 1.0f));
glm::u8vec4 Vec(255, 128, 0, 255);
glm::uint32 & Ref = *reinterpret_cast<glm::uint32*>(&Vec[0]);
Error += Packed == Ref ? 0 : 1;
std::vector<glm::vec4> A;
A.push_back(glm::vec4(1.0f, 0.7f, 0.3f, 0.0f));
A.push_back(glm::vec4(0.5f, 0.1f, 0.2f, 0.3f));

View File

@ -71,6 +71,9 @@ int test_compiler()
case GLM_COMPILER_GCC53:
std::printf("GLM_COMPILER_GCC53\n");
break;
case GLM_COMPILER_GCC60:
std::printf("GLM_COMPILER_GCC60\n");
break;
default:
std::printf("GCC version not detected\n");
Error += 1;

View File

@ -1,116 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
/// 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/core/core_type_length_size.cpp
/// @date 2011-05-25 / 2014-11-25
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_SIZE_FUNC
#include <glm/glm.hpp>
#include <glm/gtc/vec1.hpp>
int test_length_mat_non_squared()
{
int Error = 0;
Error += glm::mat2x3().size() == 2 ? 0 : 1;
Error += glm::mat2x4().size() == 2 ? 0 : 1;
Error += glm::mat3x2().size() == 3 ? 0 : 1;
Error += glm::mat3x4().size() == 3 ? 0 : 1;
Error += glm::mat4x2().size() == 4 ? 0 : 1;
Error += glm::mat4x3().size() == 4 ? 0 : 1;
Error += glm::dmat2x3().size() == 2 ? 0 : 1;
Error += glm::dmat2x4().size() == 2 ? 0 : 1;
Error += glm::dmat3x2().size() == 3 ? 0 : 1;
Error += glm::dmat3x4().size() == 3 ? 0 : 1;
Error += glm::dmat4x2().size() == 4 ? 0 : 1;
Error += glm::dmat4x3().size() == 4 ? 0 : 1;
return Error;
}
int test_length_mat()
{
int Error = 0;
Error += glm::mat2().size() == 2 ? 0 : 1;
Error += glm::mat3().size() == 3 ? 0 : 1;
Error += glm::mat4().size() == 4 ? 0 : 1;
Error += glm::mat2x2().size() == 2 ? 0 : 1;
Error += glm::mat3x3().size() == 3 ? 0 : 1;
Error += glm::mat4x4().size() == 4 ? 0 : 1;
Error += glm::dmat2().size() == 2 ? 0 : 1;
Error += glm::dmat3().size() == 3 ? 0 : 1;
Error += glm::dmat4().size() == 4 ? 0 : 1;
Error += glm::dmat2x2().size() == 2 ? 0 : 1;
Error += glm::dmat3x3().size() == 3 ? 0 : 1;
Error += glm::dmat4x4().size() == 4 ? 0 : 1;
return Error;
}
int test_length_vec()
{
int Error = 0;
Error += glm::vec1().size() == 1 ? 0 : 1;
Error += glm::vec2().size() == 2 ? 0 : 1;
Error += glm::vec3().size() == 3 ? 0 : 1;
Error += glm::vec4().size() == 4 ? 0 : 1;
Error += glm::ivec1().size() == 1 ? 0 : 1;
Error += glm::ivec2().size() == 2 ? 0 : 1;
Error += glm::ivec3().size() == 3 ? 0 : 1;
Error += glm::ivec4().size() == 4 ? 0 : 1;
Error += glm::uvec1().size() == 1 ? 0 : 1;
Error += glm::uvec2().size() == 2 ? 0 : 1;
Error += glm::uvec3().size() == 3 ? 0 : 1;
Error += glm::uvec4().size() == 4 ? 0 : 1;
Error += glm::dvec1().size() == 1 ? 0 : 1;
Error += glm::dvec2().size() == 2 ? 0 : 1;
Error += glm::dvec3().size() == 3 ? 0 : 1;
Error += glm::dvec4().size() == 4 ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_length_vec();
Error += test_length_mat();
Error += test_length_mat_non_squared();
return Error;
}

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -87,15 +86,6 @@ int test_inverse()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x2(1) == glm::mat2x2::IDENTITY ? 0 : 1;
Error += glm::mat2x2(0) == glm::mat2x2::ZERO ? 0 : 1;
return Error;
}
int test_ctr()
{
int Error(0);
@ -177,13 +167,7 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2::rows == glm::mat2::row_type::components);
assert(glm::mat2::cols == glm::mat2::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();
Error += test_inverse();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -103,16 +102,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x3(1) == glm::mat2x3::IDENTITY ? 0 : 1;
Error += glm::mat2x3(0) == glm::mat2x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -152,13 +141,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2x3::rows == glm::mat2x3::row_type::components);
assert(glm::mat2x3::cols == glm::mat2x3::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -103,15 +102,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x4(1) == glm::mat2x4::IDENTITY ? 0 : 1;
Error += glm::mat2x4(0) == glm::mat2x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -151,13 +141,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat2x4::rows == glm::mat2x4::row_type::components);
assert(glm::mat2x4::cols == glm::mat2x4::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -107,16 +106,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x2(1) == glm::mat3x2::IDENTITY ? 0 : 1;
Error += glm::mat3x2(0) == glm::mat3x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -156,14 +145,8 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3x2::rows == glm::mat3x2::row_type::components);
assert(glm::mat3x2::cols == glm::mat3x2::col_type::components);
#endif
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_operators();
return Error;

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -166,15 +165,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x3(1) == glm::mat3x3::IDENTITY ? 0 : 1;
Error += glm::mat3x3(0) == glm::mat3x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -214,13 +204,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3::rows == glm::mat3::row_type::components);
assert(glm::mat3::cols == glm::mat3::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_mat3x3();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -107,15 +106,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x4(1) == glm::mat3x4::IDENTITY ? 0 : 1;
Error += glm::mat3x4(0) == glm::mat3x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -155,13 +145,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat3x4::rows == glm::mat3x4::row_type::components);
assert(glm::mat3x4::cols == glm::mat3x4::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -111,15 +110,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x2(1) == glm::mat4x2::IDENTITY ? 0 : 1;
Error += glm::mat4x2(0) == glm::mat4x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -159,13 +149,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4x2::rows == glm::mat4x2::row_type::components);
assert(glm::mat4x2::cols == glm::mat4x2::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -111,15 +110,6 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x3(1) == glm::mat4x3::IDENTITY ? 0 : 1;
Error += glm::mat4x3(0) == glm::mat4x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -159,13 +149,7 @@ int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4x3::rows == glm::mat4x3::row_type::components);
assert(glm::mat4x3::cols == glm::mat4x3::col_type::components);
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SIMD
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
@ -284,15 +283,6 @@ int perf_mul()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x4(1) == glm::mat4x4::IDENTITY ? 0 : 1;
Error += glm::mat4x4(0) == glm::mat4x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -342,14 +332,8 @@ int main()
repro Repro;
#ifdef GLM_META_PROG_HELPERS
assert(glm::mat4::rows == glm::mat4::row_type::components);
assert(glm::mat4::cols == glm::mat4::col_type::components);
#endif
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_inverse_dmat4x4();
Error += test_inverse_mat4x4();
Error += test_operators();

View File

@ -29,10 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp>
@ -135,7 +131,6 @@ 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;
}
@ -167,18 +162,6 @@ int test_vec1_operator_increment()
return Error;
}
int test_vec1_static_const() {
int Error = 0;
Error += (glm::vec1(1.0f) == glm::vec1::X) ? 0 : 1;
Error += (glm::ivec1(1) == glm::ivec1::X) ? 0 : 1;
Error += (glm::dvec1(1.0) == glm::dvec1::X) ? 0 : 1;
Error += (glm::bvec1(false) == glm::bvec1::ZERO) ? 0 : 1;
Error += (glm::uvec1(0) == glm::uvec1::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -186,12 +169,6 @@ int main()
glm::vec1 v;
assert(v.length() == 1);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec1::components == glm::vec1().length());
assert(glm::vec1::components == 1);
# endif
Error += test_vec1_static_const();
Error += test_vec1_size();
Error += test_vec1_ctor();
Error += test_vec1_operators();

View File

@ -29,10 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
@ -301,7 +297,6 @@ 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;
}
@ -333,17 +328,6 @@ int test_operator_increment()
return Error;
}
int test_vec2_static_const() {
int Error(0);
Error += (glm::ivec2(0, 0) == glm::ivec2::ZERO) ? 0 : 1;
Error += (glm::vec2(1, 0) == glm::vec2::X) ? 0 : 1;
Error += (glm::bvec2(false, true) == glm::bvec2::Y) ? 0 : 1;
Error += (glm::dvec2(1, 1) == glm::dvec2::XY) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -351,12 +335,6 @@ int main()
glm::vec2 v;
assert(v.length() == 2);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec2::components == glm::vec2().length());
assert(glm::vec2::components == 2);
# endif
Error += test_vec2_static_const();
Error += test_vec2_size();
Error += test_vec2_ctor();
Error += test_vec2_operators();

View File

@ -29,11 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/geometric.hpp>
#include <glm/vec2.hpp>
@ -267,7 +263,6 @@ 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,21 +489,6 @@ int test_operator_increment()
return Error;
}
int test_vec3_static_const() {
int Error(0);
Error += (glm::ivec3(0, 0, 0) == glm::ivec3::ZERO) ? 0 : 1;
Error += (glm::vec3(1, 0, 0) == glm::vec3::X) ? 0 : 1;
Error += (glm::bvec3(false, true, false) == glm::bvec3::Y) ? 0 : 1;
Error += (glm::bvec3(false, false, true) == glm::bvec3::Z) ? 0 : 1;
Error += (glm::dvec3(1, 1, 0) == glm::dvec3::XY) ? 0 : 1;
Error += (glm::vec3(1, 0, 1) == glm::vec3::XZ) ? 0 : 1;
Error += (glm::uvec3(0u, 1u, 1u) == glm::uvec3::YZ) ? 0 : 1;
Error += (glm::dvec3(1, 1, 1) == glm::dvec3::XYZ) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -516,12 +496,6 @@ int main()
glm::vec3 v;
assert(v.length() == 3);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec3::components == glm::vec3().length());
assert(glm::vec3::components == 3);
# endif
Error += test_vec3_static_const();
Error += test_vec3_ctor();
Error += test_vec3_operators();
Error += test_vec3_size();

View File

@ -29,11 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
@ -397,28 +393,6 @@ int test_operator_increment()
return Error;
}
int test_vec4_static_const() {
int Error(0);
Error += (glm::ivec4(0, 0, 0, 0) == glm::ivec4::ZERO) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 0) == glm::vec4::X) ? 0 : 1;
Error += (glm::bvec4(false, true, false, false) == glm::bvec4::Y) ? 0 : 1;
Error += (glm::bvec4(false, false, true, false) == glm::bvec4::Z) ? 0 : 1;
Error += (glm::uvec4(0u, 0u, 0u, 1u) == glm::uvec4::W) ? 0 : 1;
Error += (glm::dvec4(1, 1, 0, 0) == glm::dvec4::XY) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 0) == glm::vec4::XZ) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 1) == glm::vec4::XW) ? 0 : 1;
Error += (glm::uvec4(0u, 1u, 1u, 0u) == glm::uvec4::YZ) ? 0 : 1;
Error += (glm::vec4(0, 1, 0, 1) == glm::vec4::YW) ? 0 : 1;
Error += (glm::dvec4(1, 1, 1, 0) == glm::dvec4::XYZ) ? 0 : 1;
Error += (glm::vec4(1, 1, 0, 1) == glm::vec4::XYW) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 1) == glm::vec4::XZW) ? 0 : 1;
Error += (glm::vec4(0, 1, 1, 1) == glm::vec4::YZW) ? 0 : 1;
Error += (glm::vec4(1, 1, 1, 1) == glm::vec4::XYZW) ? 0 : 1;
return Error;
}
struct AoS
{
glm::vec4 A;
@ -518,18 +492,12 @@ int main()
glm::vec4 v;
assert(v.length() == 4);
# ifdef GLM_META_PROG_HELPERS
assert(glm::vec4::components == glm::vec4().length());
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
Error += test_vec4_static_const();
Error += test_vec4_ctor();
Error += test_bvec4_ctor();
Error += test_vec4_size();

View File

@ -210,11 +210,49 @@ namespace log2_
}
}//namespace log2_
namespace iround
{
int test()
{
int Error = 0;
for(float f = 0.0f; f < 3.1f; f += 0.05f)
{
int RoundFast = glm::iround(f);
int RoundSTD = glm::round(f);
Error += RoundFast == RoundSTD ? 0 : 1;
assert(!Error);
}
return Error;
}
}//namespace iround
namespace uround
{
int test()
{
int Error = 0;
for(float f = 0.0f; f < 3.1f; f += 0.05f)
{
int RoundFast = glm::uround(f);
int RoundSTD = glm::round(f);
Error += RoundFast == RoundSTD ? 0 : 1;
assert(!Error);
}
return Error;
}
}//namespace uround
int main()
{
int Error(0);
Error += ::log2_::test();
Error += ::iround::test();
Error += ::uround::test();
# ifdef NDEBUG
std::size_t const Samples(1000);

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_META_PROG_HELPERS
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/vector_relational.hpp>
@ -327,11 +326,6 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::quat::components == 4);
assert(glm::quat::components == glm::quat().length());
#endif
Error += test_quat_ctr();
Error += test_quat_mul_vec();
Error += test_quat_two_axis_ctr();

View File

@ -354,7 +354,7 @@ namespace ceilMultiple
};
int Error(0);
for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i)
{
glm::float64 Result = glm::ceilMultiple(Data[i].Source, Data[i].Multiple);
@ -364,10 +364,37 @@ namespace ceilMultiple
return Error;
}
int test_int()
{
type<int> const Data[] =
{
{3, 4, 4, 0},
{7, 4, 8, 0},
{5, 4, 8, 0},
{1, 4, 4, 0},
{1, 3, 3, 0},
{4, 3, 6, 0},
{4, 1, 4, 0},
{1, 1, 1, 0},
{7, 1, 7, 0},
};
int Error(0);
for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i)
{
int Result = glm::ceilMultiple(Data[i].Source, Data[i].Multiple);
Error += Data[i].Return == Result ? 0 : 1;
}
return Error;
}
int test()
{
int Error(0);
Error += test_int();
Error += test_float();
return Error;

View File

@ -45,6 +45,7 @@ glmCreateTestGTC(gtx_simd_mat4)
glmCreateTestGTC(gtx_spline)
glmCreateTestGTC(gtx_string_cast)
glmCreateTestGTC(gtx_type_aligned)
glmCreateTestGTC(gtx_type_trait)
glmCreateTestGTC(gtx_vector_angle)
glmCreateTestGTC(gtx_vector_query)
glmCreateTestGTC(gtx_wrap)

View File

@ -209,10 +209,6 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::dualquat::components == glm::dualquat().length());
#endif
Error += test_dual_quat_ctr();
Error += test_dquat_type();
Error += test_scalars();

View File

@ -30,10 +30,55 @@
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/log_base.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/exponential.hpp>
namespace test_log
{
int run()
{
int Error = 0;
{
float A = glm::log(10.f, 2.0f);
float B = glm::log2(10.f);
Error += glm::epsilonEqual(A, B, 0.00001f) ? 0 : 1;
}
{
glm::vec1 A = glm::log(glm::vec1(10.f), glm::vec1(2.0f));
glm::vec1 B = glm::log2(glm::vec1(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec1(0.00001f))) ? 0 : 1;
}
{
glm::vec2 A = glm::log(glm::vec2(10.f), glm::vec2(2.0f));
glm::vec2 B = glm::log2(glm::vec2(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec2(0.00001f))) ? 0 : 1;
}
{
glm::vec3 A = glm::log(glm::vec3(10.f), glm::vec3(2.0f));
glm::vec3 B = glm::log2(glm::vec3(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec3(0.00001f))) ? 0 : 1;
}
{
glm::vec4 A = glm::log(glm::vec4(10.f), glm::vec4(2.0f));
glm::vec4 B = glm::log2(glm::vec4(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec4(0.00001f))) ? 0 : 1;
}
return Error;
}
}//namespace test_log
int main()
{
int Error(0);
Error += test_log::run();
return Error;
}

View File

@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
@ -253,28 +252,10 @@ int test_compute_gtx()
return 0;
}
int test_static_const() {
int Error(0);
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(1))) == glm::mat4_cast(glm::simdMat4::IDENTITY) ? 0 : 1;
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(0))) == glm::mat4_cast(glm::simdMat4::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdMat4::rows == glm::simdMat4::row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::col_type::components);
assert(glm::simdMat4::components == glm::simdMat4::pure_type::components);
assert(glm::simdMat4::rows == glm::simdMat4::pure_row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::pure_col_type::components);
#endif
std::vector<glm::mat4> Data(64 * 64 * 1);
for(std::size_t i = 0; i < Data.size(); ++i)
Data[i] = glm::mat4(
@ -323,7 +304,6 @@ int main()
Error += test_compute_glm();
Error += test_compute_gtx();
Error += test_static_const();
float Det = glm::determinant(glm::simdMat4(1.0));
Error += Det == 1.0f ? 0 : 1;

View File

@ -29,8 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>
@ -39,11 +37,6 @@
int main()
{
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdVec4::components == glm::simdVec4::pure_type::components);
#endif
glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f);
glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
glm::simdVec4 C1 = A1 + B1;

View File

@ -0,0 +1,79 @@
#include <glm/vec4.hpp>
#include <glm/gtx/type_trait.hpp>
template <typename genType>
struct type_gni
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
/*
template <template <class, glm::precision> class vecType, typename T, glm::precision P>
struct type_gni<vecType, T, P>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
*/
namespace detail
{
template <template <typename, glm::precision> class vec_type>
struct compute_vec_type
{
static bool const is_vec = false;
static GLM_RELAXED_CONSTEXPR glm::length_t components = 0;
};
template <>
struct compute_vec_type<glm::tvec1>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 1;
};
template <>
struct compute_vec_type<glm::tvec2>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 2;
};
template <>
struct compute_vec_type<glm::tvec3>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 3;
};
template <>
struct compute_vec_type<glm::tvec4>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 4;
};
}//namespace detail
/*
template <class gen_type>
struct vec_type
{
static bool const is_vec = detail::compute_vec_type<typename gen_type::vec_type>::is_vec;
//static GLM_RELAXED_CONSTEXPR glm::length_t const components = detail::compute_vec_type<typename gen_type::vec_type>::components;
};
*/
int main()
{
int Error = 0;
//typedef vec_type;
//bool const is_vec = detail::compute_vec_type<>::is_vec;
//Error += vec_type<glm::vec4>::is_vec ? 0 : 1;
//Error += vec_type<glm::vec4>::components == 4 ? 0 : 1;
return Error;
}