|
@@ -27,18 +27,6 @@
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "../geometric.hpp"
|
|
#include "../geometric.hpp"
|
|
|
-#include "../vec2.hpp"
|
|
|
|
|
-#include "../vec3.hpp"
|
|
|
|
|
-#include "../vec4.hpp"
|
|
|
|
|
-#include "type_mat2x2.hpp"
|
|
|
|
|
-#include "type_mat2x3.hpp"
|
|
|
|
|
-#include "type_mat2x4.hpp"
|
|
|
|
|
-#include "type_mat3x2.hpp"
|
|
|
|
|
-#include "type_mat3x3.hpp"
|
|
|
|
|
-#include "type_mat3x4.hpp"
|
|
|
|
|
-#include "type_mat4x2.hpp"
|
|
|
|
|
-#include "type_mat4x3.hpp"
|
|
|
|
|
-#include "type_mat4x4.hpp"
|
|
|
|
|
#include <limits>
|
|
#include <limits>
|
|
|
|
|
|
|
|
namespace glm{
|
|
namespace glm{
|
|
@@ -55,9 +43,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec2, detail::tvec2, T, P>
|
|
struct compute_outerProduct<detail::tvec2, detail::tvec2, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat2x2<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec2<T, P> const & c, detail::tvec2<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec2>::type call(detail::tvec2<T, P> const & c, detail::tvec2<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::null);
|
|
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::null);
|
|
|
m[0][0] = c[0] * r[0];
|
|
m[0][0] = c[0] * r[0];
|
|
@@ -71,9 +57,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec3, detail::tvec3, T, P>
|
|
struct compute_outerProduct<detail::tvec3, detail::tvec3, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat3x3<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec3<T, P> const & c, detail::tvec3<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec3>::type call(detail::tvec3<T, P> const & c, detail::tvec3<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null);
|
|
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::null);
|
|
|
for(length_t i(0); i < m.length(); ++i)
|
|
for(length_t i(0); i < m.length(); ++i)
|
|
@@ -85,9 +69,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec4, detail::tvec4, T, P>
|
|
struct compute_outerProduct<detail::tvec4, detail::tvec4, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat4x4<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec4<T, P> const & c, detail::tvec4<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec4>::type call(detail::tvec4<T, P> const & c, detail::tvec4<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null);
|
|
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::null);
|
|
|
for(length_t i(0); i < m.length(); ++i)
|
|
for(length_t i(0); i < m.length(); ++i)
|
|
@@ -99,9 +81,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec3, detail::tvec2, T, P>
|
|
struct compute_outerProduct<detail::tvec3, detail::tvec2, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat2x3<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec3<T, P> const & c, detail::tvec2<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec2>::type call(detail::tvec3<T, P> const & c, detail::tvec2<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::null);
|
|
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::null);
|
|
|
m[0][0] = c.x * r.x;
|
|
m[0][0] = c.x * r.x;
|
|
@@ -117,9 +97,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec2, detail::tvec3, T, P>
|
|
struct compute_outerProduct<detail::tvec2, detail::tvec3, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat3x2<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec2<T, P> const & c, detail::tvec3<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec3>::type call(detail::tvec2<T, P> const & c, detail::tvec3<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::null);
|
|
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::null);
|
|
|
m[0][0] = c.x * r.x;
|
|
m[0][0] = c.x * r.x;
|
|
@@ -135,9 +113,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec4, detail::tvec2, T, P>
|
|
struct compute_outerProduct<detail::tvec4, detail::tvec2, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat2x4<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec4<T, P> const & c, detail::tvec2<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec2>::type call(detail::tvec4<T, P> const & c, detail::tvec2<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::null);
|
|
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::null);
|
|
|
m[0][0] = c.x * r.x;
|
|
m[0][0] = c.x * r.x;
|
|
@@ -155,9 +131,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec2, detail::tvec4, T, P>
|
|
struct compute_outerProduct<detail::tvec2, detail::tvec4, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat4x2<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec2<T, P> const & c, detail::tvec4<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec4>::type call(detail::tvec2<T, P> const & c, detail::tvec4<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::null);
|
|
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::null);
|
|
|
m[0][0] = c.x * r.x;
|
|
m[0][0] = c.x * r.x;
|
|
@@ -175,9 +149,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec4, detail::tvec3, T, P>
|
|
struct compute_outerProduct<detail::tvec4, detail::tvec3, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat3x4<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec4<T, P> const & c, detail::tvec3<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec3>::type call(detail::tvec4<T, P> const & c, detail::tvec3<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::null);
|
|
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::null);
|
|
|
m[0][0] = c.x * r.x;
|
|
m[0][0] = c.x * r.x;
|
|
@@ -199,9 +171,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_outerProduct<detail::tvec3, detail::tvec4, T, P>
|
|
struct compute_outerProduct<detail::tvec3, detail::tvec4, T, P>
|
|
|
{
|
|
{
|
|
|
- typedef detail::tmat4x3<T, P> return_type;
|
|
|
|
|
-
|
|
|
|
|
- static return_type call(detail::tvec3<T, P> const & c, detail::tvec4<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec4>::type call(detail::tvec3<T, P> const & c, detail::tvec4<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::null);
|
|
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::null);
|
|
|
m[0][0] = c.x * r.x;
|
|
m[0][0] = c.x * r.x;
|
|
@@ -226,7 +196,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat2x2, T, P>
|
|
struct compute_transpose<detail::tmat2x2, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_null);
|
|
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -240,7 +210,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat2x3, T, P>
|
|
struct compute_transpose<detail::tmat2x3, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat3x2<T, P> call(detail::tmat2x3<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat3x2<T, P> call(detail::tmat2x3<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_null);
|
|
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -256,7 +226,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat2x4, T, P>
|
|
struct compute_transpose<detail::tmat2x4, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat4x2<T, P> call(detail::tmat2x4<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat4x2<T, P> call(detail::tmat2x4<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_null);
|
|
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -274,7 +244,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat3x2, T, P>
|
|
struct compute_transpose<detail::tmat3x2, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat2x3<T, P> call(detail::tmat3x2<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat2x3<T, P> call(detail::tmat3x2<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_null);
|
|
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -290,7 +260,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat3x3, T, P>
|
|
struct compute_transpose<detail::tmat3x3, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_null);
|
|
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -311,7 +281,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat3x4, T, P>
|
|
struct compute_transpose<detail::tmat3x4, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat4x3<T, P> call(detail::tmat3x4<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat4x3<T, P> call(detail::tmat3x4<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_null);
|
|
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -333,7 +303,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat4x2, T, P>
|
|
struct compute_transpose<detail::tmat4x2, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat2x4<T, P> call(detail::tmat4x2<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat2x4<T, P> call(detail::tmat4x2<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_null);
|
|
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -351,7 +321,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat4x3, T, P>
|
|
struct compute_transpose<detail::tmat4x3, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat3x4<T, P> call(detail::tmat4x3<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat3x4<T, P> call(detail::tmat4x3<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_null);
|
|
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -373,7 +343,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_transpose<detail::tmat4x4, T, P>
|
|
struct compute_transpose<detail::tmat4x4, T, P>
|
|
|
{
|
|
{
|
|
|
- static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_null);
|
|
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_null);
|
|
|
result[0][0] = m[0][0];
|
|
result[0][0] = m[0][0];
|
|
@@ -405,7 +375,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_determinant<detail::tmat2x2, T, P>
|
|
struct compute_determinant<detail::tmat2x2, T, P>
|
|
|
{
|
|
{
|
|
|
- static T call(detail::tmat2x2<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static T call(detail::tmat2x2<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
|
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
|
|
}
|
|
}
|
|
@@ -414,7 +384,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_determinant<detail::tmat3x3, T, P>
|
|
struct compute_determinant<detail::tmat3x3, T, P>
|
|
|
{
|
|
{
|
|
|
- static T call(detail::tmat3x3<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static T call(detail::tmat3x3<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
return
|
|
return
|
|
|
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
|
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
|
@@ -426,7 +396,7 @@ namespace detail
|
|
|
template <typename T, precision P>
|
|
template <typename T, precision P>
|
|
|
struct compute_determinant<detail::tmat4x4, T, P>
|
|
struct compute_determinant<detail::tmat4x4, T, P>
|
|
|
{
|
|
{
|
|
|
- static T call(detail::tmat4x4<T, P> const & m)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER static T call(detail::tmat4x4<T, P> const & m)
|
|
|
{
|
|
{
|
|
|
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
|
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
|
|
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
|
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
|
@@ -460,7 +430,7 @@ namespace detail
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
template<template <class, precision> class vecTypeA, template <class, precision> class vecTypeB, typename T, precision P>
|
|
template<template <class, precision> class vecTypeA, template <class, precision> class vecTypeB, typename T, precision P>
|
|
|
- GLM_FUNC_QUALIFIER typename detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::return_type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
|
|
|
|
|
|
+ GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
|
|
{
|
|
{
|
|
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
|
|
return detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::call(c, r);
|
|
return detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::call(c, r);
|