- 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
|
||||
#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 detail
|
||||
{
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#define GLM_MESSAGES
|
||||
#include "../glm.hpp"
|
||||
#include <limits>
|
||||
/*
|
||||
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
struct float4
|
||||
|
@ -26,6 +26,8 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
@ -39,8 +41,8 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
detail::type<genFIType>::is_float ||
|
||||
detail::type<genFIType>::is_int, "'abs' only accept floating-point and integer inputs");
|
||||
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
|
||||
"'abs' only accept floating-point and integer inputs");
|
||||
return x >= genFIType(0) ? x : -x;
|
||||
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
||||
}
|
||||
@ -52,7 +54,8 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
|
||||
{
|
||||
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;
|
||||
}
|
||||
};
|
||||
@ -79,7 +82,7 @@ namespace detail
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
detail::type<genFIType>::is_float ||
|
||||
std::numeric_limits<genFIType>::is_iec559 ||
|
||||
detail::type<genFIType>::is_int, "'sign' only accept signed inputs");
|
||||
|
||||
genFIType result;
|
||||
@ -98,7 +101,9 @@ namespace detail
|
||||
template <typename genType>
|
||||
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);
|
||||
}
|
||||
@ -109,7 +114,11 @@ namespace detail
|
||||
template <typename genType>
|
||||
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);
|
||||
}
|
||||
|
||||
@ -119,11 +128,12 @@ namespace detail
|
||||
template <typename genType>
|
||||
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)
|
||||
return genType(int(x - genType(0.5)));
|
||||
return genType(int(x + genType(0.5)));
|
||||
// TODO, add C++11 std::round
|
||||
return x < 0 ? genType(int(x - genType(0.5))) : genType(int(x + genType(0.5)));
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(round)
|
||||
@ -143,13 +153,15 @@ namespace detail
|
||||
template <typename genType>
|
||||
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);
|
||||
genType IntegerPart = genType(Integer);
|
||||
int Integer = static_cast<int>(x);
|
||||
genType IntegerPart = static_cast<genType>(Integer);
|
||||
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);
|
||||
}
|
||||
@ -157,13 +169,13 @@ namespace detail
|
||||
{
|
||||
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
|
||||
{
|
||||
return IntegerPart + 1;
|
||||
return IntegerPart + static_cast<genType>(1);
|
||||
}
|
||||
//else // Bug on MinGW 4.5.2
|
||||
//{
|
||||
@ -177,7 +189,9 @@ namespace detail
|
||||
template <typename genType>
|
||||
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);
|
||||
}
|
||||
@ -191,9 +205,11 @@ namespace detail
|
||||
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)
|
||||
@ -206,7 +222,9 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
@ -222,7 +240,9 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
@ -283,9 +303,8 @@ namespace detail
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
detail::type<genType>::is_float ||
|
||||
detail::type<genType>::is_int ||
|
||||
detail::type<genType>::is_uint, "'min' only accept numbers");
|
||||
std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
|
||||
"'min' only accept floating-point or integer inputs");
|
||||
|
||||
return x < y ? x : y;
|
||||
}
|
||||
@ -302,9 +321,8 @@ namespace detail
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
detail::type<genType>::is_float ||
|
||||
detail::type<genType>::is_int ||
|
||||
detail::type<genType>::is_uint, "'max' only accept numbers");
|
||||
std::numeric_limits<genType>::is_iec559 || detail::type<genType>::is_int || detail::type<genType>::is_uint,
|
||||
"'max' only accept floating-point or integer inputs");
|
||||
|
||||
return x > y ? x : y;
|
||||
}
|
||||
@ -313,18 +331,17 @@ namespace detail
|
||||
VECTORIZE_VEC_VEC(max)
|
||||
|
||||
// clamp
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType clamp
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType clamp
|
||||
(
|
||||
valType const & x,
|
||||
valType const & minVal,
|
||||
valType const & maxVal
|
||||
genType const & x,
|
||||
genType const & minVal,
|
||||
genType const & maxVal
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
detail::type<valType>::is_float ||
|
||||
detail::type<valType>::is_int ||
|
||||
detail::type<valType>::is_uint, "'clamp' only accept numbers");
|
||||
std::numeric_limits<genType>::is_iec559 || detail::type<genType>::is_int || detail::type<genType>::is_uint,
|
||||
"'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
return min(maxVal, max(minVal, x));
|
||||
}
|
||||
@ -337,6 +354,10 @@ namespace detail
|
||||
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>(
|
||||
clamp(x.x, minVal, maxVal),
|
||||
clamp(x.y, minVal, maxVal));
|
||||
@ -350,6 +371,10 @@ namespace detail
|
||||
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>(
|
||||
clamp(x.x, minVal, maxVal),
|
||||
clamp(x.y, minVal, maxVal),
|
||||
@ -364,6 +389,10 @@ namespace detail
|
||||
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>(
|
||||
clamp(x.x, minVal, maxVal),
|
||||
clamp(x.y, minVal, maxVal),
|
||||
@ -379,6 +408,10 @@ namespace detail
|
||||
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>(
|
||||
clamp(x.x, minVal.x, maxVal.x),
|
||||
clamp(x.y, minVal.y, maxVal.y));
|
||||
@ -392,6 +425,10 @@ namespace detail
|
||||
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>(
|
||||
clamp(x.x, minVal.x, maxVal.x),
|
||||
clamp(x.y, minVal.y, maxVal.y),
|
||||
@ -406,6 +443,10 @@ namespace detail
|
||||
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>(
|
||||
clamp(x.x, minVal.x, maxVal.x),
|
||||
clamp(x.y, minVal.y, maxVal.y),
|
||||
@ -422,7 +463,9 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
@ -435,7 +478,9 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
@ -448,6 +493,10 @@ namespace detail
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<T>::is_iec559,
|
||||
"'mix' only accept floating-point inputs");
|
||||
|
||||
return x + a * (y - x);
|
||||
}
|
||||
|
||||
@ -459,6 +508,10 @@ namespace detail
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<T>::is_iec559,
|
||||
"'mix' only accept floating-point inputs");
|
||||
|
||||
return x + a * (y - x);
|
||||
}
|
||||
|
||||
@ -470,6 +523,10 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
|
||||
@ -481,7 +538,9 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
@ -494,6 +553,10 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
|
||||
@ -543,7 +606,9 @@ namespace detail
|
||||
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;
|
||||
}
|
||||
@ -556,7 +621,9 @@ namespace detail
|
||||
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;
|
||||
}
|
||||
@ -569,7 +636,9 @@ namespace detail
|
||||
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;
|
||||
}
|
||||
@ -582,7 +651,9 @@ namespace detail
|
||||
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;
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
@ -599,7 +670,9 @@ namespace detail
|
||||
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;
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
@ -616,7 +689,9 @@ namespace detail
|
||||
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;
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
@ -633,9 +708,11 @@ namespace detail
|
||||
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>
|
||||
@ -645,6 +722,10 @@ namespace detail
|
||||
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>(
|
||||
x.x < edge ? T(0) : T(1),
|
||||
x.y < edge ? T(0) : T(1));
|
||||
@ -657,6 +738,10 @@ namespace detail
|
||||
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>(
|
||||
x.x < edge ? T(0) : T(1),
|
||||
x.y < edge ? T(0) : T(1),
|
||||
@ -670,6 +755,10 @@ namespace detail
|
||||
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>(
|
||||
x.x < edge ? T(0) : T(1),
|
||||
x.y < edge ? T(0) : T(1),
|
||||
@ -684,6 +773,10 @@ namespace detail
|
||||
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>(
|
||||
x.x < edge.x ? T(0) : T(1),
|
||||
x.y < edge.y ? T(0) : T(1));
|
||||
@ -696,6 +789,10 @@ namespace detail
|
||||
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>(
|
||||
x.x < edge.x ? T(0) : T(1),
|
||||
x.y < edge.y ? T(0) : T(1),
|
||||
@ -709,6 +806,10 @@ namespace detail
|
||||
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>(
|
||||
x.x < edge.x ? T(0) : T(1),
|
||||
x.y < edge.y ? T(0) : T(1),
|
||||
@ -725,7 +826,9 @@ namespace detail
|
||||
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));
|
||||
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
||||
@ -739,6 +842,10 @@ namespace detail
|
||||
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>(
|
||||
smoothstep(edge0, edge1, x.x),
|
||||
smoothstep(edge0, edge1, x.y));
|
||||
@ -752,6 +859,10 @@ namespace detail
|
||||
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>(
|
||||
smoothstep(edge0, edge1, x.x),
|
||||
smoothstep(edge0, edge1, x.y),
|
||||
@ -766,6 +877,10 @@ namespace detail
|
||||
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>(
|
||||
smoothstep(edge0, edge1, x.x),
|
||||
smoothstep(edge0, edge1, x.y),
|
||||
@ -781,6 +896,10 @@ namespace detail
|
||||
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>(
|
||||
smoothstep(edge0.x, edge1.x, x.x),
|
||||
smoothstep(edge0.y, edge1.y, x.y));
|
||||
@ -794,6 +913,10 @@ namespace detail
|
||||
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>(
|
||||
smoothstep(edge0.x, edge1.x, x.x),
|
||||
smoothstep(edge0.y, edge1.y, x.y),
|
||||
@ -808,6 +931,10 @@ namespace detail
|
||||
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>(
|
||||
smoothstep(edge0.x, edge1.x, x.x),
|
||||
smoothstep(edge0.y, edge1.y, x.y),
|
||||
@ -819,7 +946,9 @@ namespace detail
|
||||
template <typename genType>
|
||||
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))
|
||||
return _isnan(x) != 0;
|
||||
@ -842,6 +971,10 @@ namespace detail
|
||||
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(
|
||||
isnan(x.x),
|
||||
isnan(x.y));
|
||||
@ -853,6 +986,10 @@ namespace detail
|
||||
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(
|
||||
isnan(x.x),
|
||||
isnan(x.y),
|
||||
@ -865,6 +1002,10 @@ namespace detail
|
||||
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(
|
||||
isnan(x.x),
|
||||
isnan(x.y),
|
||||
@ -876,7 +1017,9 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER bool isinf(
|
||||
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))
|
||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||
@ -900,6 +1043,10 @@ namespace detail
|
||||
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(
|
||||
isinf(x.x),
|
||||
isinf(x.y));
|
||||
@ -911,6 +1058,10 @@ namespace detail
|
||||
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(
|
||||
isinf(x.x),
|
||||
isinf(x.y),
|
||||
@ -923,6 +1074,10 @@ namespace detail
|
||||
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(
|
||||
isinf(x.x),
|
||||
isinf(x.y),
|
||||
@ -930,157 +1085,120 @@ namespace detail
|
||||
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
|
||||
(
|
||||
detail::tvec2<float, defaultp> const & value
|
||||
detail::tvec2<float, defaultp> const & v
|
||||
)
|
||||
{
|
||||
return detail::tvec2<int, defaultp>(
|
||||
floatBitsToInt(value.x),
|
||||
floatBitsToInt(value.y));
|
||||
return *reinterpret_cast<detail::tvec2<int, defaultp>*>(const_cast<detail::tvec2<float, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
floatBitsToInt(value.x),
|
||||
floatBitsToInt(value.y),
|
||||
floatBitsToInt(value.z));
|
||||
return *reinterpret_cast<detail::tvec3<int, defaultp>*>(const_cast<detail::tvec3<float, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
floatBitsToInt(value.x),
|
||||
floatBitsToInt(value.y),
|
||||
floatBitsToInt(value.z),
|
||||
floatBitsToInt(value.w));
|
||||
return *reinterpret_cast<detail::tvec4<int, defaultp>*>(const_cast<detail::tvec4<float, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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
|
||||
(
|
||||
detail::tvec2<float, defaultp> const & value
|
||||
detail::tvec2<float, defaultp> const & v
|
||||
)
|
||||
{
|
||||
return detail::tvec2<uint, defaultp>(
|
||||
floatBitsToUint(value.x),
|
||||
floatBitsToUint(value.y));
|
||||
return *reinterpret_cast<detail::tvec2<uint, defaultp>*>(const_cast<detail::tvec2<float, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
floatBitsToUint(value.x),
|
||||
floatBitsToUint(value.y),
|
||||
floatBitsToUint(value.z));
|
||||
return *reinterpret_cast<detail::tvec3<uint, defaultp>*>(const_cast<detail::tvec3<float, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
floatBitsToUint(value.x),
|
||||
floatBitsToUint(value.y),
|
||||
floatBitsToUint(value.z),
|
||||
floatBitsToUint(value.w));
|
||||
return *reinterpret_cast<detail::tvec4<uint, defaultp>*>(const_cast<detail::tvec4<float, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
(
|
||||
detail::tvec2<int, defaultp> const & value
|
||||
detail::tvec2<int, defaultp> const & v
|
||||
)
|
||||
{
|
||||
return detail::tvec2<float, defaultp>(
|
||||
intBitsToFloat(value.x),
|
||||
intBitsToFloat(value.y));
|
||||
return *reinterpret_cast<detail::tvec2<float, defaultp>*>(const_cast<detail::tvec2<int, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
intBitsToFloat(value.x),
|
||||
intBitsToFloat(value.y),
|
||||
intBitsToFloat(value.z));
|
||||
return *reinterpret_cast<detail::tvec3<float, defaultp>*>(const_cast<detail::tvec3<int, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
intBitsToFloat(value.x),
|
||||
intBitsToFloat(value.y),
|
||||
intBitsToFloat(value.z),
|
||||
intBitsToFloat(value.w));
|
||||
return *reinterpret_cast<detail::tvec4<float, defaultp>*>(const_cast<detail::tvec4<int, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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
|
||||
(
|
||||
detail::tvec2<uint, defaultp> const & value
|
||||
detail::tvec2<uint, defaultp> const & v
|
||||
)
|
||||
{
|
||||
return detail::tvec2<float, defaultp>(
|
||||
uintBitsToFloat(value.x),
|
||||
uintBitsToFloat(value.y));
|
||||
return *reinterpret_cast<detail::tvec2<float, defaultp>*>(const_cast<detail::tvec2<uint, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
uintBitsToFloat(value.x),
|
||||
uintBitsToFloat(value.y),
|
||||
uintBitsToFloat(value.z));
|
||||
return *reinterpret_cast<detail::tvec3<float, defaultp>*>(const_cast<detail::tvec3<uint, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
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>(
|
||||
uintBitsToFloat(value.x),
|
||||
uintBitsToFloat(value.y),
|
||||
uintBitsToFloat(value.z),
|
||||
uintBitsToFloat(value.w));
|
||||
return *reinterpret_cast<detail::tvec4<float, defaultp>*>(const_cast<detail::tvec4<uint, defaultp>*>(&v));
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
@ -1101,6 +1219,10 @@ namespace detail
|
||||
int & exp
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'frexp' only accept floating-point inputs");
|
||||
|
||||
return std::frexp(x, exp);
|
||||
}
|
||||
|
||||
@ -1111,6 +1233,10 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1121,6 +1247,10 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1131,6 +1261,10 @@ namespace detail
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1141,7 +1275,11 @@ namespace detail
|
||||
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>
|
||||
@ -1151,7 +1289,11 @@ namespace detail
|
||||
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>
|
||||
@ -1161,7 +1303,11 @@ namespace detail
|
||||
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>
|
||||
@ -1171,7 +1317,11 @@ namespace detail
|
||||
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
|
||||
|
@ -36,6 +36,11 @@
|
||||
#ifndef glm_core_func_exponential
|
||||
#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
|
||||
{
|
||||
/// @addtogroup core_func_exponential
|
||||
|
@ -26,6 +26,11 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "_vectorize.hpp"
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// pow
|
||||
@ -36,9 +41,11 @@ namespace glm
|
||||
genType const & y
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'pow' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'pow' only accept floating-point inputs");
|
||||
|
||||
return genType(::std::pow(x, y));
|
||||
return std::pow(x, y);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC_VEC(pow)
|
||||
@ -50,9 +57,11 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'exp' only accept floating-point inputs");
|
||||
|
||||
return genType(::std::exp(x));
|
||||
return std::exp(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(exp)
|
||||
@ -64,9 +73,11 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'log' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'log' only accept floating-point inputs");
|
||||
|
||||
return genType(::std::log(x));
|
||||
return std::log(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(log)
|
||||
@ -78,9 +89,11 @@ namespace glm
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'exp2' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'exp2' only accept floating-point inputs");
|
||||
|
||||
return genType(::std::exp(genType(0.69314718055994530941723212145818) * x));
|
||||
return std::exp(genType(0.69314718055994530941723212145818) * x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(exp2)
|
||||
@ -132,9 +145,11 @@ namespace _detail
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'sqrt' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'sqrt' only accept floating-point inputs");
|
||||
|
||||
return genType(::std::sqrt(x));
|
||||
return std::sqrt(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(sqrt)
|
||||
@ -145,10 +160,13 @@ namespace _detail
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'inversesqrt' only accept floating-point input");
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'inversesqrt' only accept floating-point inputs");
|
||||
|
||||
assert(x > genType(0));
|
||||
|
||||
return genType(1) / ::std::sqrt(x);
|
||||
return genType(1) / std::sqrt(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(inversesqrt)
|
||||
@ -171,24 +189,32 @@ namespace _detail
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER lowp_vec1 inversesqrt(lowp_vec1 const & v)
|
||||
{
|
||||
assert(glm::all(glm::greaterThan(v, lowp_vec1(0))));
|
||||
|
||||
return detail::fastInversesqrt<lowp_vec1, uint>(v);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER lowp_vec2 inversesqrt(lowp_vec2 const & v)
|
||||
{
|
||||
assert(glm::all(glm::greaterThan(v, lowp_vec2(0))));
|
||||
|
||||
return detail::fastInversesqrt<lowp_vec2, lowp_uvec2>(v);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER lowp_vec3 inversesqrt(lowp_vec3 const & v)
|
||||
{
|
||||
assert(glm::all(glm::greaterThan(v, lowp_vec3(0))));
|
||||
|
||||
return detail::fastInversesqrt<lowp_vec3, lowp_uvec3>(v);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER lowp_vec4 inversesqrt(lowp_vec4 const & v)
|
||||
{
|
||||
assert(glm::all(glm::greaterThan(v, lowp_vec4(0))));
|
||||
|
||||
return detail::fastInversesqrt<lowp_vec4, lowp_uvec4>(v);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "type_float.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// length
|
||||
@ -137,7 +139,7 @@ namespace glm
|
||||
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;
|
||||
}
|
||||
|
@ -40,6 +40,16 @@
|
||||
#ifndef GLM_CORE_func_matrix
|
||||
#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
|
||||
{
|
||||
/// @addtogroup core_func_matrix
|
||||
|
@ -26,6 +26,8 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "func_geometric.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// matrixCompMult
|
||||
@ -573,7 +575,7 @@ namespace glm
|
||||
|
||||
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;
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "type_half.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
GLM_FUNC_QUALIFIER uint32 packUnorm2x16(vec2 const & v)
|
||||
|
@ -26,6 +26,8 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "./core/_vectorize.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// radians
|
||||
|
@ -41,6 +41,9 @@
|
||||
#ifndef GLM_CORE_func_vector_relational
|
||||
#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
|
||||
|
||||
namespace glm
|
||||
|
@ -81,6 +81,13 @@ namespace detail
|
||||
typedef float float32;
|
||||
typedef double float64;
|
||||
|
||||
////////////////////
|
||||
// check type sizes
|
||||
#ifndef GLM_STATIC_ASSERT_NULL
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
|
||||
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
|
||||
#endif//GLM_STATIC_ASSERT_NULL
|
||||
|
||||
/// @}
|
||||
|
||||
namespace detail
|
||||
|
@ -30,7 +30,9 @@
|
||||
#define glm_core_type_mat2x2
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,10 @@
|
||||
#define glm_core_type_mat2x3
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,10 @@
|
||||
#define glm_core_type_mat2x4
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,10 @@
|
||||
#define glm_core_type_mat3x2
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,9 @@
|
||||
#define glm_core_type_mat3x3
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,10 @@
|
||||
#define glm_core_type_mat3x4
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,10 @@
|
||||
#define glm_core_type_mat4x2
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,10 @@
|
||||
#define glm_core_type_mat4x3
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,7 +30,9 @@
|
||||
#define glm_core_type_mat4x4
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -30,6 +30,7 @@
|
||||
#define glm_core_type_vec
|
||||
|
||||
#include "precision.hpp"
|
||||
#include "type_int.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef glm_core_type_gentype2
|
||||
#define glm_core_type_gentype2
|
||||
|
||||
#include "../fwd.hpp"
|
||||
//#include "../fwd.hpp"
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
@ -38,6 +38,7 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef glm_core_type_gentype3
|
||||
#define glm_core_type_gentype3
|
||||
|
||||
#include "../fwd.hpp"
|
||||
//#include "../fwd.hpp"
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
@ -38,6 +38,7 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -29,7 +29,8 @@
|
||||
#ifndef glm_core_type_gentype4
|
||||
#define glm_core_type_gentype4
|
||||
|
||||
#include "../fwd.hpp"
|
||||
//#include "../fwd.hpp"
|
||||
#include "setup.hpp"
|
||||
#include "type_vec.hpp"
|
||||
#ifdef GLM_SWIZZLE
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
@ -38,6 +39,7 @@
|
||||
# include "_swizzle_func.hpp"
|
||||
# endif
|
||||
#endif //GLM_SWIZZLE
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -39,11 +39,6 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P> struct tref1;
|
||||
template <typename T, precision P> struct tref2;
|
||||
template <typename T, precision P> struct tref3;
|
||||
template <typename T, precision P> struct tref4;
|
||||
|
||||
template <typename T, precision P> struct tquat;
|
||||
}//namespace detail
|
||||
|
||||
|
19
glm/glm.hpp
19
glm/glm.hpp
@ -85,19 +85,13 @@
|
||||
#include <cfloat>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
//#include <cstdint>
|
||||
//#include <type_traits>
|
||||
|
||||
#include "fwd.hpp"
|
||||
#include "core/setup.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED))
|
||||
# define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED
|
||||
# pragma message("GLM: Core library included")
|
||||
#endif//GLM_MESSAGE
|
||||
|
||||
#include "./core/_vectorize.hpp"
|
||||
|
||||
/*
|
||||
#include "./core/type_half.hpp"
|
||||
#include "./core/type_float.hpp"
|
||||
#include "./core/type_int.hpp"
|
||||
@ -118,7 +112,7 @@
|
||||
#include "./core/type_mat4x2.hpp"
|
||||
#include "./core/type_mat4x3.hpp"
|
||||
#include "./core/type_mat4x4.hpp"
|
||||
|
||||
*/
|
||||
#include "./core/func_trigonometric.hpp"
|
||||
#include "./core/func_exponential.hpp"
|
||||
#include "./core/func_common.hpp"
|
||||
@ -129,13 +123,4 @@
|
||||
#include "./core/func_integer.hpp"
|
||||
#include "./core/func_noise.hpp"
|
||||
|
||||
#include "./core/_swizzle.hpp"
|
||||
|
||||
////////////////////
|
||||
// check type sizes
|
||||
#ifndef GLM_STATIC_ASSERT_NULL
|
||||
GLM_STATIC_ASSERT(sizeof(glm::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
|
||||
|
@ -32,7 +32,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -58,10 +58,29 @@
|
||||
|
||||
// Warning silencer for nameless struct/union.
|
||||
#if (GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||
#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 detail
|
||||
|
@ -59,6 +59,11 @@ GLM 0.9.5.0: 2013-XX-XX
|
||||
- Optimized packing and unpacking functions
|
||||
- Removed the normalization of the up argument of lookAt function (#114)
|
||||
- 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
|
||||
|
@ -7,66 +7,66 @@
|
||||
// File : test/core/func_matrix.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/func_matrix.hpp>
|
||||
|
||||
int test_matrixCompMult()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
{
|
||||
glm::mat2 m(0, 1, 2, 3);
|
||||
glm::mat2 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat2(0, 1, 4, 9) ? 0 : 1;
|
||||
}
|
||||
int Error(0);
|
||||
|
||||
{
|
||||
glm::mat2 m(0, 1, 2, 3);
|
||||
glm::mat2 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat2(0, 1, 4, 9) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat2x3 m(0, 1, 2, 3, 4, 5);
|
||||
glm::mat2x3 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat2x3(0, 1, 4, 9, 16, 25) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
glm::mat2x4 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat2x4(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
glm::mat3 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat3(0, 1, 4, 9, 16, 25, 36, 49, 64) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat3x2 m(0, 1, 2, 3, 4, 5);
|
||||
glm::mat3x2 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat3x2(0, 1, 4, 9, 16, 25) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||
glm::mat3x4 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
glm::mat4 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
glm::mat4x2 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat4x2(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||
glm::mat4x3 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat2x3 m(0, 1, 2, 3, 4, 5);
|
||||
glm::mat2x3 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat2x3(0, 1, 4, 9, 16, 25) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
glm::mat2x4 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat2x4(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
glm::mat3 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat3(0, 1, 4, 9, 16, 25, 36, 49, 64) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat3x2 m(0, 1, 2, 3, 4, 5);
|
||||
glm::mat3x2 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat3x2(0, 1, 4, 9, 16, 25) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||
glm::mat3x4 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||
glm::mat4 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
glm::mat4x2 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat4x2(0, 1, 4, 9, 16, 25, 36, 49) ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
glm::mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||
glm::mat4x3 n = glm::matrixCompMult(m, m);
|
||||
Error += n == glm::mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat2x2.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat2x2.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
|
||||
int test_operators()
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat2x3.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat2x3.hpp>
|
||||
|
||||
static int test_operators()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat2x4.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat2x4.hpp>
|
||||
|
||||
static int test_operators()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat3x2.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat3x2.hpp>
|
||||
|
||||
static bool test_operators()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat3x3.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat3x3.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat3x4.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat3x4.hpp>
|
||||
|
||||
static bool test_operators()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat4x2.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat4x2.hpp>
|
||||
|
||||
static int test_operators()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
// File : test/core/type_mat4x3.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat4x3.hpp>
|
||||
|
||||
static int test_operators()
|
||||
{
|
||||
|
@ -7,8 +7,7 @@
|
||||
// File : test/core/type_mat4x4.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#define GLM_PRECISION_HIGHP_FLOAT
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/core/type_mat4x4.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
// 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()
|
||||
{
|
||||
|
@ -8,7 +8,11 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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 <vector>
|
||||
|
||||
|
@ -7,7 +7,10 @@
|
||||
// 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>
|
||||
|
||||
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
|
||||
{
|
||||
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>
|
||||
class texture2D
|
||||
{
|
||||
@ -45,7 +61,7 @@ namespace gli
|
||||
void resize(level_type const & Levels);
|
||||
|
||||
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:
|
||||
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>
|
||||
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)
|
||||
{
|
||||
|
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.
|
||||
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)
|
||||
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;
|
||||
}
|
||||
@ -124,9 +124,9 @@ namespace loader_tga
|
||||
unsigned char Descriptor = 0;
|
||||
|
||||
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)
|
||||
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*)&ColorMapType, sizeof(ColorMapType));
|
||||
|
Loading…
Reference in New Issue
Block a user