Removed value_type and size_type

This commit is contained in:
Christophe Riccio 2013-09-08 02:30:16 +02:00
parent d3f0262a27
commit 0ff1026dbb
42 changed files with 412 additions and 462 deletions

View File

@ -346,8 +346,8 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec3<T, P> clamp
(
detail::tvec3<T, P> const & x,
typename detail::tvec3<T, P>::T const & minVal,
typename detail::tvec3<T, P>::T const & maxVal
T const & minVal,
T const & maxVal
)
{
return detail::tvec3<T, P>(
@ -360,8 +360,8 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec4<T, P> clamp
(
detail::tvec4<T, P> const & x,
typename detail::tvec4<T, P>::T const & minVal,
typename detail::tvec4<T, P>::T const & maxVal
T const & minVal,
T const & maxVal
)
{
return detail::tvec4<T, P>(
@ -585,14 +585,9 @@ namespace detail
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
detail::tvec2<T, P> result;
for
(
typename detail::tvec2<T, P>::size_type i = 0;
i < x.length(); ++i
)
{
for(int i = 0; i < x.length(); ++i)
result[i] = a[i] ? y[i] : x[i];
}
return result;
}
@ -607,14 +602,9 @@ namespace detail
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
detail::tvec3<T, P> result;
for
(
typename detail::tvec3<T, P>::size_type i = 0;
i < x.length(); ++i
)
{
for(int i = 0; i < x.length(); ++i)
result[i] = a[i] ? y[i] : x[i];
}
return result;
}
@ -629,14 +619,9 @@ namespace detail
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
detail::tvec4<T, P> result;
for
(
typename detail::tvec4<T, P>::size_type i = 0;
i < x.length(); ++i
)
{
for(int i = 0; i < x.length(); ++i)
result[i] = a[i] ? y[i] : x[i];
}
return result;
}

View File

@ -46,7 +46,7 @@ namespace glm
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
typename detail::tvec2<T, P>::value_type sqr = v.x * v.x + v.y * v.y;
T sqr = v.x * v.x + v.y * v.y;
return sqrt(sqr);
}
@ -55,7 +55,7 @@ namespace glm
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
typename detail::tvec3<T, P>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z;
T sqr = v.x * v.x + v.y * v.y + v.z * v.z;
return sqrt(sqr);
}
@ -64,7 +64,7 @@ namespace glm
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'length' only accept floating-point inputs");
typename detail::tvec4<T, P>::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
T sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
return sqrt(sqr);
}
@ -82,7 +82,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::value_type distance
GLM_FUNC_QUALIFIER T distance
(
detail::tvec2<T, P> const & p0,
detail::tvec2<T, P> const & p1
@ -94,7 +94,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::value_type distance
GLM_FUNC_QUALIFIER T distance
(
detail::tvec3<T, P> const & p0,
detail::tvec3<T, P> const & p1
@ -106,7 +106,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::value_type distance
GLM_FUNC_QUALIFIER T distance
(
detail::tvec4<T, P> const & p0,
detail::tvec4<T, P> const & p1
@ -131,7 +131,7 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::value_type dot
GLM_FUNC_QUALIFIER T dot
(
detail::tvec2<T, P> const & x,
detail::tvec2<T, P> const & y
@ -219,7 +219,7 @@ namespace glm
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
typename detail::tvec2<T, P>::value_type sqr = x.x * x.x + x.y * x.y;
T sqr = x.x * x.x + x.y * x.y;
return x * inversesqrt(sqr);
}
@ -231,7 +231,7 @@ namespace glm
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
typename detail::tvec3<T, P>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
T sqr = x.x * x.x + x.y * x.y + x.z * x.z;
return x * inversesqrt(sqr);
}
@ -243,7 +243,7 @@ namespace glm
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'normalize' only accept floating-point inputs");
typename detail::tvec4<T, P>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
T sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
return x * inversesqrt(sqr);
}
@ -279,8 +279,7 @@ namespace glm
genType const & eta
)
{
//It could be a vector
//GLM_STATIC_ASSERT(detail::type<genType>::is_float);
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'refract' only accept floating-point inputs");
genType dotValue = dot(N, I);
genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue);
@ -290,21 +289,20 @@ namespace glm
return eta * I - (eta * dotValue + sqrt(k)) * N;
}
template <typename genType>
GLM_FUNC_QUALIFIER genType refract
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> refract
(
genType const & I,
genType const & N,
typename genType::T const & eta
vecType<T, P> const & I,
vecType<T, P> const & N,
T const & eta
)
{
//It could be a vector
//GLM_STATIC_ASSERT(detail::type<genType>::is_float);
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'refract' only accept floating-point inputs");
typename genType::value_type dotValue = dot(N, I);
typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue);
if(k < typename genType::value_type(0))
return genType(0);
T dotValue = dot(N, I);
T k = T(1) - eta * eta * (T(1) - dotValue * dotValue);
if(k < T(0))
return vecType<T, P>(0);
else
return eta * I - (eta * dotValue + sqrt(k)) * N;
}

View File

@ -97,7 +97,7 @@ namespace glm
uint8 u;
} A, B, C, D;
glm::vec4 Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f;
glm::vec4 Unpack = clamp(v,-1.0f, 1.0f) * 127.0f;
A.i = int8(round(Unpack.x));
B.i = int8(round(Unpack.y));
C.i = int8(round(Unpack.z));

View File

