Fixed non power of two matrix products
This commit is contained in:
parent
c3e4881833
commit
dd272c52ee
@ -88,7 +88,7 @@ namespace detail
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 ||
|
||||
(std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer, "'sign' only accept signed inputs"));
|
||||
(std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer), "'sign' only accept signed inputs");
|
||||
|
||||
genFIType result;
|
||||
if(x > genFIType(0))
|
||||
|
@ -45,7 +45,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c[1] * r[0];
|
||||
m[1][0] = c[0] * r[1];
|
||||
@ -59,7 +59,7 @@ namespace detail
|
||||
{
|
||||
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)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
@ -71,7 +71,7 @@ namespace detail
|
||||
{
|
||||
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)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
@ -83,7 +83,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
@ -99,7 +99,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c.y * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
@ -115,7 +115,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
@ -133,7 +133,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c.y * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
@ -151,7 +151,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
@ -173,7 +173,7 @@ namespace detail
|
||||
{
|
||||
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][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
@ -429,7 +429,7 @@ namespace detail
|
||||
return result;
|
||||
}
|
||||
|
||||
template<template <class, precision> class vecTypeA, template <class, precision> class vecTypeB, typename T, precision P>
|
||||
template<typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
|
||||
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");
|
||||
|
@ -1049,7 +1049,7 @@ GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float con
|
||||
Result[2] = TmpC4;
|
||||
Result[3] = _mm_set_ps(1, 0, 0, 0);
|
||||
|
||||
//detail::tmat4x4<valType> Result(detail::tmat4x4<valType>::null);
|
||||
//detail::tmat4x4<valType> Result(detail::tmat4x4<valType>::_null);
|
||||
//Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
|
||||
//Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
|
||||
//Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
|
||||
|
@ -514,7 +514,7 @@ namespace detail
|
||||
T SrcB20 = m2[2][0];
|
||||
T SrcB21 = m2[2][1];
|
||||
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::null);
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::_null);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01;
|
||||
|
@ -508,7 +508,7 @@ namespace detail
|
||||
T SrcB30 = m2[3][0];
|
||||
T SrcB31 = m2[3][1];
|
||||
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::null);
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::_null);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01;
|
||||
|
@ -538,7 +538,7 @@ namespace detail
|
||||
const T SrcB11 = m2[1][1];
|
||||
const T SrcB12 = m2[1][2];
|
||||
|
||||
tmat2x2<T, P> Result(tmat2x2<T, P>::null);
|
||||
tmat2x2<T, P> Result(tmat2x2<T, P>::_null);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
|
||||
Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
|
||||
|
@ -553,7 +553,7 @@ namespace detail
|
||||
const T SrcB31 = m2[3][1];
|
||||
const T SrcB32 = m2[3][2];
|
||||
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::null);
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::_null);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02;
|
||||
|
@ -589,7 +589,7 @@ namespace detail
|
||||
T const SrcB12 = m2[1][2];
|
||||
T const SrcB13 = m2[1][3];
|
||||
|
||||
tmat2x2<T, P> Result(tmat2x2<T, P>::null);
|
||||
tmat2x2<T, P> Result(tmat2x2<T, P>::_null);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
|
||||
Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13;
|
||||
|
@ -583,7 +583,7 @@ namespace detail
|
||||
T const SrcB22 = m2[2][2];
|
||||
T const SrcB23 = m2[2][3];
|
||||
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::null);
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::_null);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02 + SrcA32 * SrcB03;
|
||||
|
@ -49,7 +49,7 @@ namespace glm
|
||||
|
||||
detail::tvec3<T, P> temp = (T(1) - c) * axis;
|
||||
|
||||
detail::tmat4x4<T, P> Rotate(detail::tmat4x4<T, P>::null);
|
||||
detail::tmat4x4<T, P> Rotate(detail::tmat4x4<T, P>::_null);
|
||||
Rotate[0][0] = c + temp[0] * axis[0];
|
||||
Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2];
|
||||
Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1];
|
||||
@ -62,7 +62,7 @@ namespace glm
|
||||
Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0];
|
||||
Rotate[2][2] = c + temp[2] * axis[2];
|
||||
|
||||
detail::tmat4x4<T, P> Result(detail::tmat4x4<T, P>::null);
|
||||
detail::tmat4x4<T, P> Result(detail::tmat4x4<T, P>::_null);
|
||||
Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
|
||||
Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
|
||||
Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
|
||||
|
@ -40,6 +40,7 @@ http://glm.g-truc.net/glm.pdf
|
||||
GLM 0.9.5.2: 2014-0X-XX
|
||||
--------------------------------------------------------------------------------
|
||||
- Fixed warnings with the Android NDK 9c
|
||||
- Fixed non power of two matrix products
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.1: 2014-01-11
|
||||
|
@ -80,7 +80,7 @@ int test_matrixCompMult()
|
||||
|
||||
int test_outerProduct()
|
||||
{
|
||||
|
||||
glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user