- Fixed ldexp implementation
- Increased assert coverage - Increased static_assert coverage - Replaced GLM traits by STL traits when possible - Allowed including individual core feature
This commit is contained in:
parent
cd0519d24b
commit
d37d3539ed
@ -29,25 +29,6 @@
|
|||||||
#ifndef glm_core_swizzle
|
#ifndef glm_core_swizzle
|
||||||
#define glm_core_swizzle
|
#define glm_core_swizzle
|
||||||
|
|
||||||
namespace glm
|
|
||||||
{
|
|
||||||
enum comp
|
|
||||||
{
|
|
||||||
X = 0,
|
|
||||||
R = 0,
|
|
||||||
S = 0,
|
|
||||||
Y = 1,
|
|
||||||
G = 1,
|
|
||||||
T = 1,
|
|
||||||
Z = 2,
|
|
||||||
B = 2,
|
|
||||||
P = 2,
|
|
||||||
W = 3,
|
|
||||||
A = 3,
|
|
||||||
Q = 3
|
|
||||||
};
|
|
||||||
}//namespace glm
|
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#define GLM_MESSAGES
|
#define GLM_MESSAGES
|
||||||
#include "../glm.hpp"
|
#include "../glm.hpp"
|
||||||
|
#include <limits>
|
||||||
/*
|
/*
|
||||||
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||||
struct float4
|
struct float4
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
@ -39,8 +41,8 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
|
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(
|
GLM_STATIC_ASSERT(
|
||||||
detail::type<genFIType>::is_float ||
|
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
|
||||||
detail::type<genFIType>::is_int, "'abs' only accept floating-point and integer inputs");
|
"'abs' only accept floating-point and integer inputs");
|
||||||
return x >= genFIType(0) ? x : -x;
|
return x >= genFIType(0) ? x : -x;
|
||||||
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
||||||
}
|
}
|
||||||
@ -52,7 +54,8 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
|
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(
|
GLM_STATIC_ASSERT(
|
||||||
detail::type<genFIType>::is_uint, "'abs' only accept floating-point and integer inputs");
|
!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer,
|
||||||
|
"'abs' only accept floating-point and integer inputs");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -79,7 +82,7 @@ namespace detail
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(
|
GLM_STATIC_ASSERT(
|
||||||
detail::type<genFIType>::is_float ||
|
std::numeric_limits<genFIType>::is_iec559 ||
|
||||||
detail::type<genFIType>::is_int, "'sign' only accept signed inputs");
|
detail::type<genFIType>::is_int, "'sign' only accept signed inputs");
|
||||||
|
|
||||||
genFIType result;
|
genFIType result;
|
||||||
@ -98,7 +101,9 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType floor(genType const & x)
|
GLM_FUNC_QUALIFIER genType floor(genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'floor' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'floor' only accept floating-point inputs");
|
||||||
|
|
||||||
return ::std::floor(x);
|
return ::std::floor(x);
|
||||||
}
|
}
|
||||||
@ -109,7 +114,11 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType trunc(genType const & x)
|
GLM_FUNC_QUALIFIER genType trunc(genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'trunc' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'trunc' only accept floating-point inputs");
|
||||||
|
|
||||||
|
// TODO, add C++11 std::trunk
|
||||||
return x < 0 ? -floor(-x) : floor(x);
|
return x < 0 ? -floor(-x) : floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,11 +128,12 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType round(genType const& x)
|
GLM_FUNC_QUALIFIER genType round(genType const& x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'round' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'round' only accept floating-point inputs");
|
||||||
|
|
||||||
if(x < 0)
|
// TODO, add C++11 std::round
|
||||||
return genType(int(x - genType(0.5)));
|
return x < 0 ? genType(int(x - genType(0.5))) : genType(int(x + genType(0.5)));
|
||||||
return genType(int(x + genType(0.5)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(round)
|
VECTORIZE_VEC(round)
|
||||||
@ -143,13 +153,15 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType roundEven(genType const & x)
|
GLM_FUNC_QUALIFIER genType roundEven(genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'roundEven' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'roundEven' only accept floating-point inputs");
|
||||||
|
|
||||||
int Integer = int(x);
|
int Integer = static_cast<int>(x);
|
||||||
genType IntegerPart = genType(Integer);
|
genType IntegerPart = static_cast<genType>(Integer);
|
||||||
genType FractionalPart = fract(x);
|
genType FractionalPart = fract(x);
|
||||||
|
|
||||||
if(FractionalPart > genType(0.5) || FractionalPart < genType(0.5))
|
if(FractionalPart > static_cast<genType>(0.5) || FractionalPart < static_cast<genType>(0.5))
|
||||||
{
|
{
|
||||||
return round(x);
|
return round(x);
|
||||||
}
|
}
|
||||||
@ -157,13 +169,13 @@ namespace detail
|
|||||||
{
|
{
|
||||||
return IntegerPart;
|
return IntegerPart;
|
||||||
}
|
}
|
||||||
else if(x <= genType(0)) // Work around...
|
else if(x <= static_cast<genType>(0)) // Work around...
|
||||||
{
|
{
|
||||||
return IntegerPart - 1;
|
return IntegerPart - static_cast<genType>(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return IntegerPart + 1;
|
return IntegerPart + static_cast<genType>(1);
|
||||||
}
|
}
|
||||||
//else // Bug on MinGW 4.5.2
|
//else // Bug on MinGW 4.5.2
|
||||||
//{
|
//{
|
||||||
@ -177,7 +189,9 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER genType ceil(genType const & x)
|
GLM_FUNC_QUALIFIER genType ceil(genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'ceil' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'ceil' only accept floating-point inputs");
|
||||||
|
|
||||||
return ::std::ceil(x);
|
return ::std::ceil(x);
|
||||||
}
|
}
|
||||||
@ -191,9 +205,11 @@ namespace detail
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'fract' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'fract' only accept floating-point inputs");
|
||||||
|
|
||||||
return x - ::std::floor(x);
|
return x - floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(fract)
|
VECTORIZE_VEC(fract)
|
||||||
@ -206,7 +222,9 @@ namespace detail
|
|||||||
genType const & y
|
genType const & y
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'mod' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'mod' only accept floating-point inputs");
|
||||||
|
|
||||||
return x - y * floor(x / y);
|
return x - y * floor(x / y);
|
||||||
}
|
}
|
||||||
@ -222,7 +240,9 @@ namespace detail
|
|||||||
genType & i
|
genType & i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'modf' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'modf' only accept floating-point inputs");
|
||||||
|
|
||||||
return std::modf(x, &i);
|
return std::modf(x, &i);
|
||||||
}
|
}
|
||||||
@ -283,9 +303,8 @@ namespace detail
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(
|
GLM_STATIC_ASSERT(
|
||||||
detail::type<genType>::is_float ||
|
std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
|
||||||
detail::type<genType>::is_int ||
|
"'min' only accept floating-point or integer inputs");
|
||||||
detail::type<genType>::is_uint, "'min' only accept numbers");
|
|
||||||
|
|
||||||
return x < y ? x : y;
|
return x < y ? x : y;
|
||||||
}
|
}
|
||||||
@ -302,9 +321,8 @@ namespace detail
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(
|
GLM_STATIC_ASSERT(
|
||||||
detail::type<genType>::is_float ||
|
std::numeric_limits<genType>::is_iec559 || detail::type<genType>::is_int || detail::type<genType>::is_uint,
|
||||||
detail::type<genType>::is_int ||
|
"'max' only accept floating-point or integer inputs");
|
||||||
detail::type<genType>::is_uint, "'max' only accept numbers");
|
|
||||||
|
|
||||||
return x > y ? x : y;
|
return x > y ? x : y;
|
||||||
}
|
}
|
||||||
@ -313,18 +331,17 @@ namespace detail
|
|||||||
VECTORIZE_VEC_VEC(max)
|
VECTORIZE_VEC_VEC(max)
|
||||||
|
|
||||||
// clamp
|
// clamp
|
||||||
template <typename valType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER valType clamp
|
GLM_FUNC_QUALIFIER genType clamp
|
||||||
(
|
(
|
||||||
valType const & x,
|
genType const & x,
|
||||||
valType const & minVal,
|
genType const & minVal,
|
||||||
valType const & maxVal
|
genType const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(
|
GLM_STATIC_ASSERT(
|
||||||
detail::type<valType>::is_float ||
|
std::numeric_limits<genType>::is_iec559 || detail::type<genType>::is_int || detail::type<genType>::is_uint,
|
||||||
detail::type<valType>::is_int ||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
detail::type<valType>::is_uint, "'clamp' only accept numbers");
|
|
||||||
|
|
||||||
return min(maxVal, max(minVal, x));
|
return min(maxVal, max(minVal, x));
|
||||||
}
|
}
|
||||||
@ -337,6 +354,10 @@ namespace detail
|
|||||||
T const & maxVal
|
T const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || detail::type<T>::is_int || detail::type<T>::is_uint,
|
||||||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return detail::tvec2<T, P>(
|
return detail::tvec2<T, P>(
|
||||||
clamp(x.x, minVal, maxVal),
|
clamp(x.x, minVal, maxVal),
|
||||||
clamp(x.y, minVal, maxVal));
|
clamp(x.y, minVal, maxVal));
|
||||||
@ -350,6 +371,10 @@ namespace detail
|
|||||||
T const & maxVal
|
T const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || detail::type<T>::is_int || detail::type<T>::is_uint,
|
||||||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return detail::tvec3<T, P>(
|
return detail::tvec3<T, P>(
|
||||||
clamp(x.x, minVal, maxVal),
|
clamp(x.x, minVal, maxVal),
|
||||||
clamp(x.y, minVal, maxVal),
|
clamp(x.y, minVal, maxVal),
|
||||||
@ -364,6 +389,10 @@ namespace detail
|
|||||||
T const & maxVal
|
T const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || detail::type<T>::is_int || detail::type<T>::is_uint,
|
||||||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return detail::tvec4<T, P>(
|
return detail::tvec4<T, P>(
|
||||||
clamp(x.x, minVal, maxVal),
|
clamp(x.x, minVal, maxVal),
|
||||||
clamp(x.y, minVal, maxVal),
|
clamp(x.y, minVal, maxVal),
|
||||||
@ -379,6 +408,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & maxVal
|
detail::tvec2<T, P> const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || detail::type<T>::is_int || detail::type<T>::is_uint,
|
||||||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return detail::tvec2<T, P>(
|
return detail::tvec2<T, P>(
|
||||||
clamp(x.x, minVal.x, maxVal.x),
|
clamp(x.x, minVal.x, maxVal.x),
|
||||||
clamp(x.y, minVal.y, maxVal.y));
|
clamp(x.y, minVal.y, maxVal.y));
|
||||||
@ -392,6 +425,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & maxVal
|
detail::tvec3<T, P> const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || detail::type<T>::is_int || detail::type<T>::is_uint,
|
||||||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return detail::tvec3<T, P>(
|
return detail::tvec3<T, P>(
|
||||||
clamp(x.x, minVal.x, maxVal.x),
|
clamp(x.x, minVal.x, maxVal.x),
|
||||||
clamp(x.y, minVal.y, maxVal.y),
|
clamp(x.y, minVal.y, maxVal.y),
|
||||||
@ -406,6 +443,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & maxVal
|
detail::tvec4<T, P> const & maxVal
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559 || detail::type<T>::is_int || detail::type<T>::is_uint,
|
||||||
|
"'clamp' only accept floating-point or integer inputs");
|
||||||
|
|
||||||
return detail::tvec4<T, P>(
|
return detail::tvec4<T, P>(
|
||||||
clamp(x.x, minVal.x, maxVal.x),
|
clamp(x.x, minVal.x, maxVal.x),
|
||||||
clamp(x.y, minVal.y, maxVal.y),
|
clamp(x.y, minVal.y, maxVal.y),
|
||||||
@ -422,7 +463,9 @@ namespace detail
|
|||||||
genType const & a
|
genType const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float , "'genType' is not floating-point type");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
@ -435,7 +478,9 @@ namespace detail
|
|||||||
T const & a
|
T const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float , "'genType' is not floating-point type");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
@ -448,6 +493,10 @@ namespace detail
|
|||||||
T const & a
|
T const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,6 +508,10 @@ namespace detail
|
|||||||
T const & a
|
T const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,6 +523,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & a
|
detail::tvec2<T, P> const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +538,9 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & a
|
detail::tvec3<T, P> const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float , "'genType' is not floating-point type");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
@ -494,6 +553,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & a
|
detail::tvec4<T, P> const & a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return x + a * (y - x);
|
return x + a * (y - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +606,9 @@ namespace detail
|
|||||||
bool a
|
bool a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return a ? y : x;
|
return a ? y : x;
|
||||||
}
|
}
|
||||||
@ -556,7 +621,9 @@ namespace detail
|
|||||||
bool a
|
bool a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return a ? y : x;
|
return a ? y : x;
|
||||||
}
|
}
|
||||||
@ -569,7 +636,9 @@ namespace detail
|
|||||||
bool a
|
bool a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
return a ? y : x;
|
return a ? y : x;
|
||||||
}
|
}
|
||||||
@ -582,7 +651,9 @@ namespace detail
|
|||||||
typename detail::tvec2<T, P>::bool_type a
|
typename detail::tvec2<T, P>::bool_type a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
detail::tvec2<T, P> result;
|
detail::tvec2<T, P> result;
|
||||||
for(int i = 0; i < x.length(); ++i)
|
for(int i = 0; i < x.length(); ++i)
|
||||||
@ -599,7 +670,9 @@ namespace detail
|
|||||||
typename detail::tvec3<T, P>::bool_type a
|
typename detail::tvec3<T, P>::bool_type a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
detail::tvec3<T, P> result;
|
detail::tvec3<T, P> result;
|
||||||
for(int i = 0; i < x.length(); ++i)
|
for(int i = 0; i < x.length(); ++i)
|
||||||
@ -616,7 +689,9 @@ namespace detail
|
|||||||
typename detail::tvec4<T, P>::bool_type a
|
typename detail::tvec4<T, P>::bool_type a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'mix' only accept floating-point inputs");
|
||||||
|
|
||||||
detail::tvec4<T, P> result;
|
detail::tvec4<T, P> result;
|
||||||
for(int i = 0; i < x.length(); ++i)
|
for(int i = 0; i < x.length(); ++i)
|
||||||
@ -633,9 +708,11 @@ namespace detail
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'step' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return x < edge ? genType(0) : genType(1);
|
return x < edge ? static_cast<genType>(0) : static_cast<genType>(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
@ -645,6 +722,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & x
|
detail::tvec2<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec2<T, P>(
|
return detail::tvec2<T, P>(
|
||||||
x.x < edge ? T(0) : T(1),
|
x.x < edge ? T(0) : T(1),
|
||||||
x.y < edge ? T(0) : T(1));
|
x.y < edge ? T(0) : T(1));
|
||||||
@ -657,6 +738,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & x
|
detail::tvec3<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec3<T, P>(
|
return detail::tvec3<T, P>(
|
||||||
x.x < edge ? T(0) : T(1),
|
x.x < edge ? T(0) : T(1),
|
||||||
x.y < edge ? T(0) : T(1),
|
x.y < edge ? T(0) : T(1),
|
||||||
@ -670,6 +755,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & x
|
detail::tvec4<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec4<T, P>(
|
return detail::tvec4<T, P>(
|
||||||
x.x < edge ? T(0) : T(1),
|
x.x < edge ? T(0) : T(1),
|
||||||
x.y < edge ? T(0) : T(1),
|
x.y < edge ? T(0) : T(1),
|
||||||
@ -684,6 +773,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & x
|
detail::tvec2<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec2<T, P>(
|
return detail::tvec2<T, P>(
|
||||||
x.x < edge.x ? T(0) : T(1),
|
x.x < edge.x ? T(0) : T(1),
|
||||||
x.y < edge.y ? T(0) : T(1));
|
x.y < edge.y ? T(0) : T(1));
|
||||||
@ -696,6 +789,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & x
|
detail::tvec3<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec3<T, P>(
|
return detail::tvec3<T, P>(
|
||||||
x.x < edge.x ? T(0) : T(1),
|
x.x < edge.x ? T(0) : T(1),
|
||||||
x.y < edge.y ? T(0) : T(1),
|
x.y < edge.y ? T(0) : T(1),
|
||||||
@ -709,6 +806,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & x
|
detail::tvec4<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'step' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec4<T, P>(
|
return detail::tvec4<T, P>(
|
||||||
x.x < edge.x ? T(0) : T(1),
|
x.x < edge.x ? T(0) : T(1),
|
||||||
x.y < edge.y ? T(0) : T(1),
|
x.y < edge.y ? T(0) : T(1),
|
||||||
@ -725,7 +826,9 @@ namespace detail
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'smoothstep' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1));
|
genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1));
|
||||||
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
||||||
@ -739,6 +842,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & x
|
detail::tvec2<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec2<T, P>(
|
return detail::tvec2<T, P>(
|
||||||
smoothstep(edge0, edge1, x.x),
|
smoothstep(edge0, edge1, x.x),
|
||||||
smoothstep(edge0, edge1, x.y));
|
smoothstep(edge0, edge1, x.y));
|
||||||
@ -752,6 +859,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & x
|
detail::tvec3<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec3<T, P>(
|
return detail::tvec3<T, P>(
|
||||||
smoothstep(edge0, edge1, x.x),
|
smoothstep(edge0, edge1, x.x),
|
||||||
smoothstep(edge0, edge1, x.y),
|
smoothstep(edge0, edge1, x.y),
|
||||||
@ -766,6 +877,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & x
|
detail::tvec4<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec4<T, P>(
|
return detail::tvec4<T, P>(
|
||||||
smoothstep(edge0, edge1, x.x),
|
smoothstep(edge0, edge1, x.x),
|
||||||
smoothstep(edge0, edge1, x.y),
|
smoothstep(edge0, edge1, x.y),
|
||||||
@ -781,6 +896,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & x
|
detail::tvec2<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec2<T, P>(
|
return detail::tvec2<T, P>(
|
||||||
smoothstep(edge0.x, edge1.x, x.x),
|
smoothstep(edge0.x, edge1.x, x.x),
|
||||||
smoothstep(edge0.y, edge1.y, x.y));
|
smoothstep(edge0.y, edge1.y, x.y));
|
||||||
@ -794,6 +913,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & x
|
detail::tvec3<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec3<T, P>(
|
return detail::tvec3<T, P>(
|
||||||
smoothstep(edge0.x, edge1.x, x.x),
|
smoothstep(edge0.x, edge1.x, x.x),
|
||||||
smoothstep(edge0.y, edge1.y, x.y),
|
smoothstep(edge0.y, edge1.y, x.y),
|
||||||
@ -808,6 +931,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & x
|
detail::tvec4<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'smoothstep' only accept floating-point inputs");
|
||||||
|
|
||||||
return detail::tvec4<T, P>(
|
return detail::tvec4<T, P>(
|
||||||
smoothstep(edge0.x, edge1.x, x.x),
|
smoothstep(edge0.x, edge1.x, x.x),
|
||||||
smoothstep(edge0.y, edge1.y, x.y),
|
smoothstep(edge0.y, edge1.y, x.y),
|
||||||
@ -819,7 +946,9 @@ namespace detail
|
|||||||
template <typename genType>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER bool isnan(genType const & x)
|
GLM_FUNC_QUALIFIER bool isnan(genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'isnan' only accept floating-point inputs");
|
||||||
|
|
||||||
# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
|
# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
|
||||||
return _isnan(x) != 0;
|
return _isnan(x) != 0;
|
||||||
@ -842,6 +971,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & x
|
detail::tvec2<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'isnan' only accept floating-point inputs");
|
||||||
|
|
||||||
return typename detail::tvec2<T, P>::bool_type(
|
return typename detail::tvec2<T, P>::bool_type(
|
||||||
isnan(x.x),
|
isnan(x.x),
|
||||||
isnan(x.y));
|
isnan(x.y));
|
||||||
@ -853,6 +986,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & x
|
detail::tvec3<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'isnan' only accept floating-point inputs");
|
||||||
|
|
||||||
return typename detail::tvec3<T, P>::bool_type(
|
return typename detail::tvec3<T, P>::bool_type(
|
||||||
isnan(x.x),
|
isnan(x.x),
|
||||||
isnan(x.y),
|
isnan(x.y),
|
||||||
@ -865,6 +1002,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & x
|
detail::tvec4<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'isnan' only accept floating-point inputs");
|
||||||
|
|
||||||
return typename detail::tvec4<T, P>::bool_type(
|
return typename detail::tvec4<T, P>::bool_type(
|
||||||
isnan(x.x),
|
isnan(x.x),
|
||||||
isnan(x.y),
|
isnan(x.y),
|
||||||
@ -876,7 +1017,9 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER bool isinf(
|
GLM_FUNC_QUALIFIER bool isinf(
|
||||||
genType const & x)
|
genType const & x)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isinf' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'isinf' only accept floating-point inputs");
|
||||||
|
|
||||||
# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
|
# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
|
||||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||||
@ -900,6 +1043,10 @@ namespace detail
|
|||||||
detail::tvec2<T, P> const & x
|
detail::tvec2<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'isinf' only accept floating-point inputs");
|
||||||
|
|
||||||
return typename detail::tvec2<T, P>::bool_type(
|
return typename detail::tvec2<T, P>::bool_type(
|
||||||
isinf(x.x),
|
isinf(x.x),
|
||||||
isinf(x.y));
|
isinf(x.y));
|
||||||
@ -911,6 +1058,10 @@ namespace detail
|
|||||||
detail::tvec3<T, P> const & x
|
detail::tvec3<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'isinf' only accept floating-point inputs");
|
||||||
|
|
||||||
return typename detail::tvec3<T, P>::bool_type(
|
return typename detail::tvec3<T, P>::bool_type(
|
||||||
isinf(x.x),
|
isinf(x.x),
|
||||||
isinf(x.y),
|
isinf(x.y),
|
||||||
@ -923,6 +1074,10 @@ namespace detail
|
|||||||
detail::tvec4<T, P> const & x
|
detail::tvec4<T, P> const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'isinf' only accept floating-point inputs");
|
||||||
|
|
||||||
return typename detail::tvec4<T, P>::bool_type(
|
return typename detail::tvec4<T, P>::bool_type(
|
||||||
isinf(x.x),
|
isinf(x.x),
|
||||||
isinf(x.y),
|
isinf(x.y),
|
||||||
@ -930,157 +1085,120 @@ namespace detail
|
|||||||
isinf(x.w));
|
isinf(x.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value)
|
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v)
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<int*>(const_cast<float*>(&value));
|
return *reinterpret_cast<int*>(const_cast<float*>(&v));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<int, defaultp> floatBitsToInt
|
GLM_FUNC_QUALIFIER detail::tvec2<int, defaultp> floatBitsToInt
|
||||||
(
|
(
|
||||||
detail::tvec2<float, defaultp> const & value
|
detail::tvec2<float, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec2<int, defaultp>(
|
return *reinterpret_cast<detail::tvec2<int, defaultp>*>(const_cast<detail::tvec2<float, defaultp>*>(&v));
|
||||||
floatBitsToInt(value.x),
|
|
||||||
floatBitsToInt(value.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<int, defaultp> floatBitsToInt
|
GLM_FUNC_QUALIFIER detail::tvec3<int, defaultp> floatBitsToInt
|
||||||
(
|
(
|
||||||
detail::tvec3<float, defaultp> const & value
|
detail::tvec3<float, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec3<int, defaultp>(
|
return *reinterpret_cast<detail::tvec3<int, defaultp>*>(const_cast<detail::tvec3<float, defaultp>*>(&v));
|
||||||
floatBitsToInt(value.x),
|
|
||||||
floatBitsToInt(value.y),
|
|
||||||
floatBitsToInt(value.z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<int, defaultp> floatBitsToInt
|
GLM_FUNC_QUALIFIER detail::tvec4<int, defaultp> floatBitsToInt
|
||||||
(
|
(
|
||||||
detail::tvec4<float, defaultp> const & value
|
detail::tvec4<float, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec4<int, defaultp>(
|
return *reinterpret_cast<detail::tvec4<int, defaultp>*>(const_cast<detail::tvec4<float, defaultp>*>(&v));
|
||||||
floatBitsToInt(value.x),
|
|
||||||
floatBitsToInt(value.y),
|
|
||||||
floatBitsToInt(value.z),
|
|
||||||
floatBitsToInt(value.w));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value)
|
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<uint*>(const_cast<float*>(&value));
|
return *reinterpret_cast<uint*>(const_cast<float*>(&v));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<uint, defaultp> floatBitsToUint
|
GLM_FUNC_QUALIFIER detail::tvec2<uint, defaultp> floatBitsToUint
|
||||||
(
|
(
|
||||||
detail::tvec2<float, defaultp> const & value
|
detail::tvec2<float, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec2<uint, defaultp>(
|
return *reinterpret_cast<detail::tvec2<uint, defaultp>*>(const_cast<detail::tvec2<float, defaultp>*>(&v));
|
||||||
floatBitsToUint(value.x),
|
|
||||||
floatBitsToUint(value.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<uint, defaultp> floatBitsToUint
|
GLM_FUNC_QUALIFIER detail::tvec3<uint, defaultp> floatBitsToUint
|
||||||
(
|
(
|
||||||
detail::tvec3<float, defaultp> const & value
|
detail::tvec3<float, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec3<uint, defaultp>(
|
return *reinterpret_cast<detail::tvec3<uint, defaultp>*>(const_cast<detail::tvec3<float, defaultp>*>(&v));
|
||||||
floatBitsToUint(value.x),
|
|
||||||
floatBitsToUint(value.y),
|
|
||||||
floatBitsToUint(value.z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<uint, defaultp> floatBitsToUint
|
GLM_FUNC_QUALIFIER detail::tvec4<uint, defaultp> floatBitsToUint
|
||||||
(
|
(
|
||||||
detail::tvec4<float, defaultp> const & value
|
detail::tvec4<float, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec4<uint, defaultp>(
|
return *reinterpret_cast<detail::tvec4<uint, defaultp>*>(const_cast<detail::tvec4<float, defaultp>*>(&v));
|
||||||
floatBitsToUint(value.x),
|
|
||||||
floatBitsToUint(value.y),
|
|
||||||
floatBitsToUint(value.z),
|
|
||||||
floatBitsToUint(value.w));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & value)
|
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v)
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<float*>(const_cast<int*>(&value));
|
return *reinterpret_cast<float*>(const_cast<int*>(&v));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<float, defaultp> intBitsToFloat
|
GLM_FUNC_QUALIFIER detail::tvec2<float, defaultp> intBitsToFloat
|
||||||
|
|
||||||
(
|
(
|
||||||
detail::tvec2<int, defaultp> const & value
|
detail::tvec2<int, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec2<float, defaultp>(
|
return *reinterpret_cast<detail::tvec2<float, defaultp>*>(const_cast<detail::tvec2<int, defaultp>*>(&v));
|
||||||
intBitsToFloat(value.x),
|
|
||||||
intBitsToFloat(value.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<float, defaultp> intBitsToFloat
|
GLM_FUNC_QUALIFIER detail::tvec3<float, defaultp> intBitsToFloat
|
||||||
(
|
(
|
||||||
detail::tvec3<int, defaultp> const & value
|
detail::tvec3<int, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec3<float, defaultp>(
|
return *reinterpret_cast<detail::tvec3<float, defaultp>*>(const_cast<detail::tvec3<int, defaultp>*>(&v));
|
||||||
intBitsToFloat(value.x),
|
|
||||||
intBitsToFloat(value.y),
|
|
||||||
intBitsToFloat(value.z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<float, defaultp> intBitsToFloat
|
GLM_FUNC_QUALIFIER detail::tvec4<float, defaultp> intBitsToFloat
|
||||||
(
|
(
|
||||||
detail::tvec4<int, defaultp> const & value
|
detail::tvec4<int, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec4<float, defaultp>(
|
return *reinterpret_cast<detail::tvec4<float, defaultp>*>(const_cast<detail::tvec4<int, defaultp>*>(&v));
|
||||||
intBitsToFloat(value.x),
|
|
||||||
intBitsToFloat(value.y),
|
|
||||||
intBitsToFloat(value.z),
|
|
||||||
intBitsToFloat(value.w));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value)
|
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v)
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<float*>(const_cast<uint*>(&value));
|
return *reinterpret_cast<float*>(const_cast<uint*>(&v));
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec2<float, defaultp> uintBitsToFloat
|
GLM_FUNC_QUALIFIER detail::tvec2<float, defaultp> uintBitsToFloat
|
||||||
(
|
(
|
||||||
detail::tvec2<uint, defaultp> const & value
|
detail::tvec2<uint, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec2<float, defaultp>(
|
return *reinterpret_cast<detail::tvec2<float, defaultp>*>(const_cast<detail::tvec2<uint, defaultp>*>(&v));
|
||||||
uintBitsToFloat(value.x),
|
|
||||||
uintBitsToFloat(value.y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec3<float, defaultp> uintBitsToFloat
|
GLM_FUNC_QUALIFIER detail::tvec3<float, defaultp> uintBitsToFloat
|
||||||
(
|
(
|
||||||
detail::tvec3<uint, defaultp> const & value
|
detail::tvec3<uint, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec3<float, defaultp>(
|
return *reinterpret_cast<detail::tvec3<float, defaultp>*>(const_cast<detail::tvec3<uint, defaultp>*>(&v));
|
||||||
uintBitsToFloat(value.x),
|
|
||||||
uintBitsToFloat(value.y),
|
|
||||||
uintBitsToFloat(value.z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER detail::tvec4<float, defaultp> uintBitsToFloat
|
GLM_FUNC_QUALIFIER detail::tvec4<float, defaultp> uintBitsToFloat
|
||||||
(
|
(
|
||||||
detail::tvec4<uint, defaultp> const & value
|
detail::tvec4<uint, defaultp> const & v
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return detail::tvec4<float, defaultp>(
|
return *reinterpret_cast<detail::tvec4<float, defaultp>*>(const_cast<detail::tvec4<uint, defaultp>*>(&v));
|
||||||
uintBitsToFloat(value.x),
|
|
||||||
uintBitsToFloat(value.y),
|
|
||||||
uintBitsToFloat(value.z),
|
|
||||||
uintBitsToFloat(value.w));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -1101,6 +1219,10 @@ namespace detail
|
|||||||
int & exp
|
int & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1111,6 +1233,10 @@ namespace detail
|
|||||||
detail::tvec2<int, P> & exp
|
detail::tvec2<int, P> & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,6 +1247,10 @@ namespace detail
|
|||||||
detail::tvec3<int, P> & exp
|
detail::tvec3<int, P> & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,6 +1261,10 @@ namespace detail
|
|||||||
detail::tvec4<int, P> & exp
|
detail::tvec4<int, P> & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1141,7 +1275,11 @@ namespace detail
|
|||||||
int const & exp
|
int const & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::frexp(x, exp);
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'frexp' only accept floating-point inputs");
|
||||||
|
|
||||||
|
return std::ldexp(x, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
@ -1151,7 +1289,11 @@ namespace detail
|
|||||||
detail::tvec2<int, P> const & exp
|
detail::tvec2<int, P> const & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::frexp(x, exp);
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
|
return std::ldexp(x, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
@ -1161,7 +1303,11 @@ namespace detail
|
|||||||
detail::tvec3<int, P> const & exp
|
detail::tvec3<int, P> const & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::frexp(x, exp);
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
|
return std::ldexp(x, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
@ -1171,7 +1317,11 @@ namespace detail
|
|||||||
detail::tvec4<int, P> const & exp
|
detail::tvec4<int, P> const & exp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return std::frexp(x, exp);
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<T>::is_iec559,
|
||||||
|
"'ldexp' only accept floating-point inputs");
|
||||||
|
|
||||||
|
return std::ldexp(x, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -36,6 +36,11 @@
|
|||||||
#ifndef glm_core_func_exponential
|
#ifndef glm_core_func_exponential
|
||||||
#define glm_core_func_exponential GLM_VERSION
|
#define glm_core_func_exponential GLM_VERSION
|
||||||
|
|
||||||
|
#include "type_vec1.hpp"
|
||||||
|
#include "type_vec2.hpp"
|
||||||
|
#include "type_vec3.hpp"
|
||||||
|
#include "type_vec4.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
/// @addtogroup core_func_exponential
|
/// @addtogroup core_func_exponential
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "func_vector_relational.hpp"
|
||||||
|
#include "_vectorize.hpp"
|
||||||
|
#include <limits>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// pow
|
// pow
|
||||||
@ -36,9 +41,11 @@ namespace glm
|
|||||||
genType const & y
|
genType const & y
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'pow' only accept floating-point inputs");
|
||||||
|
|
||||||
return genType(::std::pow(x, y));
|
return std::pow(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC_VEC(pow)
|
VECTORIZE_VEC_VEC(pow)
|
||||||
@ -50,9 +57,11 @@ namespace glm
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'exp' only accept floating-point inputs");
|
||||||
|
|
||||||
return genType(::std::exp(x));
|
return std::exp(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(exp)
|
VECTORIZE_VEC(exp)
|
||||||
@ -64,9 +73,11 @@ namespace glm
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'log' only accept floating-point inputs");
|
||||||
|
|
||||||
return genType(::std::log(x));
|
return std::log(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(log)
|
VECTORIZE_VEC(log)
|
||||||
@ -78,9 +89,11 @@ namespace glm
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'exp2' only accept floating-point inputs");
|
||||||
|
|
||||||
return genType(::std::exp(genType(0.69314718055994530941723212145818) * x));
|
return std::exp(genType(0.69314718055994530941723212145818) * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(exp2)
|
VECTORIZE_VEC(exp2)
|
||||||
@ -132,9 +145,11 @@ namespace _detail
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'sqrt' only accept floating-point inputs");
|
||||||
|
|
||||||
return genType(::std::sqrt(x));
|
return std::sqrt(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(sqrt)
|
VECTORIZE_VEC(sqrt)
|
||||||
@ -145,10 +160,13 @@ namespace _detail
|
|||||||
genType const & x
|
genType const & x
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input");
|
GLM_STATIC_ASSERT(
|
||||||
|
std::numeric_limits<genType>::is_iec559,
|
||||||
|
"'inversesqrt' only accept floating-point inputs");
|
||||||
|
|
||||||
assert(x > genType(0));
|
assert(x > genType(0));
|
||||||
|
|
||||||
return genType(1) / ::std::sqrt(x);
|
return genType(1) / std::sqrt(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(inversesqrt)
|
VECTORIZE_VEC(inversesqrt)
|
||||||
@ -171,24 +189,32 @@ namespace _detail
|
|||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v)
|
GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v)
|
||||||
{
|
{
|
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec1(0))));
|
||||||
|
|
||||||
return detail::fastInversesqrt<lowp_vec1, uint>(v);
|
return detail::fastInversesqrt<lowp_vec1, uint>(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v)
|
GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v)
|
||||||
{
|
{
|
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec2(0))));
|
||||||
|
|
||||||
return detail::fastInversesqrt<lowp_vec2, lowp_uvec2>(v);
|
return detail::fastInversesqrt<lowp_vec2, lowp_uvec2>(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v)
|
GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v)
|
||||||
{
|
{
|
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec3(0))));
|
||||||
|
|
||||||
return detail::fastInversesqrt<lowp_vec3, lowp_uvec3>(v);
|
return detail::fastInversesqrt<lowp_vec3, lowp_uvec3>(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v)
|
GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v)
|
||||||
{
|
{
|
||||||
|
assert(glm::all(glm::greaterThan(v, lowp_vec4(0))));
|
||||||
|
|
||||||
return detail::fastInversesqrt<lowp_vec4, lowp_uvec4>(v);
|
return detail::fastInversesqrt<lowp_vec4, lowp_uvec4>(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "type_float.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// length
|
// length
|
||||||
@ -137,7 +139,7 @@ namespace glm
|
|||||||
detail::tvec2<T, P> const & y
|
detail::tvec2<T, P> const & y
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'dot' only accept floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||||
|
|
||||||
return x.x * y.x + x.y * y.y;
|
return x.x * y.x + x.y * y.y;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,16 @@
|
|||||||
#ifndef GLM_CORE_func_matrix
|
#ifndef GLM_CORE_func_matrix
|
||||||
#define GLM_CORE_func_matrix GLM_VERSION
|
#define GLM_CORE_func_matrix GLM_VERSION
|
||||||
|
|
||||||
|
#include "type_mat2x2.hpp"
|
||||||
|
#include "type_mat2x3.hpp"
|
||||||
|
#include "type_mat2x4.hpp"
|
||||||
|
#include "type_mat3x2.hpp"
|
||||||
|
#include "type_mat3x3.hpp"
|
||||||
|
#include "type_mat3x4.hpp"
|
||||||
|
#include "type_mat4x2.hpp"
|
||||||
|
#include "type_mat4x3.hpp"
|
||||||
|
#include "type_mat4x4.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
/// @addtogroup core_func_matrix
|
/// @addtogroup core_func_matrix
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "func_geometric.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// matrixCompMult
|
// matrixCompMult
|
||||||
@ -573,7 +575,7 @@ namespace glm
|
|||||||
|
|
||||||
detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
|
detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
|
||||||
|
|
||||||
T Determinant = glm::dot(m[0], Row0);
|
T Determinant = dot(m[0], Row0);
|
||||||
|
|
||||||
Inverse /= Determinant;
|
Inverse /= Determinant;
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "type_half.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER uint32 packUnorm2x16(vec2 const & v)
|
GLM_FUNC_QUALIFIER uint32 packUnorm2x16(vec2 const & v)
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "./core/_vectorize.hpp"
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
// radians
|
// radians
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
#ifndef GLM_CORE_func_vector_relational
|
#ifndef GLM_CORE_func_vector_relational
|
||||||
#define GLM_CORE_func_vector_relational GLM_VERSION
|
#define GLM_CORE_func_vector_relational GLM_VERSION
|
||||||
|
|
||||||
|
#include "precision.hpp"
|
||||||
|
#include "setup.hpp"
|
||||||
|
|
||||||
#if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug
|
#if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
|
@ -81,6 +81,13 @@ namespace detail
|
|||||||
typedef float float32;
|
typedef float float32;
|
||||||
typedef double float64;
|
typedef double float64;
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
// check type sizes
|
||||||
|
#ifndef GLM_STATIC_ASSERT_NULL
|
||||||
|
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
|
||||||
|
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
|
||||||
|
#endif//GLM_STATIC_ASSERT_NULL
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#define glm_core_type_mat2x2
|
#define glm_core_type_mat2x2
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec2.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#define glm_core_type_mat2x3
|
#define glm_core_type_mat2x3
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec2.hpp"
|
||||||
|
#include "type_vec3.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#define glm_core_type_mat2x4
|
#define glm_core_type_mat2x4
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec2.hpp"
|
||||||
|
#include "type_vec4.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#define glm_core_type_mat3x2
|
#define glm_core_type_mat3x2
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec2.hpp"
|
||||||
|
#include "type_vec3.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#define glm_core_type_mat3x3
|
#define glm_core_type_mat3x3
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec3.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#define glm_core_type_mat3x4
|
#define glm_core_type_mat3x4
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec3.hpp"
|
||||||
|
#include "type_vec4.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#define glm_core_type_mat4x2
|
#define glm_core_type_mat4x2
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec2.hpp"
|
||||||
|
#include "type_vec4.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#define glm_core_type_mat4x3
|
#define glm_core_type_mat4x3
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec3.hpp"
|
||||||
|
#include "type_vec4.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#define glm_core_type_mat4x4
|
#define glm_core_type_mat4x4
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
#include "../fwd.hpp"
|
||||||
|
#include "type_vec4.hpp"
|
||||||
#include "type_mat.hpp"
|
#include "type_mat.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define glm_core_type_vec
|
#define glm_core_type_vec
|
||||||
|
|
||||||
#include "precision.hpp"
|
#include "precision.hpp"
|
||||||
|
#include "type_int.hpp"
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#ifndef glm_core_type_gentype2
|
#ifndef glm_core_type_gentype2
|
||||||
#define glm_core_type_gentype2
|
#define glm_core_type_gentype2
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
//#include "../fwd.hpp"
|
||||||
#include "type_vec.hpp"
|
#include "type_vec.hpp"
|
||||||
#ifdef GLM_SWIZZLE
|
#ifdef GLM_SWIZZLE
|
||||||
# if GLM_HAS_ANONYMOUS_UNION
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
@ -38,6 +38,7 @@
|
|||||||
# include "_swizzle_func.hpp"
|
# include "_swizzle_func.hpp"
|
||||||
# endif
|
# endif
|
||||||
#endif //GLM_SWIZZLE
|
#endif //GLM_SWIZZLE
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#ifndef glm_core_type_gentype3
|
#ifndef glm_core_type_gentype3
|
||||||
#define glm_core_type_gentype3
|
#define glm_core_type_gentype3
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
//#include "../fwd.hpp"
|
||||||
#include "type_vec.hpp"
|
#include "type_vec.hpp"
|
||||||
#ifdef GLM_SWIZZLE
|
#ifdef GLM_SWIZZLE
|
||||||
# if GLM_HAS_ANONYMOUS_UNION
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
@ -38,6 +38,7 @@
|
|||||||
# include "_swizzle_func.hpp"
|
# include "_swizzle_func.hpp"
|
||||||
# endif
|
# endif
|
||||||
#endif //GLM_SWIZZLE
|
#endif //GLM_SWIZZLE
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
#ifndef glm_core_type_gentype4
|
#ifndef glm_core_type_gentype4
|
||||||
#define glm_core_type_gentype4
|
#define glm_core_type_gentype4
|
||||||
|
|
||||||
#include "../fwd.hpp"
|
//#include "../fwd.hpp"
|
||||||
|
#include "setup.hpp"
|
||||||
#include "type_vec.hpp"
|
#include "type_vec.hpp"
|
||||||
#ifdef GLM_SWIZZLE
|
#ifdef GLM_SWIZZLE
|
||||||
# if GLM_HAS_ANONYMOUS_UNION
|
# if GLM_HAS_ANONYMOUS_UNION
|
||||||
@ -38,6 +39,7 @@
|
|||||||
# include "_swizzle_func.hpp"
|
# include "_swizzle_func.hpp"
|
||||||
# endif
|
# endif
|
||||||
#endif //GLM_SWIZZLE
|
#endif //GLM_SWIZZLE
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -39,11 +39,6 @@
|
|||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <typename T, precision P> struct tref1;
|
|
||||||
template <typename T, precision P> struct tref2;
|
|
||||||
template <typename T, precision P> struct tref3;
|
|
||||||
template <typename T, precision P> struct tref4;
|
|
||||||
|
|
||||||
template <typename T, precision P> struct tquat;
|
template <typename T, precision P> struct tquat;
|
||||||
}//namespace detail
|
}//namespace detail
|
||||||
|
|
||||||
|
19
glm/glm.hpp
19
glm/glm.hpp
@ -85,19 +85,13 @@
|
|||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
//#include <cstdint>
|
|
||||||
//#include <type_traits>
|
|
||||||
|
|
||||||
#include "fwd.hpp"
|
#include "fwd.hpp"
|
||||||
#include "core/setup.hpp"
|
|
||||||
|
|
||||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED))
|
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED))
|
||||||
# define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED
|
# define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED
|
||||||
# pragma message("GLM: Core library included")
|
# pragma message("GLM: Core library included")
|
||||||
#endif//GLM_MESSAGE
|
#endif//GLM_MESSAGE
|
||||||
|
/*
|
||||||
#include "./core/_vectorize.hpp"
|
|
||||||
|
|
||||||
#include "./core/type_half.hpp"
|
#include "./core/type_half.hpp"
|
||||||
#include "./core/type_float.hpp"
|
#include "./core/type_float.hpp"
|
||||||
#include "./core/type_int.hpp"
|
#include "./core/type_int.hpp"
|
||||||
@ -118,7 +112,7 @@
|
|||||||
#include "./core/type_mat4x2.hpp"
|
#include "./core/type_mat4x2.hpp"
|
||||||
#include "./core/type_mat4x3.hpp"
|
#include "./core/type_mat4x3.hpp"
|
||||||
#include "./core/type_mat4x4.hpp"
|
#include "./core/type_mat4x4.hpp"
|
||||||
|
*/
|
||||||
#include "./core/func_trigonometric.hpp"
|
#include "./core/func_trigonometric.hpp"
|
||||||
#include "./core/func_exponential.hpp"
|
#include "./core/func_exponential.hpp"
|
||||||
#include "./core/func_common.hpp"
|
#include "./core/func_common.hpp"
|
||||||
@ -129,13 +123,4 @@
|
|||||||
#include "./core/func_integer.hpp"
|
#include "./core/func_integer.hpp"
|
||||||
#include "./core/func_noise.hpp"
|
#include "./core/func_noise.hpp"
|
||||||
|
|
||||||
#include "./core/_swizzle.hpp"
|
|
||||||
|
|
||||||
////////////////////
|
|
||||||
// check type sizes
|
|
||||||
#ifndef GLM_STATIC_ASSERT_NULL
|
|
||||||
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
|
|
||||||
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
|
|
||||||
#endif//GLM_STATIC_ASSERT_NULL
|
|
||||||
|
|
||||||
#endif//glm_glm
|
#endif//glm_glm
|
||||||
|
@ -32,7 +32,7 @@ namespace glm{
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER int tquat<T, P>::length() const
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tquat<T, P>::length() const
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,25 @@
|
|||||||
# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
|
# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
|
enum comp
|
||||||
|
{
|
||||||
|
X = 0,
|
||||||
|
R = 0,
|
||||||
|
S = 0,
|
||||||
|
Y = 1,
|
||||||
|
G = 1,
|
||||||
|
T = 1,
|
||||||
|
Z = 2,
|
||||||
|
B = 2,
|
||||||
|
P = 2,
|
||||||
|
W = 3,
|
||||||
|
A = 3,
|
||||||
|
Q = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
namespace glm{
|
namespace glm{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -59,6 +59,11 @@ GLM 0.9.5.0: 2013-XX-XX
|
|||||||
- Optimized packing and unpacking functions
|
- Optimized packing and unpacking functions
|
||||||
- Removed the normalization of the up argument of lookAt function (#114)
|
- Removed the normalization of the up argument of lookAt function (#114)
|
||||||
- Added low precision specializations of inversesqrt
|
- Added low precision specializations of inversesqrt
|
||||||
|
- Fixed ldexp implementation
|
||||||
|
- Increased assert coverage
|
||||||
|
- Increased static_assert coverage
|
||||||
|
- Replaced GLM traits by STL traits when possible
|
||||||
|
- Allowed including individual core feature
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
GLM 0.9.4.6: 2013-09-15
|
GLM 0.9.4.6: 2013-09-15
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/func_matrix.cpp
|
// File : test/core/func_matrix.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/func_matrix.hpp>
|
||||||
|
|
||||||
int test_matrixCompMult()
|
int test_matrixCompMult()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat2x2.cpp
|
// File : test/core/type_mat2x2.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat2x2.hpp>
|
||||||
#include <glm/gtc/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
|
|
||||||
int test_operators()
|
int test_operators()
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat2x3.cpp
|
// File : test/core/type_mat2x3.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat2x3.hpp>
|
||||||
|
|
||||||
static int test_operators()
|
static int test_operators()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat2x4.cpp
|
// File : test/core/type_mat2x4.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat2x4.hpp>
|
||||||
|
|
||||||
static int test_operators()
|
static int test_operators()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat3x2.cpp
|
// File : test/core/type_mat3x2.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat3x2.hpp>
|
||||||
|
|
||||||
static bool test_operators()
|
static bool test_operators()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat3x3.cpp
|
// File : test/core/type_mat3x3.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat3x3.hpp>
|
||||||
#include <glm/gtc/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat3x4.cpp
|
// File : test/core/type_mat3x4.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat3x4.hpp>
|
||||||
|
|
||||||
static bool test_operators()
|
static bool test_operators()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat4x2.cpp
|
// File : test/core/type_mat4x2.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat4x2.hpp>
|
||||||
|
|
||||||
static int test_operators()
|
static int test_operators()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// File : test/core/type_mat4x3.cpp
|
// File : test/core/type_mat4x3.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_mat4x3.hpp>
|
||||||
|
|
||||||
static int test_operators()
|
static int test_operators()
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
// File : test/core/type_mat4x4.cpp
|
// File : test/core/type_mat4x4.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//#define GLM_PRECISION_HIGHP_FLOAT
|
#include <glm/core/type_mat4x4.hpp>
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <glm/gtc/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
// File : test/core/type_vec2.cpp
|
// File : test/core/type_vec2.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/func_vector_relational.hpp>
|
||||||
|
#include <glm/core/type_vec2.hpp>
|
||||||
|
|
||||||
int test_vec2_operators()
|
int test_vec2_operators()
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,11 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define GLM_SWIZZLE
|
#define GLM_SWIZZLE
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_vec2.hpp>
|
||||||
|
#include <glm/core/type_vec3.hpp>
|
||||||
|
#include <glm/core/type_vec4.hpp>
|
||||||
|
#include <glm/core/func_vector_relational.hpp>
|
||||||
|
#include <glm/core/func_geometric.hpp>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
// File : test/core/type_vec4.cpp
|
// File : test/core/type_vec4.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/core/type_vec2.hpp>
|
||||||
|
#include <glm/core/type_vec3.hpp>
|
||||||
|
#include <glm/core/type_vec4.hpp>
|
||||||
|
#include <glm/core/func_vector_relational.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
template <int Value>
|
template <int Value>
|
||||||
|
18
test/external/gli/core/texture2d.hpp
vendored
18
test/external/gli/core/texture2d.hpp
vendored
@ -14,6 +14,22 @@
|
|||||||
|
|
||||||
namespace gli
|
namespace gli
|
||||||
{
|
{
|
||||||
|
enum comp
|
||||||
|
{
|
||||||
|
X = 0,
|
||||||
|
R = 0,
|
||||||
|
S = 0,
|
||||||
|
Y = 1,
|
||||||
|
G = 1,
|
||||||
|
T = 1,
|
||||||
|
Z = 2,
|
||||||
|
B = 2,
|
||||||
|
P = 2,
|
||||||
|
W = 3,
|
||||||
|
A = 3,
|
||||||
|
Q = 3
|
||||||
|
};
|
||||||
|
|
||||||
//template <template <typename> class mem>
|
//template <template <typename> class mem>
|
||||||
class texture2D
|
class texture2D
|
||||||
{
|
{
|
||||||
@ -45,7 +61,7 @@ namespace gli
|
|||||||
void resize(level_type const & Levels);
|
void resize(level_type const & Levels);
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
void swizzle(glm::comp X, glm::comp Y, glm::comp Z, glm::comp W);
|
void swizzle(gli::comp X, gli::comp Y, gli::comp Z, gli::comp W);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<image2D> Images;
|
std::vector<image2D> Images;
|
||||||
|
2
test/external/gli/core/texture2d.inl
vendored
2
test/external/gli/core/texture2d.inl
vendored
@ -86,7 +86,7 @@ namespace gli
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
inline void texture2D::swizzle(glm::comp X, glm::comp Y, glm::comp Z, glm::comp W)
|
inline void texture2D::swizzle(gli::comp X, gli::comp Y, gli::comp Z, gli::comp W)
|
||||||
{
|
{
|
||||||
for(texture2D::level_type Level = 0; Level < this->levels(); ++Level)
|
for(texture2D::level_type Level = 0; Level < this->levels(); ++Level)
|
||||||
{
|
{
|
||||||
|
8
test/external/gli/gtx/loader_tga.inl
vendored
8
test/external/gli/gtx/loader_tga.inl
vendored
@ -91,9 +91,9 @@ namespace loader_tga
|
|||||||
|
|
||||||
// TGA images are saved in BGR or BGRA format.
|
// TGA images are saved in BGR or BGRA format.
|
||||||
if(TexelSize == 24)
|
if(TexelSize == 24)
|
||||||
Image.swizzle<glm::u8vec3>(glm::B, glm::G, glm::R, glm::A);
|
Image.swizzle<glm::u8vec3>(gli::B, gli::G, gli::R, gli::A);
|
||||||
if(TexelSize == 32)
|
if(TexelSize == 32)
|
||||||
Image.swizzle<glm::u8vec4>(glm::B, glm::G, glm::R, glm::A);
|
Image.swizzle<glm::u8vec4>(gli::B, gli::G, gli::R, gli::A);
|
||||||
|
|
||||||
return Image;
|
return Image;
|
||||||
}
|
}
|
||||||
@ -124,9 +124,9 @@ namespace loader_tga
|
|||||||
unsigned char Descriptor = 0;
|
unsigned char Descriptor = 0;
|
||||||
|
|
||||||
if(TexelSize == 24)
|
if(TexelSize == 24)
|
||||||
Image.swizzle<glm::u8vec3>(glm::B, glm::G, glm::R, glm::A);
|
Image.swizzle<glm::u8vec3>(gli::B, gli::G, gli::R, gli::A);
|
||||||
if(TexelSize == 32)
|
if(TexelSize == 32)
|
||||||
Image.swizzle<glm::u8vec4>(glm::B, glm::G, glm::R, glm::A);
|
Image.swizzle<glm::u8vec4>(gli::B, gli::G, gli::R, gli::A);
|
||||||
|
|
||||||
FileOut.write((char*)&IdentificationFieldSize, sizeof(IdentificationFieldSize));
|
FileOut.write((char*)&IdentificationFieldSize, sizeof(IdentificationFieldSize));
|
||||||
FileOut.write((char*)&ColorMapType, sizeof(ColorMapType));
|
FileOut.write((char*)&ColorMapType, sizeof(ColorMapType));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user