@ -42,7 +42,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
@ -62,7 +62,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i];
return Result;
}
@ -81,7 +81,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i];
return Result;
}
@ -100,7 +100,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i];
return Result;
}
@ -117,7 +117,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i];
return Result;
}
@ -134,7 +134,7 @@ namespace glm
assert(x.length() == y.length());
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i];
return Result;
}
@ -146,7 +146,7 @@ namespace glm
// "Invalid template instantiation of 'any', GLM boolean vector types required");
bool Result = false;
for(typename vecType<bool, P>::size_type i = 0; i < v.length(); ++i)
for(int i = 0; i < v.length(); ++i)
Result = Result || v[i];
return Result;
}
@ -158,7 +158,7 @@ namespace glm
// "Invalid template instantiation of 'all', GLM boolean vector types required");
bool Result = true;
for(typename vecType<bool, P>::size_type i = 0; i < v.length(); ++i)
for(int i = 0; i < v.length(); ++i)
Result = Result && v[i];
return Result;
}
@ -170,7 +170,7 @@ namespace glm
// "Invalid template instantiation of 'not_', GLM vector types required");
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
for(typename vecType<bool, P>::size_type i = 0; i < v.length(); ++i)
for(int i = 0; i < v.length(); ++i)
Result[i] = !v[i];
return Result;
}

View File

