Finishing up removing GLM_FORCE_SIZE_FUNC define and passing by copy scalars

This commit is contained in:
Christophe Riccio 2016-03-23 02:01:16 +05:30
parent fffce8727f
commit 66b714c418
33 changed files with 621 additions and 895 deletions

View File

@ -87,7 +87,7 @@ namespace detail
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = a[i] ? y[i] : x[i];
return Result;
}

View File

@ -270,7 +270,7 @@ namespace detail
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
matType<T, P> result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(result); ++i)
for(length_t i = 0; i < result.length(); ++i)
result[i] = x[i] * y[i];
return result;
}
@ -281,7 +281,7 @@ namespace detail
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
for(length_t i = 0; i < m.length(); ++i)
m[i] = c * r[i];
return m;
}

View File

@ -37,10 +37,10 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y)
{
assert(detail::component_count(x) == detail::component_count(y));
assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
@ -49,10 +49,10 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
{
assert(detail::component_count(x) == detail::component_count(y));
assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i];
return Result;
}
@ -60,10 +60,10 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y)
{
assert(detail::component_count(x) == detail::component_count(y));
assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i];
return Result;
}
@ -71,10 +71,10 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
{
assert(detail::component_count(x) == detail::component_count(y));
assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i];
return Result;
}
@ -82,10 +82,10 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y)
{
assert(detail::component_count(x) == detail::component_count(y));
assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i];
return Result;
}
@ -93,10 +93,10 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y)
{
assert(detail::component_count(x) == detail::component_count(y));
assert(x.length() == y.length());
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i];
return Result;
}
@ -105,7 +105,7 @@ namespace glm
GLM_FUNC_QUALIFIER bool any(vecType<bool, P> const & v)
{
bool Result = false;
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
for(length_t i = 0; i < v.length(); ++i)
Result = Result || v[i];
return Result;
}
@ -114,7 +114,7 @@ namespace glm
GLM_FUNC_QUALIFIER bool all(vecType<bool, P> const & v)
{
bool Result = true;
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
for(length_t i = 0; i < v.length(); ++i)
Result = Result && v[i];
return Result;
}
@ -123,7 +123,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<bool, P> not_(vecType<bool, P> const & v)
{
vecType<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
for(length_t i = 0; i < v.length(); ++i)
Result[i] = !v[i];
return Result;
}

View File

@ -986,37 +986,16 @@
namespace glm
{
using std::size_t;
# if defined(GLM_FORCE_SIZE_T_LENGTH) || defined(GLM_FORCE_SIZE_FUNC)
# if defined(GLM_FORCE_SIZE_T_LENGTH)
typedef size_t length_t;
# else
typedef int length_t;
# endif
namespace detail
{
# ifdef GLM_FORCE_SIZE_FUNC
typedef size_t component_count_t;
# else
typedef length_t component_count_t;
# endif
template <typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR component_count_t component_count(genType const & m)
{
# ifdef GLM_FORCE_SIZE_FUNC
return m.size();
# else
return m.length();
# endif
}
}//namespace detail
}//namespace glm
#if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
# define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
# if defined GLM_FORCE_SIZE_FUNC
# pragma message("GLM: .length() is replaced by .size() and returns a std::size_t")
# elif defined GLM_FORCE_SIZE_T_LENGTH
# if defined GLM_FORCE_SIZE_T_LENGTH
# pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
# else
# pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")

View File

@ -199,47 +199,25 @@ namespace detail
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::size_type tmat2x2<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::length_type tmat2x2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::length_type tmat2x2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --

View File