@ -151,11 +151,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
@ -166,11 +166,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator- (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator- (
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
@ -181,11 +181,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator* (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator* (
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>
@ -216,11 +216,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m);
template <typename T, precision P>

View File

@ -444,7 +444,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -455,7 +455,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
(
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -480,7 +480,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -491,7 +491,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
(
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -516,7 +516,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -527,7 +527,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
(
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m
)
{
@ -612,7 +612,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
(
tmat2x2<T, P> const & m,
typename tmat2x2<T, P>::T const & s
T const & s
)
{
return tmat2x2<T, P>(
@ -623,7 +623,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
(
typename tmat2x2<T, P>::T const & s,
T const & s,
tmat2x2<T, P> const & m
)
{

View File

@ -140,7 +140,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator+ (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
tmat2x3<T, P> operator+ (
@ -150,7 +150,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator- (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator- (
@ -160,11 +160,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator* (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator* (
typename tmat2x3<T, P>::T const & s,
T const & s,
tmat2x3<T, P> const & m);
template <typename T, precision P>
@ -195,11 +195,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator/ (
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator/ (
typename tmat2x3<T, P>::T const & s,
T const & s,
tmat2x3<T, P> const & m);
// Unary constant operators

View File

@ -421,7 +421,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -445,7 +445,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -469,7 +469,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -480,7 +480,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
(
typename tmat2x3<T, P>::T const & s,
T const & s,
tmat2x3<T, P> const & m
)
{
@ -588,7 +588,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/
(
tmat2x3<T, P> const & m,
typename tmat2x3<T, P>::T const & s
T const & s
)
{
return tmat2x3<T, P>(
@ -599,7 +599,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/
(
typename tmat2x3<T, P>::T const & s,
T const & s,
tmat2x3<T, P> const & m
)
{

View File

@ -142,7 +142,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator+ (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator+ (
@ -152,7 +152,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator- (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator- (
@ -162,11 +162,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator* (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator* (
typename tmat2x4<T, P>::T const & s,
T const & s,
tmat2x4<T, P> const & m);
template <typename T, precision P>
@ -197,11 +197,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/ (
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/ (
typename tmat2x4<T, P>::T const & s,
T const & s,
tmat2x4<T, P> const & m);
// Unary constant operators

View File

@ -424,7 +424,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -448,7 +448,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -472,7 +472,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -483,7 +483,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
(
typename tmat2x4<T, P>::T const & s,
T const & s,
tmat2x4<T, P> const & m
)
{
@ -607,7 +607,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/
(
tmat2x4<T, P> const & m,
typename tmat2x4<T, P>::T const & s
T const & s
)
{
return tmat2x4<T, P>(
@ -618,7 +618,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/
(
typename tmat2x4<T, P>::T const & s,
T const & s,
tmat2x4<T, P> const & m
)
{

View File

@ -145,7 +145,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator+ (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator+ (
@ -155,7 +155,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator- (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator- (
@ -165,11 +165,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator* (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator* (
typename tmat3x2<T, P>::T const & s,
T const & s,
tmat3x2<T, P> const & m);
template <typename T, precision P>
@ -200,11 +200,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator/ (
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator/ (
typename tmat3x2<T, P>::T const & s,
T const & s,
tmat3x2<T, P> const & m);
// Unary constant operators

View File

@ -454,7 +454,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -480,7 +480,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -506,7 +506,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -518,7 +518,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
(
typename tmat3x2<T, P>::T const & s,
T const & s,
tmat3x2<T, P> const & m
)
{
@ -618,7 +618,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/
(
tmat3x2<T, P> const & m,
typename tmat3x2<T, P>::T const & s
T const & s
)
{
return tmat3x2<T, P>(
@ -630,7 +630,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/
(
typename tmat3x2<T, P>::T const & s,
T const & s,
tmat3x2<T, P> const & m
)
{

View File

@ -153,11 +153,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator+ (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator+ (
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
@ -168,11 +168,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator- (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator- (
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
@ -183,11 +183,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator* (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator* (
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>
@ -218,11 +218,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator/ (
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator/ (
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m);
template <typename T, precision P>

View File

@ -512,7 +512,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -524,7 +524,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
(
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -551,7 +551,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -563,7 +563,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
(
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -590,7 +590,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -602,7 +602,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
(
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m
)
{
@ -720,7 +720,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
(
tmat3x3<T, P> const & m,
typename tmat3x3<T, P>::T const & s
T const & s
)
{
return tmat3x3<T, P>(
@ -732,7 +732,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
(
typename tmat3x3<T, P>::T const & s,
T const & s,
tmat3x3<T, P> const & m
)
{

View File

@ -145,7 +145,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator+ (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator+ (
@ -155,7 +155,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator- (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator- (
@ -165,11 +165,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator* (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator* (
typename tmat3x4<T, P>::T const & s,
T const & s,
tmat3x4<T, P> const & m);
template <typename T, precision P>
@ -200,11 +200,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator/ (
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator/ (
typename tmat3x4<T, P>::T const & s,
T const & s,
tmat3x4<T, P> const & m);
// Unary constant operators

View File

@ -453,7 +453,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -479,7 +479,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -505,7 +505,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -517,7 +517,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
(
typename tmat3x4<T, P>::T const & s,
T const & s,
tmat3x4<T, P> const & m
)
{
@ -651,7 +651,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/
(
tmat3x4<T, P> const & m,
typename tmat3x4<T, P>::T const & s
T const & s
)
{
return tmat3x4<T, P>(
@ -663,7 +663,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/
(
typename tmat3x4<T, P>::T const & s,
T const & s,
tmat3x4<T, P> const & m
)
{

View File

@ -150,7 +150,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator+ (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator+ (
@ -160,7 +160,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator- (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator- (
@ -170,11 +170,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator* (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator* (
typename tmat4x2<T, P>::T const & s,
T const & s,
tmat4x2<T, P> const & m);
template <typename T, precision P>
@ -205,11 +205,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator/ (
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator/ (
typename tmat4x2<T, P>::T const & s,
T const & s,
tmat4x2<T, P> const & m);
// Unary constant operators

View File

@ -483,7 +483,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -511,7 +511,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -539,7 +539,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -552,7 +552,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
(
typename tmat4x2<T, P>::T const & s,
T const & s,
tmat4x2<T, P> const & m
)
{
@ -660,7 +660,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/
(
tmat4x2<T, P> const & m,
typename tmat4x2<T, P>::T const & s
T const & s
)
{
return tmat4x2<T, P>(
@ -673,7 +673,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/
(
typename tmat4x2<T, P>::T const & s,
T const & s,
tmat4x2<T, P> const & m
)
{

View File

@ -150,7 +150,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator+ (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator+ (
@ -160,7 +160,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator- (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator- (
@ -170,11 +170,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator* (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator* (
typename tmat4x3<T, P>::T const & s,
T const & s,
tmat4x3<T, P> const & m);
template <typename T, precision P>
@ -205,11 +205,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator/ (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x3<T, P> operator/ (
typename tmat4x3<T, P>::T const & s,
T const & s,
tmat4x3<T, P> const & m);
// Unary constant operators

View File

@ -466,7 +466,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+ (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s)
T const & s)
{
return tmat4x3<T, P>(
m[0] + s,
@ -490,7 +490,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator- (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s)
T const & s)
{
return tmat4x3<T, P>(
m[0] - s,
@ -514,7 +514,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator* (
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s)
T const & s)
{
return tmat4x3<T, P>(
m[0] * s,
@ -525,7 +525,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator* (
typename tmat4x3<T, P>::T const & s,
T const & s,
tmat4x3<T, P> const & m)
{
return tmat4x3<T, P>(
@ -648,7 +648,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/
(
tmat4x3<T, P> const & m,
typename tmat4x3<T, P>::T const & s
T const & s
)
{
return tmat4x3<T, P>(
@ -661,7 +661,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/
(
typename tmat4x3<T, P>::T const & s,
T const & s,
tmat4x3<T, P> const & m
)
{

View File

@ -158,11 +158,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
@ -173,11 +173,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator- (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator- (
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
@ -188,11 +188,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator* (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator* (
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>
@ -223,11 +223,11 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s);
T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m);
template <typename T, precision P>

View File

@ -606,7 +606,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -619,7 +619,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
(
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -648,7 +648,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -661,7 +661,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
(
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -690,7 +690,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::value_type const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -703,7 +703,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
(
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m
)
{
@ -845,7 +845,7 @@ namespace detail
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
(
tmat4x4<T, P> const & m,
typename tmat4x4<T, P>::T const & s
T const & s
)
{
return tmat4x4<T, P>(
@ -858,7 +858,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
(
typename tmat4x4<T, P>::T const & s,
T const & s,
tmat4x4<T, P> const & m
)
{

View File

@ -41,8 +41,6 @@ namespace detail
{
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec1<T, P> type;
typedef tvec1<bool, P> bool_type;
@ -52,16 +50,16 @@ namespace detail
// Data
# if(GLM_COMPONENT == GLM_COMPONENT_ONLY_XYZW)
value_type x;
T x;
# else//(GLM_COMPONENT == GLM_COMPONENT_GLSL_NAMES)
union {value_type x, r, s;};
union {T x, r, s;};
# endif//GLM_COMPONENT
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](int i);
GLM_FUNC_DECL T const & operator[](int i) const;
//////////////////////////////////////
// Implicit basic constructors
@ -170,7 +168,7 @@ namespace detail
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL T swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;

View File

@ -39,22 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec1<T, P>::value_type & tvec1<T, P>::operator[]
(
size_type i
)
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](int i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec1<T, P>::T const & tvec1<T, P>::operator[]
(
size_type i
) const
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](int i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}

View File

@ -41,8 +41,6 @@ namespace detail
{
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec2<T, P> type;
typedef tvec2<bool, P> bool_type;
@ -54,9 +52,9 @@ namespace detail
# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE))
union
{
struct{ value_type x, y; };
struct{ value_type r, g; };
struct{ value_type s, t; };
struct{ T x, y; };
struct{ T r, g; };
struct{ T s, t; };
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
@ -69,20 +67,20 @@ namespace detail
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
};
# else
union {value_type x, r, s;};
union {value_type y, g, t;};
union {T x, r, s;};
union {T y, g, t;};
# if(defined(GLM_SWIZZLE))
//GLM_SWIZZLE_GEN_REF_FROM_VEC2(value_type, P, detail::tvec2, detail::tref2)
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(value_type, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
//GLM_SWIZZLE_GEN_REF_FROM_VEC2(T, P, detail::tvec2, detail::tref2)
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
# endif//(defined(GLM_SWIZZLE))
# endif//GLM_LANG
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](int i);
GLM_FUNC_DECL T const & operator[](int i) const;
//////////////////////////////////////
// Implicit basic constructors
@ -203,7 +201,7 @@ namespace detail
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL T swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;

View File

@ -39,16 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](size_type i)
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](int i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](size_type i) const
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](int i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -509,7 +509,7 @@ namespace detail
// Swizzle operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec2<T, P>::value_type tvec2<T, P>::swizzle
GLM_FUNC_QUALIFIER T tvec2<T, P>::swizzle
(
comp x
) const

View File

@ -41,8 +41,6 @@ namespace detail
{
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec3<T, P> type;
typedef tvec3<bool, P> bool_type;
@ -54,9 +52,9 @@ namespace detail
# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE))
union
{
struct{ value_type x, y, z; };
struct{ value_type r, g, b; };
struct{ value_type s, t, p; };
struct{ T x, y, z; };
struct{ T r, g, b; };
struct{ T s, t, p; };
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
@ -69,9 +67,9 @@ namespace detail
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
};
# else
union { value_type x, r, s; };
union { value_type y, g, t; };
union { value_type z, b, p; };
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
# if(defined(GLM_SWIZZLE))
//GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P, detail::tvec3, detail::tref2, detail::tref3)
@ -82,8 +80,8 @@ namespace detail
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](int i);
GLM_FUNC_DECL T const & operator[](int i) const;
//////////////////////////////////////
// Implicit basic constructors
@ -227,7 +225,7 @@ namespace detail
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL T swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;

View File

@ -39,16 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](size_type i)
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](int i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](size_type i) const
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](int i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -583,8 +583,7 @@ namespace detail
// Swizzle operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec3<T, P>::value_type
tvec3<T, P>::swizzle
GLM_FUNC_QUALIFIER T tvec3<T, P>::swizzle
(
comp x
) const

View File

@ -41,8 +41,6 @@ namespace detail
{
enum ctor{_null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec4<T, P> type;
typedef tvec4<bool, P> bool_type;
@ -54,9 +52,9 @@ namespace detail
# if((GLM_LANG & GLM_LANG_CXXMS_FLAG) && defined(GLM_SWIZZLE))
union
{
struct { value_type r, g, b, a; };
struct { value_type s, t, p, q; };
struct { value_type x, y, z, w;};
struct { T r, g, b, a; };
struct { T s, t, p, q; };
struct { T x, y, z, w;};
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
@ -69,10 +67,10 @@ namespace detail
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
};
# else
union { value_type x, r, s; };
union { value_type y, g, t; };
union { value_type z, b, p; };
union { value_type w, a, q; };
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
union { T w, a, q; };
# if(defined(GLM_SWIZZLE))
//GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P, detail::tvec4, detail::tref2, detail::tref3, detail::tref4)
@ -83,8 +81,8 @@ namespace detail
//////////////////////////////////////
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](int i);
GLM_FUNC_DECL T const & operator[](int i) const;
//////////////////////////////////////
// Implicit basic constructors
@ -282,7 +280,7 @@ namespace detail
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL T swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T, P> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T, P> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T, P> swizzle(comp X, comp Y, comp Z, comp W) const;
@ -310,37 +308,37 @@ namespace detail
GLM_DETAIL_IS_VECTOR(tvec4);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator+(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator-(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator- (tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator*(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator/(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -355,55 +353,55 @@ namespace detail
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator%(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator&(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator|(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator^(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator<<(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, typename tvec4<T, P>::T const & s);
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, T const & s);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(typename tvec4<T, P>::T const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator>>(T const & s, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2);

View File

@ -39,22 +39,16 @@ namespace detail
// Accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[]
(
size_type i
)
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](int i)
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[]
(
size_type i
) const
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](int i) const
{
assert(i < this->length());
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -730,21 +724,13 @@ namespace detail
// Swizzle operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tvec4<T, P>::value_type
tvec4<T, P>::swizzle
(
comp x
) const
GLM_FUNC_QUALIFIER T tvec4<T, P>::swizzle(comp x) const
{
return (*this)[x];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> tvec4<T, P>::swizzle
(
comp x,
comp y
) const
GLM_FUNC_QUALIFIER tvec2<T, P> tvec4<T, P>::swizzle(comp x, comp y) const
{
return tvec2<T, P>(
(*this)[x],
@ -752,12 +738,7 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> tvec4<T, P>::swizzle
(
comp x,
comp y,
comp z
) const
GLM_FUNC_QUALIFIER tvec3<T, P> tvec4<T, P>::swizzle(comp x, comp y, comp z) const
{
return tvec3<T, P>(
(*this)[x],
@ -766,13 +747,7 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> tvec4<T, P>::swizzle
(
comp x,
comp y,
comp z,
comp w
) const
GLM_FUNC_QUALIFIER tvec4<T, P> tvec4<T, P>::swizzle(comp x, comp y, comp z, comp w) const
{
return tvec4<T, P>(
(*this)[x],
@ -782,11 +757,7 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref2<T, P> tvec4<T, P>::swizzle
(
comp x,
comp y
)
GLM_FUNC_QUALIFIER tref2<T, P> tvec4<T, P>::swizzle(comp x, comp y)
{
return tref2<T, P>(
(*this)[x],
@ -794,12 +765,7 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref3<T, P> tvec4<T, P>::swizzle
(
comp x,
comp y,
comp z
)
GLM_FUNC_QUALIFIER tref3<T, P> tvec4<T, P>::swizzle(comp x, comp y, comp z)
{
return tref3<T, P>(
(*this)[x],
@ -808,13 +774,7 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tref4<T, P> tvec4<T, P>::swizzle
(
comp x,
comp y,
comp z,
comp w
)
GLM_FUNC_QUALIFIER tref4<T, P> tvec4<T, P>::swizzle(comp x, comp y, comp z, comp w)
{
return tref4<T, P>(
(*this)[x],
@ -830,7 +790,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator+
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -843,7 +803,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator+
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -873,7 +833,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator-
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -886,7 +846,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator-
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -916,7 +876,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator*
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -929,7 +889,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -959,7 +919,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator/
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -972,7 +932,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator/
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -1041,7 +1001,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator%
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -1054,7 +1014,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -1083,7 +1043,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator&
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -1096,7 +1056,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -1125,7 +1085,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator|
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -1138,7 +1098,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -1167,7 +1127,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator^
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -1180,7 +1140,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -1209,7 +1169,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -1222,7 +1182,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{
@ -1251,7 +1211,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>
(
tvec4<T, P> const & v,
typename tvec4<T, P>::T const & s
T const & s
)
{
return tvec4<T, P>(
@ -1264,7 +1224,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>
(
typename tvec4<T, P>::T const & s,
T const & s,
tvec4<T, P> const & v
)
{

View File

@ -32,14 +32,14 @@ namespace glm
GLM_FUNC_QUALIFIER genType row
(
genType const & m,
typename genType::size_type const & index,
int const & index,
typename genType::row_type const & x
)
{
assert(index < m.col_size());
assert(index >= 0 && index < m.col_size());
genType Result = m;
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
for(int i = 0; i < genType::row_size(); ++i)
Result[i][index] = x[i];
return Result;
}
@ -48,13 +48,13 @@ namespace glm
GLM_FUNC_QUALIFIER typename genType::row_type row
(
genType const & m,
typename genType::size_type const & index
int const & index
)
{
assert(index < m.col_size());
assert(index >= 0 && index < m.col_size());
typename genType::row_type Result;
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
for(int i = 0; i < genType::row_size(); ++i)
Result[i] = m[i][index];
return Result;
}
@ -63,11 +63,11 @@ namespace glm
GLM_FUNC_QUALIFIER genType column
(
genType const & m,
typename genType::size_type const & index,
int const & index,
typename genType::col_type const & x
)
{
assert(index < m.row_size());
assert(index >= 0 && index < m.row_size());
genType Result = m;
Result[index] = x;
@ -78,10 +78,10 @@ namespace glm
GLM_FUNC_QUALIFIER typename genType::col_type column
(
genType const & m,
typename genType::size_type const & index
int const & index
)
{
assert(index < m.row_size());
assert(index >= 0 && index < m.row_size());
return m[index];
}

View File

@ -52,18 +52,16 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
struct tquat// : public genType<T, tquat>
struct tquat
{
enum ctor{null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec4<bool, P> bool_type;
public:
value_type x, y, z, w;
T x, y, z, w;
GLM_FUNC_DECL size_type length() const;
GLM_FUNC_DECL int length() const;
// Constructors
tquat();
@ -90,8 +88,8 @@ namespace detail
tmat4x4<T, P> const & m);
// Accesses
GLM_FUNC_DECL value_type & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
GLM_FUNC_DECL T & operator[](int i);
GLM_FUNC_DECL T const & operator[](int i) const;
// Operators
GLM_FUNC_DECL tquat<T, P> & operator*=(T const & s);

View File

@ -32,7 +32,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tquat<T, P>::size_type tquat<T, P>::length() const
GLM_FUNC_QUALIFIER int tquat<T, P>::length() const
{
return 4;
}
@ -110,8 +110,8 @@ namespace detail
tvec3<T, P> const & eulerAngle
)
{
tvec3<T, P> c = glm::cos(eulerAngle * value_type(0.5));
tvec3<T, P> s = glm::sin(eulerAngle * value_type(0.5));
tvec3<T, P> c = glm::cos(eulerAngle * T(0.5));
tvec3<T, P> s = glm::sin(eulerAngle * T(0.5));
this->w = c.x * c.y * c.z + s.x * s.y * s.z;
this->x = s.x * c.y * c.z - c.x * s.y * s.z;
@ -141,14 +141,16 @@ namespace detail
// tquat<T, P> accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[] (size_type i)
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[] (int i)
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[] (size_type i) const
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[] (int i) const
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -229,7 +231,7 @@ namespace detail
detail::tvec3<T, P> const & v
)
{
typename detail::tquat<T, P>::value_type Two(2);
T Two(2);
detail::tvec3<T, P> uv, uuv;
detail::tvec3<T, P> QuatVector(q.x, q.y, q.z);
@ -344,10 +346,10 @@ namespace detail
detail::tquat<T, P> const & q
)
{
typename detail::tquat<T, P>::value_type len = length(q);
if(len <= typename detail::tquat<T, P>::value_type(0)) // Problem
T len = length(q);
if(len <= T(0)) // Problem
return detail::tquat<T, P>(1, 0, 0, 0);
typename detail::tquat<T, P>::value_type oneOverLen = typename detail::tquat<T, P>::value_type(1) / len;
T oneOverLen = T(1) / len;
return detail::tquat<T, P>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
}
@ -384,12 +386,12 @@ namespace detail
typename detail::tquat<T, P>::T const & a
)
{
if(a <= typename detail::tquat<T, P>::value_type(0)) return x;
if(a >= typename detail::tquat<T, P>::value_type(1)) return y;
if(a <= T(0)) return x;
if(a >= T(1)) return y;
float fCos = dot(x, y);
detail::tquat<T, P> y2(y); //BUG!!! tquat<T, P> y2;
if(fCos < typename detail::tquat<T, P>::value_type(0))
if(fCos < T(0))
{
y2 = -y;
fCos = -fCos;
@ -397,18 +399,18 @@ namespace detail
//if(fCos > 1.0f) // problem
float k0, k1;
if(fCos > typename detail::tquat<T, P>::value_type(0.9999))
if(fCos > T(0.9999))
{
k0 = typename detail::tquat<T, P>::value_type(1) - a;
k1 = typename detail::tquat<T, P>::value_type(0) + a; //BUG!!! 1.0f + a;
k0 = T(1) - a;
k1 = T(0) + a; //BUG!!! 1.0f + a;
}
else
{
typename detail::tquat<T, P>::value_type fSin = sqrt(T(1) - fCos * fCos);
typename detail::tquat<T, P>::value_type fAngle = atan(fSin, fCos);
typename detail::tquat<T, P>::value_type fOneOverSin = static_cast<T>(1) / fSin;
k0 = sin((typename detail::tquat<T, P>::value_type(1) - a) * fAngle) * fOneOverSin;
k1 = sin((typename detail::tquat<T, P>::value_type(0) + a) * fAngle) * fOneOverSin;
T fSin = sqrt(T(1) - fCos * fCos);
T fAngle = atan(fSin, fCos);
T fOneOverSin = static_cast<T>(1) / fSin;
k0 = sin((T(1) - a) * fAngle) * fOneOverSin;
k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
}
return detail::tquat<T, P>(
@ -566,7 +568,7 @@ namespace detail
detail::tvec3<T, P> Tmp = v;
// Axis of rotation must be normalised
typename detail::tquat<T, P>::value_type len = glm::length(Tmp);
T len = glm::length(Tmp);
if(abs(len - T(1)) > T(0.001))
{
T oneOverLen = static_cast<T>(1) / len;
@ -576,11 +578,11 @@ namespace detail
}
#ifdef GLM_FORCE_RADIANS
typename detail::tquat<T, P>::value_type const AngleRad(angle);
T const AngleRad(angle);
#else
typename detail::tquat<T, P>::value_type const AngleRad = radians(angle);
T const AngleRad = radians(angle);
#endif
typename detail::tquat<T, P>::value_type const Sin = sin(AngleRad * T(0.5));
T const Sin = sin(AngleRad * T(0.5));
return q * detail::tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
//return gtc::quaternion::cross(q, detail::tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
@ -670,13 +672,13 @@ namespace detail
detail::tmat3x3<T, P> const & m
)
{
typename detail::tquat<T, P>::value_type fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
typename detail::tquat<T, P>::value_type fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
typename detail::tquat<T, P>::value_type fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1];
typename detail::tquat<T, P>::value_type fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2];
T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
T fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
T fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1];
T fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2];
int biggestIndex = 0;
typename detail::tquat<T, P>::value_type fourBiggestSquaredMinus1 = fourWSquaredMinus1;
T fourBiggestSquaredMinus1 = fourWSquaredMinus1;
if(fourXSquaredMinus1 > fourBiggestSquaredMinus1)
{
fourBiggestSquaredMinus1 = fourXSquaredMinus1;
@ -693,8 +695,8 @@ namespace detail
biggestIndex = 3;
}
typename detail::tquat<T, P>::value_type biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5);
typename detail::tquat<T, P>::value_type mult = static_cast<T>(0.25) / biggestVal;
T biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5);
T mult = static_cast<T>(0.25) / biggestVal;
detail::tquat<T, P> Result;
switch(biggestIndex)
@ -797,7 +799,7 @@ namespace detail
)
{
typename detail::tquat<T, P>::bool_type Result;
for(typename detail::tquat<T, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
@ -811,7 +813,7 @@ namespace detail
)
{
typename detail::tquat<T, P>::bool_type Result;
for(typename detail::tquat<T, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i];
return Result;
}
@ -824,7 +826,7 @@ namespace detail
)
{
typename detail::tquat<T, P>::bool_type Result;
for(typename detail::tquat<T, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i];
return Result;
}
@ -837,7 +839,7 @@ namespace detail
)
{
typename detail::tquat<T, P>::bool_type Result;
for(typename detail::tquat<T, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i];
return Result;
}
@ -850,7 +852,7 @@ namespace detail
)
{
typename detail::tquat<T, P>::bool_type Result;
for(typename detail::tquat<T, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i];
return Result;
}
@ -863,7 +865,7 @@ namespace detail
)
{
typename detail::tquat<T, P>::bool_type Result;
for(typename detail::tquat<T, P>::size_type i = 0; i < x.length(); ++i)
for(int i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i];
return Result;
}

View File

@ -9,38 +9,38 @@
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compAdd(vecType<T, P> const & v)
{
typename genType::value_type result = typename genType::value_type(0);
for(typename genType::size_type i = 0; i < v.length(); ++i)
T result(0);
for(int i = 0; i < v.length(); ++i)
result += v[i];
return result;
}
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v)
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMul(vecType<T, P> const & v)
{
typename genType::value_type result = typename genType::value_type(1);
for(typename genType::size_type i = 0; i < v.length(); ++i)
T result(1);
for(int i = 0; i < v.length(); ++i)
result *= v[i];
return result;
}
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v)
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMin(vecType<T, P> const & v)
{
typename genType::value_type result = typename genType::value_type(v[0]);
for(typename genType::size_type i = 1; i < v.length(); ++i)
T result(v[0]);
for(int i = 1; i < v.length(); ++i)
result = min(result, v[i]);
return result;
}
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v)
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMax(vecType<T, P> const & v)
{
typename genType::value_type result = typename genType::value_type(v[0]);
for(typename genType::size_type i = 1; i < v.length(); ++i)
T result(v[0]);
for(int i = 1; i < v.length(); ++i)
result = max(result, v[i]);
return result;
}

View File

@ -54,18 +54,16 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
struct tdualquat// : public genType<T, tquat>
struct tdualquat
{
enum ctor{null};
typedef T value_type;
typedef glm::detail::tquat<T, P> part_type;
typedef std::size_t size_type;
public:
glm::detail::tquat<T, P> real, dual;
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
// Constructors
tdualquat();
@ -124,17 +122,17 @@ namespace detail
template <typename T, precision P>
detail::tdualquat<T, P> operator* (
detail::tdualquat<T, P> const & q,
typename detail::tdualquat<T, P>::T const & s);
T const & s);
template <typename T, precision P>
detail::tdualquat<T, P> operator* (
typename detail::tdualquat<T, P>::T const & s,
T const & s,
detail::tdualquat<T, P> const & q);
template <typename T, precision P>
detail::tdualquat<T, P> operator/ (
detail::tdualquat<T, P> const & q,
typename detail::tdualquat<T, P>::T const & s);
T const & s);
} //namespace detail
/// @addtogroup gtc_dual_quaternion
@ -154,7 +152,7 @@ namespace detail
detail::tdualquat<T, P> lerp(
detail::tdualquat<T, P> const & x,
detail::tdualquat<T, P> const & y,
typename detail::tdualquat<T, P>::T const & a);
T const & a);
/// Returns the q inverse.
///

View File

@ -32,7 +32,7 @@ namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat<T, P>::size_type tdualquat<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tdualquat<T, P>::length() const
{
return 8;
}
@ -102,12 +102,14 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator [] (int i)
{
assert(i >= 0 && i < this->length());
return (&real)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type const & tdualquat<T, P>::operator [] (int i) const
{
assert(i >= 0 && i < this->length());
return (&real)[i];
}
@ -215,7 +217,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tdualquat<T, P> operator*
(
detail::tdualquat<T, P> const & q,
typename detail::tdualquat<T, P>::T const & s
T const & s
)
{
return detail::tdualquat<T, P>(q.real * s, q.dual * s);
@ -224,7 +226,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tdualquat<T, P> operator*
(
typename detail::tdualquat<T, P>::T const & s,
T const & s,
detail::tdualquat<T, P> const & q
)
{
@ -235,7 +237,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tdualquat<T, P> operator/
(
detail::tdualquat<T, P> const & q,
typename detail::tdualquat<T, P>::T const & s
T const & s
)
{
return detail::tdualquat<T, P>(q.real / s, q.dual / s);
@ -279,7 +281,7 @@ namespace detail
(
detail::tdualquat<T, P> const & x,
detail::tdualquat<T, P> const & y,
typename detail::tdualquat<T, P>::T const & a
T const & a
)
{
// Dual Quaternion Linear blend aka DLB:

View File

@ -50,21 +50,21 @@ namespace glm
return result;
}
template<typename genType>
template<typename T, precision P, template <typename, precision> class matType>
GLM_FUNC_QUALIFIER bool isIdentity
(
genType const & m,
typename genType::T const & epsilon
matType<T, P> const & m,
T const & epsilon
)
{
bool result = true;
for(typename genType::size_type i = typename genType::size_type(0); result && i < genType::col_size(); ++i)
for(int i(0); result && i < matType<T, P>::col_size(); ++i)
{
for(typename genType::size_type j = typename genType::size_type(0); result && j < i ; ++j)
for(int j(0); result && j < i ; ++j)
result = abs(m[i][j]) <= epsilon;
if(result)
result = abs(m[i][i] - typename genType::value_type(1)) <= epsilon;
for(typename genType::size_type j = i + typename genType::size_type(1); result && j < genType::row_size(); ++j)
result = abs(m[i][i] - 1) <= epsilon;
for(int j(i + 1); result && j < matType<T, P>::row_size(); ++j)
result = abs(m[i][j]) <= epsilon;
}
return result;
@ -78,12 +78,12 @@ namespace glm
)
{
bool result(true);
for(typename detail::tmat2x2<T, P>::size_type i(0); result && i < m.length(); ++i)
for(int i(0); result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon);
for(typename detail::tmat2x2<T, P>::size_type i(0); result && i < m.length(); ++i)
for(int i(0); result && i < m.length(); ++i)
{
typename detail::tmat2x2<T, P>::col_type v;
for(typename detail::tmat2x2<T, P>::size_type j(0); j < m.length(); ++j)
for(int j(0); j < m.length(); ++j)
v[j] = m[j][i];
result = isNormalized(v, epsilon);
}
@ -98,12 +98,12 @@ namespace glm
)
{
bool result(true);
for(typename detail::tmat3x3<T, P>::size_type i(0); result && i < m.length(); ++i)
for(int i(0); result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon);
for(typename detail::tmat3x3<T, P>::size_type i(0); result && i < m.length(); ++i)
for(int i(0); result && i < m.length(); ++i)
{
typename detail::tmat3x3<T, P>::col_type v;
for(typename detail::tmat3x3<T, P>::size_type j(0); j < m.length(); ++j)
for(int j(0); j < m.length(); ++j)
v[j] = m[j][i];
result = isNormalized(v, epsilon);
}
@ -118,12 +118,12 @@ namespace glm
)
{
bool result(true);
for(typename detail::tmat4x4<T, P>::size_type i(0); result && i < m.length(); ++i)
for(int i(0); result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon);
for(typename detail::tmat4x4<T, P>::size_type i(0); result && i < m.length(); ++i)
for(int i(0); result && i < m.length(); ++i)
{
typename detail::tmat4x4<T, P>::col_type v;
for(typename detail::tmat4x4<T, P>::size_type j(0); j < m.length(); ++j)
for(int j(0); j < m.length(); ++j)
v[j] = m[j][i];
result = isNormalized(v, epsilon);
}
@ -138,15 +138,15 @@ namespace glm
)
{
bool result(true);
for(typename matType<T, P>::size_type i(0); result && i < m.length() - 1; ++i)
for(typename matType<T, P>::size_type j(i + 1); result && j < m.length(); ++j)
for(int i(0); result && i < m.length() - 1; ++i)
for(int j(i + 1); result && j < m.length(); ++j)
result = areOrthogonal(m[i], m[j], epsilon);
if(result)
{
matType<T, P> tmp = transpose(m);
for(typename matType<T, P>::size_type i(0); result && i < m.length() - 1 ; ++i)
for(typename matType<T, P>::size_type j(i + 1); result && j < m.length(); ++j)
for(int i(0); result && i < m.length() - 1 ; ++i)
for(int j(i + 1); result && j < m.length(); ++j)
result = areOrthogonal(tmp[i], tmp[j], epsilon);
}
return result;

View File

@ -170,8 +170,8 @@ namespace glm
T const & a
)
{
if(a <= typename detail::tquat<T, P>::value_type(0)) return x;
if(a >= typename detail::tquat<T, P>::value_type(1)) return y;
if(a <= T(0)) return x;
if(a >= T(1)) return y;
T fCos = dot(x, y);
detail::tquat<T, P> y2(y); //BUG!!! tquat<T> y2;

View File

@ -80,11 +80,11 @@ namespace glm
detail::tvec3<T, P> Tmp = v;
#ifdef GLM_FORCE_RADIANS
typename detail::tquat<T, P>::value_type const AngleRad(angle);
T const AngleRad(angle);
#else
typename detail::tquat<T, P>::value_type const AngleRad = radians(angle);
T const AngleRad = radians(angle);
#endif
typename detail::tquat<T, P>::value_type const Sin = sin(AngleRad * T(0.5));
T const Sin = sin(AngleRad * T(0.5));
return q * detail::tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
//return gtc::quaternion::cross(q, detail::tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));

View File

@ -9,13 +9,31 @@
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type angle
template <typename T>
GLM_FUNC_QUALIFIER T angle
(
genType const & x,
genType const & y
T const & x,
T const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'angle' only accept floating-point inputs");
#ifdef GLM_FORCE_RADIANS
return acos(dot(x, y));
#else
return degrees(acos(dot(x, y)));
#endif
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T angle
(
vecType<T, P> const & x,
vecType<T, P> const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'angle' only accept floating-point inputs");
#ifdef GLM_FORCE_RADIANS
return acos(dot(x, y));
#else
@ -31,6 +49,8 @@ namespace glm
detail::tvec2<T, P> const & y
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'orientedAngle' only accept floating-point inputs");
#ifdef GLM_FORCE_RADIANS
T const Angle(acos(dot(x, y)));
#else
@ -51,6 +71,8 @@ namespace glm
detail::tvec3<T, P> const & ref
)
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'orientedAngle' only accept floating-point inputs");
#ifdef GLM_FORCE_RADIANS
T const Angle(acos(dot(x, y)));
#else

View File

@ -19,7 +19,7 @@ namespace glm
(
detail::tvec2<T, P> const & v0,
detail::tvec2<T, P> const & v1,
typename detail::tvec2<T, P>::T const & epsilon
T const & epsilon
)
{
return length(cross(detail::tvec3<T, P>(v0, T(0)), detail::tvec3<T, P>(v1, T(0)))) < epsilon;
@ -30,7 +30,7 @@ namespace glm
(
detail::tvec3<T, P> const & v0,
detail::tvec3<T, P> const & v1,
typename detail::tvec3<T, P>::T const & epsilon
T const & epsilon
)
{
return length(cross(v0, v1)) < epsilon;
@ -41,35 +41,35 @@ namespace glm
(
detail::tvec4<T, P> const & v0,
detail::tvec4<T, P> const & v1,
typename detail::tvec4<T, P>::T const & epsilon
T const & epsilon
)
{
return length(cross(detail::tvec3<T, P>(v0), detail::tvec3<T, P>(v1))) < epsilon;
}
template <typename genType>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool areOrthogonal
(
genType const & v0,
genType const & v1,
typename genType::T const & epsilon
vecType<T, P> const & v0,
vecType<T, P> const & v1,
T const & epsilon
)
{
return abs(dot(v0, v1)) <= max(
typename genType::value_type(1),
T(1),
length(v0)) * max(
typename genType::value_type(1),
T(1),
length(v1)) * epsilon;
}
template <typename genType, precision P, template <typename, precision> class vecType>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool isNormalized
(
vecType<genType, P> const & v,
genType const & epsilon
vecType<T, P> const & v,
T const & epsilon
)
{
return abs(length(v) - genType(1)) <= genType(2) * epsilon;
return abs(length(v) - T(1)) <= T(2) * epsilon;
}
template <typename T, precision P>
@ -150,12 +150,12 @@ namespace glm
abs(v.w) < epsilon);
}
template <typename genType>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER bool areOrthonormal
(
genType const & v0,
genType const & v1,
typename genType::T const & epsilon
vecType<T, P> const & v0,
vecType<T, P> const & v1,
T const & epsilon
)
{
return isNormalized(v0, epsilon) && isNormalized(v1, epsilon) && (abs(dot(v0, v1)) <= epsilon);

View File

@ -75,7 +75,7 @@ namespace gli
for(gli::texture2D::size_type t = 0; t < TexelCount; ++t)
for(gli::texture2D::size_type c = 0; c < Mipmap.components(); ++c)
{
gli::texture2D::size_type IndexSrc = t * Mipmap.components() + Channel[glm::uvec4::size_type(c)];
gli::texture2D::size_type IndexSrc = t * Mipmap.components() + Channel[static_cast<int>(c)];
gli::texture2D::size_type IndexDst = t * Mipmap.components() + c;
memcpy(DataDst + IndexDst, DataSrc + IndexSrc, CompSize);