@ -62,10 +62,10 @@ namespace glm
GLM_FUNC_DECL tmat2x3(tmat2x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x3(ctor);
GLM_FUNC_DECL explicit tmat2x3(T const & s);
GLM_FUNC_DECL explicit tmat2x3(T scalar);
GLM_FUNC_DECL tmat2x3(
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1);
T x0, T y0, T z0,
T x1, T y1, T z1);
GLM_FUNC_DECL tmat2x3(
col_type const & v0,
col_type const & v1);
@ -74,8 +74,8 @@ namespace glm
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2);
X1 x1, Y1 y1, Z1 z1,
X2 x2, Y2 y2, Z2 z2);
template <typename U, typename V>
GLM_FUNC_DECL tmat2x3(
@ -142,22 +142,22 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator+(tmat2x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x3<T, P> operator+(tmat2x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator+(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator-(tmat2x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x3<T, P> operator-(tmat2x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator-(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat2x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat2x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator*(T const & s, tmat2x3<T, P> const & m);
GLM_FUNC_DECL tmat2x3<T, P> operator*(T scalar, tmat2x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat2x3<T, P>::col_type operator*(tmat2x3<T, P> const & m, typename tmat2x3<T, P>::row_type const & v);
@ -175,10 +175,10 @@ namespace glm
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat4x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator/(tmat2x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x3<T, P> operator/(tmat2x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x3<T, P> operator/(T const & s, tmat2x3<T, P> const & m);
GLM_FUNC_DECL tmat2x3<T, P> operator/(T scalar, tmat2x3<T, P> const & m);
// -- Boolean operators --

View File

@ -67,17 +67,17 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(T const & s)
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(T scalar)
{
this->value[0] = col_type(s, 0, 0);
this->value[1] = col_type(0, s, 0);
this->value[0] = col_type(scalar, 0, 0);
this->value[1] = col_type(0, scalar, 0);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1
T x0, T y0, T z0,
T x1, T y1, T z1
)
{
this->value[0] = col_type(x0, y0, z0);
@ -99,8 +99,8 @@ namespace glm
typename X2, typename Y2, typename Z2>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2
X1 x1, Y1 y1, Z1 z1,
X2 x2, Y2 y2, Z2 z2
)
{
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1));
@ -183,47 +183,25 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::size_type tmat2x3<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::length_type tmat2x3<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::length_type tmat2x3<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --
@ -353,11 +331,11 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+(tmat2x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+(tmat2x3<T, P> const & m, T scalar)
{
return tmat2x3<T, P>(
m[0] + s,
m[1] + s);
m[0] + scalar,
m[1] + scalar);
}
template <typename T, precision P>
@ -369,11 +347,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-(tmat2x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-(tmat2x3<T, P> const & m, T scalar)
{
return tmat2x3<T, P>(
m[0] - s,
m[1] - s);
m[0] - scalar,
m[1] - scalar);
}
template <typename T, precision P>
@ -385,19 +363,19 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(tmat2x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(tmat2x3<T, P> const & m, T scalar)
{
return tmat2x3<T, P>(
m[0] * s,
m[1] * s);
m[0] * scalar,
m[1] * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(T const & s, tmat2x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(T scalar, tmat2x3<T, P> const & m)
{
return tmat2x3<T, P>(
m[0] * s,
m[1] * s);
m[0] * scalar,
m[1] * scalar);
}
template <typename T, precision P>
@ -484,19 +462,19 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/(tmat2x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/(tmat2x3<T, P> const & m, T scalar)
{
return tmat2x3<T, P>(
m[0] / s,
m[1] / s);
m[0] / scalar,
m[1] / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/(T const & s, tmat2x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/(T scalar, tmat2x3<T, P> const & m)
{
return tmat2x3<T, P>(
s / m[0],
s / m[1]);
scalar / m[0],
scalar / m[1]);
}
// -- Boolean operators --

View File

@ -62,10 +62,10 @@ namespace glm
GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat2x4(ctor);
GLM_FUNC_DECL explicit tmat2x4(T const & s);
GLM_FUNC_DECL explicit tmat2x4(T scalar);
GLM_FUNC_DECL tmat2x4(
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1);
T x0, T y0, T z0, T w0,
T x1, T y1, T z1, T w1);
GLM_FUNC_DECL tmat2x4(
col_type const & v0,
col_type const & v1);
@ -76,8 +76,8 @@ namespace glm
typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_DECL tmat2x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2);
X1 x1, Y1 y1, Z1 z1, W1 w1,
X2 x2, Y2 y2, Z2 z2, W2 w2);
template <typename U, typename V>
GLM_FUNC_DECL tmat2x4(
@ -144,22 +144,22 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator+(tmat2x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x4<T, P> operator+(tmat2x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator+(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator-(tmat2x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x4<T, P> operator-(tmat2x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator-(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat2x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat2x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator*(T const & s, tmat2x4<T, P> const & m);
GLM_FUNC_DECL tmat2x4<T, P> operator*(T scalar, tmat2x4<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat2x4<T, P>::col_type operator*(tmat2x4<T, P> const & m, typename tmat2x4<T, P>::row_type const & v);
@ -177,10 +177,10 @@ namespace glm
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat3x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat2x4<T, P> operator/(T const & s, tmat2x4<T, P> const & m);
GLM_FUNC_DECL tmat2x4<T, P> operator/(T scalar, tmat2x4<T, P> const & m);
// -- Boolean operators --

View File

@ -67,18 +67,18 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(T const & s)
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(T scalar)
{
value_type const Zero(0);
this->value[0] = col_type(s, Zero, Zero, Zero);
this->value[1] = col_type(Zero, s, Zero, Zero);
this->value[0] = col_type(scalar, Zero, Zero, Zero);
this->value[1] = col_type(Zero, scalar, Zero, Zero);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1
T x0, T y0, T z0, T w0,
T x1, T y1, T z1, T w1
)
{
this->value[0] = col_type(x0, y0, z0, w0);
@ -100,8 +100,8 @@ namespace glm
typename X2, typename Y2, typename Z2, typename W2>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2
X1 x1, Y1 y1, Z1 z1, W1 w1,
X2 x2, Y2 y2, Z2 z2, W2 w2
)
{
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1), value_type(w1));
@ -184,47 +184,25 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::size_type tmat2x4<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::length_type tmat2x4<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::length_type tmat2x4<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --
@ -354,11 +332,11 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+(tmat2x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+(tmat2x4<T, P> const & m, T scalar)
{
return tmat2x4<T, P>(
m[0] + s,
m[1] + s);
m[0] + scalar,
m[1] + scalar);
}
template <typename T, precision P>
@ -370,11 +348,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-(tmat2x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-(tmat2x4<T, P> const & m, T scalar)
{
return tmat2x4<T, P>(
m[0] - s,
m[1] - s);
m[0] - scalar,
m[1] - scalar);
}
template <typename T, precision P>
@ -386,19 +364,19 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(tmat2x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(tmat2x4<T, P> const & m, T scalar)
{
return tmat2x4<T, P>(
m[0] * s,
m[1] * s);
m[0] * scalar,
m[1] * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(T const & s, tmat2x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(T scalar, tmat2x4<T, P> const & m)
{
return tmat2x4<T, P>(
m[0] * s,
m[1] * s);
m[0] * scalar,
m[1] * scalar);
}
template <typename T, precision P>
@ -493,19 +471,19 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T scalar)
{
return tmat2x4<T, P>(
m[0] / s,
m[1] / s);
m[0] / scalar,
m[1] / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(T const & s, tmat2x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(T scalar, tmat2x4<T, P> const & m)
{
return tmat2x4<T, P>(
s / m[0],
s / m[1]);
scalar / m[0],
scalar / m[1]);
}
// -- Boolean operators --

View File

@ -62,11 +62,11 @@ namespace glm
GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x2(ctor);
GLM_FUNC_DECL explicit tmat3x2(T const & s);
GLM_FUNC_DECL explicit tmat3x2(T scalar);
GLM_FUNC_DECL tmat3x2(
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2);
T x0, T y0,
T x1, T y1,
T x2, T y2);
GLM_FUNC_DECL tmat3x2(
col_type const & v0,
col_type const & v1,
@ -79,9 +79,9 @@ namespace glm
typename X2, typename Y2,
typename X3, typename Y3>
GLM_FUNC_DECL tmat3x2(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3);
X1 x1, Y1 y1,
X2 x2, Y2 y2,
X3 x3, Y3 y3);
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x2(
@ -149,22 +149,22 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat3x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat3x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator*(T const & s, tmat3x2<T, P> const & m);
GLM_FUNC_DECL tmat3x2<T, P> operator*(T scalar, tmat3x2<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat3x2<T, P>::col_type operator*(tmat3x2<T, P> const & m, typename tmat3x2<T, P>::row_type const & v);
@ -182,10 +182,10 @@ namespace glm
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat4x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator/(tmat3x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x2<T, P> operator/(tmat3x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x2<T, P> operator/(T const & s, tmat3x2<T, P> const & m);
GLM_FUNC_DECL tmat3x2<T, P> operator/(T scalar, tmat3x2<T, P> const & m);
// -- Boolean operators --

View File

@ -70,19 +70,19 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(T const & s)
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(T scalar)
{
this->value[0] = col_type(s, 0);
this->value[1] = col_type(0, s);
this->value[0] = col_type(scalar, 0);
this->value[1] = col_type(0, scalar);
this->value[2] = col_type(0, 0);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2
T x0, T y0,
T x1, T y1,
T x2, T y2
)
{
this->value[0] = col_type(x0, y0);
@ -112,9 +112,9 @@ namespace glm
typename X3, typename Y3>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3
X1 x1, Y1 y1,
X2 x2, Y2 y2,
X3 x3, Y3 y3
)
{
this->value[0] = col_type(static_cast<T>(x1), value_type(y1));
@ -213,47 +213,25 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::size_type tmat3x2<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::length_type tmat3x2<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::length_type tmat3x2<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --
@ -394,12 +372,12 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+(tmat3x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+(tmat3x2<T, P> const & m, T scalar)
{
return tmat3x2<T, P>(
m[0] + s,
m[1] + s,
m[2] + s);
m[0] + scalar,
m[1] + scalar,
m[2] + scalar);
}
template <typename T, precision P>
@ -412,12 +390,12 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-(tmat3x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-(tmat3x2<T, P> const & m, T scalar)
{
return tmat3x2<T, P>(
m[0] - s,
m[1] - s,
m[2] - s);
m[0] - scalar,
m[1] - scalar,
m[2] - scalar);
}
template <typename T, precision P>
@ -430,21 +408,21 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(tmat3x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(tmat3x2<T, P> const & m, T scalar)
{
return tmat3x2<T, P>(
m[0] * s,
m[1] * s,
m[2] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(T const & s, tmat3x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(T scalar, tmat3x2<T, P> const & m)
{
return tmat3x2<T, P>(
m[0] * s,
m[1] * s,
m[2] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar);
}
template <typename T, precision P>
@ -516,21 +494,21 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/(tmat3x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/(tmat3x2<T, P> const & m, T scalar)
{
return tmat3x2<T, P>(
m[0] / s,
m[1] / s,
m[2] / s);
m[0] / scalar,
m[1] / scalar,
m[2] / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/(T const & s, tmat3x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/(T scalar, tmat3x2<T, P> const & m)
{
return tmat3x2<T, P>(
s / m[0],
s / m[1],
s / m[2]);
scalar / m[0],
scalar / m[1],
scalar / m[2]);
}
// -- Boolean operators --

View File

@ -61,11 +61,11 @@ namespace glm
GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x3(ctor);
GLM_FUNC_DECL explicit tmat3x3(T const & s);
GLM_FUNC_DECL explicit tmat3x3(T scalar);
GLM_FUNC_DECL tmat3x3(
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2);
T x0, T y0, T z0,
T x1, T y1, T z1,
T x2, T y2, T z2);
GLM_FUNC_DECL tmat3x3(
col_type const & v0,
col_type const & v1,
@ -78,9 +78,9 @@ namespace glm
typename X2, typename Y2, typename Z2,
typename X3, typename Y3, typename Z3>
GLM_FUNC_DECL tmat3x3(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3);
X1 x1, Y1 y1, Z1 z1,
X2 x2, Y2 y2, Z2 z2,
X3 x3, Y3 y3, Z3 z3);
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x3(
@ -152,28 +152,28 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator+(tmat3x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x3<T, P> operator+(tmat3x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator+(T const & s, tmat3x3<T, P> const & m);
GLM_FUNC_DECL tmat3x3<T, P> operator+(T scalar, tmat3x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator+(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator-(tmat3x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x3<T, P> operator-(tmat3x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator-(T const & s, tmat3x3<T, P> const & m);
GLM_FUNC_DECL tmat3x3<T, P> operator-(T scalar, tmat3x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator-(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat3x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat3x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator*(T const & s, tmat3x3<T, P> const & m);
GLM_FUNC_DECL tmat3x3<T, P> operator*(T scalar, tmat3x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat3x3<T, P>::col_type operator*(tmat3x3<T, P> const & m, typename tmat3x3<T, P>::row_type const & v);
@ -191,10 +191,10 @@ namespace glm
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat4x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator/(tmat3x3<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x3<T, P> operator/(tmat3x3<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x3<T, P> operator/(T const & s, tmat3x3<T, P> const & m);
GLM_FUNC_DECL tmat3x3<T, P> operator/(T scalar, tmat3x3<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat3x3<T, P>::col_type operator/(tmat3x3<T, P> const & m, typename tmat3x3<T, P>::row_type const & v);

View File

@ -94,19 +94,19 @@ namespace detail
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(T const & s)
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(T scalar)
{
this->value[0] = col_type(s, 0, 0);
this->value[1] = col_type(0, s, 0);
this->value[2] = col_type(0, 0, s);
this->value[0] = col_type(scalar, 0, 0);
this->value[1] = col_type(0, scalar, 0);
this->value[2] = col_type(0, 0, scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
T const & x0, T const & y0, T const & z0,
T const & x1, T const & y1, T const & z1,
T const & x2, T const & y2, T const & z2
T x0, T y0, T z0,
T x1, T y1, T z1,
T x2, T y2, T z2
)
{
this->value[0] = col_type(x0, y0, z0);
@ -136,9 +136,9 @@ namespace detail
typename X3, typename Y3, typename Z3>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2,
X3 const & x3, Y3 const & y3, Z3 const & z3
X1 x1, Y1 y1, Z1 z1,
X2 x2, Y2 y2, Z2 z2,
X3 x3, Y3 y3, Z3 z3
)
{
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1));
@ -237,47 +237,25 @@ namespace detail
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::size_type tmat3x3<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::length_type tmat3x3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::length_type tmat3x3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --
@ -432,21 +410,21 @@ namespace detail
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(tmat3x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(tmat3x3<T, P> const & m, T scalar)
{
return tmat3x3<T, P>(
m[0] + s,
m[1] + s,
m[2] + s);
m[0] + scalar,
m[1] + scalar,
m[2] + scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(T const & s, tmat3x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(T scalar, tmat3x3<T, P> const & m)
{
return tmat3x3<T, P>(
m[0] + s,
m[1] + s,
m[2] + s);
m[0] + scalar,
m[1] + scalar,
m[2] + scalar);
}
template <typename T, precision P>
@ -459,21 +437,21 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(tmat3x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(tmat3x3<T, P> const & m, T scalar)
{
return tmat3x3<T, P>(
m[0] - s,
m[1] - s,
m[2] - s);
m[0] - scalar,
m[1] - scalar,
m[2] - scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(T const & s, tmat3x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(T scalar, tmat3x3<T, P> const & m)
{
return tmat3x3<T, P>(
s - m[0],
s - m[1],
s - m[2]);
scalar - m[0],
scalar - m[1],
scalar - m[2]);
}
template <typename T, precision P>
@ -486,21 +464,21 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(tmat3x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(tmat3x3<T, P> const & m, T scalar)
{
return tmat3x3<T, P>(
m[0] * s,
m[1] * s,
m[2] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(T const & s, tmat3x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(T scalar, tmat3x3<T, P> const & m)
{
return tmat3x3<T, P>(
m[0] * s,
m[1] * s,
m[2] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar);
}
template <typename T, precision P>
@ -588,21 +566,21 @@ namespace detail
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(tmat3x3<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(tmat3x3<T, P> const & m, T scalar)
{
return tmat3x3<T, P>(
m[0] / s,
m[1] / s,
m[2] / s);
m[0] / scalar,
m[1] / scalar,
m[2] / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(T const & s, tmat3x3<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(T scalar, tmat3x3<T, P> const & m)
{
return tmat3x3<T, P>(
s / m[0],
s / m[1],
s / m[2]);
scalar / m[0],
scalar / m[1],
scalar / m[2]);
}
template <typename T, precision P>

View File

@ -62,11 +62,11 @@ namespace glm
GLM_FUNC_DECL tmat3x4(tmat3x4<T, Q> const & m);
GLM_FUNC_DECL explicit tmat3x4(ctor);
GLM_FUNC_DECL explicit tmat3x4(T const & s);
GLM_FUNC_DECL explicit tmat3x4(T scalar);
GLM_FUNC_DECL tmat3x4(
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2);
T x0, T y0, T z0, T w0,
T x1, T y1, T z1, T w1,
T x2, T y2, T z2, T w2);
GLM_FUNC_DECL tmat3x4(
col_type const & v0,
col_type const & v1,
@ -79,9 +79,9 @@ namespace glm
typename X2, typename Y2, typename Z2, typename W2,
typename X3, typename Y3, typename Z3, typename W3>
GLM_FUNC_DECL tmat3x4(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3);
X1 x1, Y1 y1, Z1 z1, W1 w1,
X2 x2, Y2 y2, Z2 z2, W2 w2,
X3 x3, Y3 y3, Z3 z3, W3 w3);
template <typename V1, typename V2, typename V3>
GLM_FUNC_DECL tmat3x4(
@ -149,22 +149,22 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator+(tmat3x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x4<T, P> operator+(tmat3x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator+(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator-(tmat3x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x4<T, P> operator-(tmat3x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator-(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat3x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat3x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator*(T const & s, tmat3x4<T, P> const & m);
GLM_FUNC_DECL tmat3x4<T, P> operator*(T scalar, tmat3x4<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat3x4<T, P>::col_type operator*(tmat3x4<T, P> const & m, typename tmat3x4<T, P>::row_type const & v);
@ -182,10 +182,10 @@ namespace glm
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat3x3<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator/(tmat3x4<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat3x4<T, P> operator/(tmat3x4<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat3x4<T, P> operator/(T const & s, tmat3x4<T, P> const & m);
GLM_FUNC_DECL tmat3x4<T, P> operator/(T scalar, tmat3x4<T, P> const & m);
// -- Boolean operators --

View File

@ -70,19 +70,19 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(T const & s)
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(T scalar)
{
this->value[0] = col_type(s, 0, 0, 0);
this->value[1] = col_type(0, s, 0, 0);
this->value[2] = col_type(0, 0, s, 0);
this->value[0] = col_type(scalar, 0, 0, 0);
this->value[1] = col_type(0, scalar, 0, 0);
this->value[2] = col_type(0, 0, scalar, 0);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
T const & x0, T const & y0, T const & z0, T const & w0,
T const & x1, T const & y1, T const & z1, T const & w1,
T const & x2, T const & y2, T const & z2, T const & w2
T x0, T y0, T z0, T w0,
T x1, T y1, T z1, T w1,
T x2, T y2, T z2, T w2
)
{
this->value[0] = col_type(x0, y0, z0, w0);
@ -112,9 +112,9 @@ namespace glm
typename X3, typename Y3, typename Z3, typename W3>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1,
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3
X1 x1, Y1 y1, Z1 z1, W1 w1,
X2 x2, Y2 y2, Z2 z2, W2 w2,
X3 x3, Y3 y3, Z3 z3, W3 w3
)
{
this->value[0] = col_type(static_cast<T>(x1), value_type(y1), value_type(z1), value_type(w1));
@ -213,47 +213,25 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::size_type tmat3x4<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::length_type tmat3x4<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::length_type tmat3x4<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --
@ -394,12 +372,12 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+(tmat3x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+(tmat3x4<T, P> const & m, T scalar)
{
return tmat3x4<T, P>(
m[0] + s,
m[1] + s,
m[2] + s);
m[0] + scalar,
m[1] + scalar,
m[2] + scalar);
}
template <typename T, precision P>
@ -412,12 +390,12 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-(tmat3x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-(tmat3x4<T, P> const & m, T scalar)
{
return tmat3x4<T, P>(
m[0] - s,
m[1] - s,
m[2] - s);
m[0] - scalar,
m[1] - scalar,
m[2] - scalar);
}
template <typename T, precision P>
@ -430,21 +408,21 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(tmat3x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(tmat3x4<T, P> const & m, T scalar)
{
return tmat3x4<T, P>(
m[0] * s,
m[1] * s,
m[2] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(T const & s, tmat3x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(T scalar, tmat3x4<T, P> const & m)
{
return tmat3x4<T, P>(
m[0] * s,
m[1] * s,
m[2] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar);
}
template <typename T, precision P>
@ -556,21 +534,21 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/(tmat3x4<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/(tmat3x4<T, P> const & m, T scalar)
{
return tmat3x4<T, P>(
m[0] / s,
m[1] / s,
m[2] / s);
m[0] / scalar,
m[1] / scalar,
m[2] / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/(T const & s, tmat3x4<T, P> const & m)
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/(T scalar, tmat3x4<T, P> const & m)
{
return tmat3x4<T, P>(
s / m[0],
s / m[1],
s / m[2]);
scalar / m[0],
scalar / m[1],
scalar / m[2]);
}
// -- Boolean operators --

View File

@ -62,12 +62,12 @@ namespace glm
GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
GLM_FUNC_DECL explicit tmat4x2(ctor);
GLM_FUNC_DECL explicit tmat4x2(T const & x);
GLM_FUNC_DECL explicit tmat4x2(T scalar);
GLM_FUNC_DECL tmat4x2(
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2,
T const & x3, T const & y3);
T x0, T y0,
T x1, T y1,
T x2, T y2,
T x3, T y3);
GLM_FUNC_DECL tmat4x2(
col_type const & v0,
col_type const & v1,
@ -82,10 +82,10 @@ namespace glm
typename X3, typename Y3,
typename X4, typename Y4>
GLM_FUNC_DECL tmat4x2(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3,
X4 const & x4, Y4 const & y4);
X1 x1, Y1 y1,
X2 x2, Y2 y2,
X3 x3, Y3 y3,
X4 x4, Y4 y4);
template <typename V1, typename V2, typename V3, typename V4>
GLM_FUNC_DECL tmat4x2(
@ -154,22 +154,22 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator*(T const & s, tmat4x2<T, P> const & m);
GLM_FUNC_DECL tmat4x2<T, P> operator*(T scalar, tmat4x2<T, P> const & m);
template <typename T, precision P>
GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator*(tmat4x2<T, P> const & m, typename tmat4x2<T, P>::row_type const & v);
@ -187,10 +187,10 @@ namespace glm
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat4x4<T, P> const & m2);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T const & s);
GLM_FUNC_DECL tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tmat4x2<T, P> operator/(T const & s, tmat4x2<T, P> const & m);
GLM_FUNC_DECL tmat4x2<T, P> operator/(T scalar, tmat4x2<T, P> const & m);
// -- Boolean operators --

View File

@ -80,10 +80,10 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(T const & s)
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(T scalar)
{
this->value[0] = col_type(s, 0);
this->value[1] = col_type(0, s);
this->value[0] = col_type(scalar, 0);
this->value[1] = col_type(0, scalar);
this->value[2] = col_type(0, 0);
this->value[3] = col_type(0, 0);
}
@ -91,10 +91,10 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
T const & x0, T const & y0,
T const & x1, T const & y1,
T const & x2, T const & y2,
T const & x3, T const & y3
T x0, T y0,
T x1, T y1,
T x2, T y2,
T x3, T y3
)
{
this->value[0] = col_type(x0, y0);
@ -128,10 +128,10 @@ namespace glm
typename X4, typename Y4>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
X1 const & x1, Y1 const & y1,
X2 const & x2, Y2 const & y2,
X3 const & x3, Y3 const & y3,
X4 const & x4, Y4 const & y4
X1 x1, Y1 y1,
X2 x2, Y2 y2,
X3 x3, Y3 y3,
X4 x4, Y4 y4
)
{
this->value[0] = col_type(static_cast<T>(x1), value_type(y1));
@ -242,47 +242,25 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::size_type tmat4x2<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::length_type tmat4x2<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::length_type tmat4x2<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --
@ -434,13 +412,13 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T scalar)
{
return tmat4x2<T, P>(
m[0] + s,
m[1] + s,
m[2] + s,
m[3] + s);
m[0] + scalar,
m[1] + scalar,
m[2] + scalar,
m[3] + scalar);
}
template <typename T, precision P>
@ -454,13 +432,13 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T scalar)
{
return tmat4x2<T, P>(
m[0] - s,
m[1] - s,
m[2] - s,
m[3] - s);
m[0] - scalar,
m[1] - scalar,
m[2] - scalar,
m[3] - scalar);
}
template <typename T, precision P>
@ -474,23 +452,23 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T scalar)
{
return tmat4x2<T, P>(
m[0] * s,
m[1] * s,
m[2] * s,
m[3] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar,
m[3] * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(T const & s, tmat4x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(T scalar, tmat4x2<T, P> const & m)
{
return tmat4x2<T, P>(
m[0] * s,
m[1] * s,
m[2] * s,
m[3] * s);
m[0] * scalar,
m[1] * scalar,
m[2] * scalar,
m[3] * scalar);
}
template <typename T, precision P>
@ -567,23 +545,23 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T const & s)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T scalar)
{
return tmat4x2<T, P>(
m[0] / s,
m[1] / s,
m[2] / s,
m[3] / s);
m[0] / scalar,
m[1] / scalar,
m[2] / scalar,
m[3] / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/(T const & s, tmat4x2<T, P> const & m)
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/(T scalar, tmat4x2<T, P> const & m)
{
return tmat4x2<T, P>(
s / m[0],
s / m[1],
s / m[2],
s / m[3]);
scalar / m[0],
scalar / m[1],
scalar / m[2],
scalar / m[3]);
}
// -- Boolean operators --

View File

@ -235,47 +235,25 @@ namespace glm
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::size_type tmat4x3<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::length_type tmat4x3<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::length_type tmat4x3<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary updatable operators --

View File

@ -323,47 +323,25 @@ namespace detail
// -- Accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::size_type tmat4x4<T, P>::size() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::length_type tmat4x4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::size_type i)
{
assert(i < this->size());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::size_type i) const
{
assert(i < this->size());
return this->value[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::length_type tmat4x4<T, P>::length() const
{
return 4;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i)
{
assert(i < this->length());
return this->value[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i) const
{
assert(i < this->length());
return this->value[i];
}
// -- Unary arithmetic operators --

View File

@ -104,14 +104,14 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
assert(i >= 0 && i < this->length());
return (&x)[i];
}

View File

@ -122,47 +122,25 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::size_type tvec2<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::length_type tvec2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i)
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec2<T, P>::length_type tvec2<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) const
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
// -- Unary arithmetic operators --

View File

@ -168,47 +168,25 @@ namespace glm
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::size_type tvec3<T, P>::size() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::length_type tvec3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](typename tvec3<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](typename tvec3<T, P>::length_type i)
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](typename tvec3<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T, P>::length_type tvec3<T, P>::length() const
{
return 3;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec3<T, P>::operator[](typename tvec3<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](typename tvec3<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&x)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec3<T, P>::operator[](typename tvec3<T, P>::length_type i) const
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
// -- Unary arithmetic operators --

View File

@ -213,14 +213,14 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tvec4<T, P>::operator[](typename tvec4<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
assert(i >= 0 && i < this->length());
return (&x)[i];
}

View File

@ -40,10 +40,10 @@ namespace glm
typename genType::row_type const & x
)
{
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m[0]));
assert(index >= 0 && index < m[0].length());
genType Result = m;
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
for(length_t i = 0; i < m.length(); ++i)
Result[i][index] = x[i];
return Result;
}
@ -55,10 +55,10 @@ namespace glm
length_t index
)
{
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m[0]));
assert(index >= 0 && index < m[0].length());
typename genType::row_type Result;
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
for(length_t i = 0; i < m.length(); ++i)
Result[i] = m[i][index];
return Result;
}
@ -71,7 +71,7 @@ namespace glm
typename genType::col_type const & x
)
{
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m));
assert(index >= 0 && index < m.length());
genType Result = m;
Result[index] = x;
@ -85,7 +85,7 @@ namespace glm
length_t index
)
{
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m));
assert(index >= 0 && index < m.length());
return m[index];
}

View File

@ -60,14 +60,14 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
assert(i >= 0 && i < this->length());
return (&x)[i];
}
@ -717,7 +717,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<bool, P> lessThan(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
}
@ -726,7 +726,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<bool, P> lessThanEqual(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i];
return Result;
}
@ -735,7 +735,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<bool, P> greaterThan(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i];
return Result;
}
@ -744,7 +744,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<bool, P> greaterThanEqual(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i];
return Result;
}
@ -753,7 +753,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<bool, P> equal(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i];
return Result;
}
@ -762,7 +762,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y)
{
tvec4<bool, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i];
return Result;
}

View File

@ -232,7 +232,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = next_float(x[i]);
return Result;
}
@ -267,7 +267,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = prev_float(x[i]);
return Result;
}
@ -285,7 +285,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = next_float(x[i], ulps[i]);
return Result;
}
@ -303,7 +303,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = prev_float(x[i], ulps[i]);
return Result;
}
@ -343,7 +343,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<uint, P> float_distance(vecType<T, P> const & x, vecType<T, P> const & y)
{
vecType<uint, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = float_distance(x[i], y[i]);
return Result;
}

View File

@ -47,7 +47,7 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] < y[i] ? a[i] : b[i];
return Result;
}
@ -60,7 +60,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x < y ? a[i] : b[i];
return Result;
}
@ -73,7 +73,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] < y[i] ? a : b;
return Result;
}
@ -100,7 +100,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
return Result;
}
@ -134,7 +134,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
{
T Test1 = min(x[i], y[i]);
T Test2 = min(z[i], w[i]);
@ -159,7 +159,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
T Test2 = min(z, w);
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
{
U Result1 = x < y ? a[i] : b[i];
U Result2 = z < w ? c[i] : d[i];
@ -179,7 +179,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
{
T Test1 = min(x[i], y[i]);
T Test2 = min(z[i], w[i]);;
@ -206,7 +206,7 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] > y[i] ? a[i] : b[i];
return Result;
}
@ -220,7 +220,7 @@ GLM_FUNC_QUALIFIER vecType<T, P> associatedMax
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x > y ? a[i] : b[i];
return Result;
}
@ -234,7 +234,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] > y[i] ? a : b;
return Result;
}
@ -262,7 +262,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
return Result;
}
@ -277,7 +277,7 @@ GLM_FUNC_QUALIFIER vecType<T, P> associatedMax
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
return Result;
}
@ -292,7 +292,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
return Result;
}
@ -326,7 +326,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
{
T Test1 = max(x[i], y[i]);
T Test2 = max(z[i], w[i]);
@ -351,7 +351,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
T Test2 = max(z, w);
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
{
U Result1 = x > y ? a[i] : b[i];
U Result2 = z > w ? c[i] : d[i];
@ -371,7 +371,7 @@ GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
)
{
vecType<U, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
for(length_t i = 0, n = Result.length(); i < n; ++i)
{
T Test1 = max(x[i], y[i]);
T Test2 = max(z[i], w[i]);;

View File

@ -122,36 +122,36 @@ namespace detail
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compAdd(vecType<T, P> const & v)
{
T result(0);
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
result += v[i];
return result;
T Result(0);
for(length_t i = 0, n = v.length(); i < n; ++i)
Result += v[i];
return Result;
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMul(vecType<T, P> const & v)
{
T result(1);
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
result *= v[i];
return result;
T Result(1);
for(length_t i = 0, n = v.length(); i < n; ++i)
Result *= v[i];
return Result;
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMin(vecType<T, P> const & v)
{
T result(v[0]);
for(detail::component_count_t i = 1; i < detail::component_count(v); ++i)
result = min(result, v[i]);
return result;
T Result(v[0]);
for(length_t i = 1, n = v.length(); i < n; ++i)
Result = min(Result, v[i]);
return Result;
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compMax(vecType<T, P> const & v)
{
T result(v[0]);
for(detail::component_count_t i = 1; i < detail::component_count(v); ++i)
result = max(result, v[i]);
return result;
T Result(v[0]);
for(length_t i = 1, n = v.length(); i < n; ++i)
Result = max(Result, v[i]);
return Result;
}
}//namespace glm

View File

@ -37,47 +37,25 @@ namespace glm
{
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat<T, P>::size_type tdualquat<T, P>::size() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat<T, P>::length_type tdualquat<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator[](typename tdualquat<T, P>::size_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator[](typename tdualquat<T, P>::length_type 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[](typename tdualquat<T, P>::size_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
# else
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tdualquat<T, P>::length_type tdualquat<T, P>::length() const
{
return 2;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type & tdualquat<T, P>::operator[](typename tdualquat<T, P>::length_type i)
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type const & tdualquat<T, P>::operator[](typename tdualquat<T, P>::length_type i) const
{
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
return (&real)[i];
}
# endif//GLM_FORCE_SIZE_FUNC
template <typename T, precision P>
GLM_FUNC_QUALIFIER typename tdualquat<T, P>::part_type const & tdualquat<T, P>::operator[](typename tdualquat<T, P>::length_type i) const
{
assert(i >= 0 && i < this->length());
return (&real)[i];
}
// -- Implicit basic constructors --

View File

@ -58,7 +58,7 @@ namespace glm
GLM_FUNC_QUALIFIER vecType<T, P> fastPow(vecType<T, P> const & x, vecType<int, P> const & y)
{
vecType<T, P> Result(uninitialize);
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
for(length_t i = 0, n = x.length(); i < n; ++i)
Result[i] = fastPow(x[i], y[i]);
return Result;
}

View File

@ -36,7 +36,7 @@ namespace glm
GLM_FUNC_QUALIFIER bool isNull(tmat2x2<T, P> const & m, T const & epsilon)
{
bool result = true;
for(detail::component_count_t i = 0; result && i < 2 ; ++i)
for(length_t i = 0; result && i < m.length() ; ++i)
result = isNull(m[i], epsilon);
return result;
}
@ -45,7 +45,7 @@ namespace glm
GLM_FUNC_QUALIFIER bool isNull(tmat3x3<T, P> const & m, T const & epsilon)
{
bool result = true;
for(detail::component_count_t i = 0; result && i < 3 ; ++i)
for(length_t i = 0; result && i < m.length() ; ++i)
result = isNull(m[i], epsilon);
return result;
}
@ -54,7 +54,7 @@ namespace glm
GLM_FUNC_QUALIFIER bool isNull(tmat4x4<T, P> const & m, T const & epsilon)
{
bool result = true;
for(detail::component_count_t i = 0; result && i < 4 ; ++i)
for(length_t i = 0; result && i < m.length() ; ++i)
result = isNull(m[i], epsilon);
return result;
}
@ -63,13 +63,13 @@ namespace glm
GLM_FUNC_QUALIFIER bool isIdentity(matType<T, P> const & m, T const & epsilon)
{
bool result = true;
for(detail::component_count_t i(0); result && i < detail::component_count(m[0]); ++i)
for(length_t i = 0; result && i < m[0].length() ; ++i)
{
for(detail::component_count_t j(0); result && j < i ; ++j)
for(length_t j = 0; result && j < i ; ++j)
result = abs(m[i][j]) <= epsilon;
if(result)
result = abs(m[i][i] - 1) <= epsilon;
for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j)
for(length_t j = i + 1; result && j < m.length(); ++j)
result = abs(m[i][j]) <= epsilon;
}
return result;
@ -79,12 +79,12 @@ namespace glm
GLM_FUNC_QUALIFIER bool isNormalized(tmat2x2<T, P> const & m, T const & epsilon)
{
bool result(true);
for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
for(length_t i = 0; result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon);
for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
for(length_t i = 0; result && i < m.length(); ++i)
{
typename tmat2x2<T, P>::col_type v;
for(detail::component_count_t j(0); j < detail::component_count(m); ++j)
for(length_t j = 0; j < m.length(); ++j)
v[j] = m[j][i];
result = isNormalized(v, epsilon);
}
@ -95,12 +95,12 @@ namespace glm
GLM_FUNC_QUALIFIER bool isNormalized(tmat3x3<T, P> const & m, T const & epsilon)
{
bool result(true);
for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
for(length_t i = 0; result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon);
for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
for(length_t i = 0; result && i < m.length(); ++i)
{
typename tmat3x3<T, P>::col_type v;
for(detail::component_count_t j(0); j < detail::component_count(m); ++j)
for(length_t j = 0; j < m.length(); ++j)
v[j] = m[j][i];
result = isNormalized(v, epsilon);
}
@ -111,12 +111,12 @@ namespace glm
GLM_FUNC_QUALIFIER bool isNormalized(tmat4x4<T, P> const & m, T const & epsilon)
{
bool result(true);
for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
for(length_t i = 0; result && i < m.length(); ++i)
result = isNormalized(m[i], epsilon);
for(detail::component_count_t i(0); result && i < detail::component_count(m); ++i)
for(length_t i = 0; result && i < m.length(); ++i)
{
typename tmat4x4<T, P>::col_type v;
for(detail::component_count_t j(0); j < detail::component_count(m); ++j)
for(length_t j = 0; j < m.length(); ++j)
v[j] = m[j][i];
result = isNormalized(v, epsilon);
}
@ -127,15 +127,15 @@ namespace glm
GLM_FUNC_QUALIFIER bool isOrthogonal(matType<T, P> const & m, T const & epsilon)
{
bool result(true);
for(detail::component_count_t i(0); result && i < detail::component_count(m) - 1; ++i)
for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j)
for(length_t i(0); result && i < m.length() - 1; ++i)
for(length_t j(i + 1); result && j < m.length(); ++j)
result = areOrthogonal(m[i], m[j], epsilon);
if(result)
{
matType<T, P> tmp = transpose(m);
for(detail::component_count_t i(0); result && i < detail::component_count(m) - 1 ; ++i)
for(detail::component_count_t j(i + 1); result && j < detail::component_count(m); ++j)
for(length_t i(0); result && i < m.length() - 1 ; ++i)
for(length_t j(i + 1); result && j < m.length(); ++j)
result = areOrthogonal(tmp[i], tmp[j], epsilon);
}
return result;

View File

@ -48,54 +48,65 @@
#endif
#include "../gtc/type_ptr.hpp"
#include "../gtc/vec1.hpp"
namespace glm{
namespace detail
namespace glm
{
/* The glm types provide a .length() member, but for matrices
this only defines the number of columns, so we need to work around this */
template <typename T, precision P>
detail::component_count_t number_of_elements_(tvec2<T, P> const & v){
return detail::component_count(v);
}
template <typename T, precision P>
detail::component_count_t number_of_elements_(tvec3<T, P> const & v){
return detail::component_count(v);
}
template <typename T, precision P>
detail::component_count_t number_of_elements_(tvec4<T, P> const & v){
return detail::component_count(v);
}
template <typename genType>
detail::component_count_t number_of_elements_(genType const & m){
return detail::component_count(m) * detail::component_count(m[0]);
}
}//namespace
/// @addtogroup gtx_range
/// @{
template <typename T, precision P>
inline length_t components(tvec1<T, P> const & v)
{
return v.length();
}
template <typename T, precision P>
inline length_t components(tvec2<T, P> const & v)
{
return v.length();
}
template <typename T, precision P>
inline length_t components(tvec3<T, P> const & v)
{
return v.length();
}
template <typename T, precision P>
inline length_t components(tvec4<T, P> const & v)
{
return v.length();
}
template <typename genType>
const typename genType::value_type * begin(genType const & v){
inline length_t components(genType const & m)
{
return m.length() * m[0].length();
}
template <typename genType>
inline typename genType::value_type const * begin(genType const & v)
{
return value_ptr(v);
}
template <typename genType>
const typename genType::value_type * end(genType const & v){
return begin(v) + detail::number_of_elements_(v);
inline typename genType::value_type const * end(genType const & v)
{
return begin(v) + components(v);
}
template <typename genType>
typename genType::value_type * begin(genType& v){
inline typename genType::value_type * begin(genType& v)
{
return value_ptr(v);
}
template <typename genType>
typename genType::value_type * end(genType& v){
return begin(v) + detail::number_of_elements_(v);
inline typename genType::value_type * end(genType& v)
{
return begin(v) + components(v);
}
/// @}

View File

@ -17,7 +17,7 @@ struct type_gni<vecType, T, P>
static bool const is_quat = false;
};
*/
/*
namespace detail
{
template <template <typename, glm::precision> class vec_type>
@ -55,7 +55,7 @@ namespace detail
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 4;
};
}//namespace detail
/*
template <class gen_type>
struct vec_type
{