mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
Merge pull request #582 from tomaz82/fix_transform4x4f
Fix Transform4x4f
This commit is contained in:
commit
e6660475e3
|
@ -8,21 +8,21 @@ const Transform4x4f Transform4x4f::operator*(const Transform4x4f& _other) const
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
tm[ 0] * om[ 0] + tm[ 1] * om[ 4] + tm[ 2] * om[ 8],
|
tm[ 0] * om[ 0] + tm[ 4] * om[ 1] + tm[ 8] * om[ 2],
|
||||||
tm[ 0] * om[ 1] + tm[ 1] * om[ 5] + tm[ 2] * om[ 9],
|
tm[ 1] * om[ 0] + tm[ 5] * om[ 1] + tm[ 9] * om[ 2],
|
||||||
tm[ 0] * om[ 2] + tm[ 1] * om[ 6] + tm[ 2] * om[10],
|
tm[ 2] * om[ 0] + tm[ 6] * om[ 1] + tm[10] * om[ 2],
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tm[ 4] * om[ 0] + tm[ 5] * om[ 4] + tm[ 6] * om[ 8],
|
tm[ 0] * om[ 4] + tm[ 4] * om[ 5] + tm[ 8] * om[ 6],
|
||||||
tm[ 4] * om[ 1] + tm[ 5] * om[ 5] + tm[ 6] * om[ 9],
|
tm[ 1] * om[ 4] + tm[ 5] * om[ 5] + tm[ 9] * om[ 6],
|
||||||
tm[ 4] * om[ 2] + tm[ 5] * om[ 6] + tm[ 6] * om[10],
|
tm[ 2] * om[ 4] + tm[ 6] * om[ 5] + tm[10] * om[ 6],
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tm[ 8] * om[ 0] + tm[ 9] * om[ 4] + tm[10] * om[ 8],
|
tm[ 0] * om[ 8] + tm[ 4] * om[ 9] + tm[ 8] * om[10],
|
||||||
tm[ 8] * om[ 1] + tm[ 9] * om[ 5] + tm[10] * om[ 9],
|
tm[ 1] * om[ 8] + tm[ 5] * om[ 9] + tm[ 9] * om[10],
|
||||||
tm[ 8] * om[ 2] + tm[ 9] * om[ 6] + tm[10] * om[10],
|
tm[ 2] * om[ 8] + tm[ 6] * om[ 9] + tm[10] * om[10],
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -121,13 +121,13 @@ Transform4x4f& Transform4x4f::scale(const Vector3f& _scale)
|
||||||
const float* sv = (float*)&_scale;
|
const float* sv = (float*)&_scale;
|
||||||
|
|
||||||
tm[ 0] *= sv[0];
|
tm[ 0] *= sv[0];
|
||||||
tm[ 1] *= sv[1];
|
tm[ 1] *= sv[0];
|
||||||
tm[ 2] *= sv[2];
|
tm[ 2] *= sv[0];
|
||||||
tm[ 4] *= sv[0];
|
tm[ 4] *= sv[1];
|
||||||
tm[ 5] *= sv[1];
|
tm[ 5] *= sv[1];
|
||||||
tm[ 6] *= sv[2];
|
tm[ 6] *= sv[1];
|
||||||
tm[ 8] *= sv[0];
|
tm[ 8] *= sv[2];
|
||||||
tm[ 9] *= sv[1];
|
tm[ 9] *= sv[2];
|
||||||
tm[10] *= sv[2];
|
tm[10] *= sv[2];
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -159,15 +159,15 @@ Transform4x4f& Transform4x4f::rotate(const float _angle, const Vector3f& _axis)
|
||||||
tz * x - sy,
|
tz * x - sy,
|
||||||
tz * y + sx,
|
tz * y + sx,
|
||||||
tz * z + c };
|
tz * z + c };
|
||||||
const float temp[9] = { tm[ 0] * r[0] + tm[ 1] * r[3] + tm[ 2] * r[6],
|
const float temp[9] = { tm[ 0] * r[0] + tm[ 4] * r[1] + tm[ 8] * r[2],
|
||||||
tm[ 0] * r[1] + tm[ 1] * r[4] + tm[ 2] * r[7],
|
tm[ 1] * r[0] + tm[ 5] * r[1] + tm[ 9] * r[2],
|
||||||
tm[ 0] * r[2] + tm[ 1] * r[5] + tm[ 2] * r[8],
|
tm[ 2] * r[0] + tm[ 6] * r[1] + tm[10] * r[2],
|
||||||
tm[ 4] * r[0] + tm[ 5] * r[3] + tm[ 6] * r[6],
|
tm[ 0] * r[3] + tm[ 4] * r[4] + tm[ 8] * r[5],
|
||||||
tm[ 4] * r[1] + tm[ 5] * r[4] + tm[ 6] * r[7],
|
tm[ 1] * r[3] + tm[ 5] * r[4] + tm[ 9] * r[5],
|
||||||
tm[ 4] * r[2] + tm[ 5] * r[5] + tm[ 6] * r[8],
|
tm[ 2] * r[3] + tm[ 6] * r[4] + tm[ 0] * r[5],
|
||||||
tm[ 8] * r[0] + tm[ 9] * r[3] + tm[10] * r[6],
|
tm[ 0] * r[6] + tm[ 4] * r[7] + tm[ 8] * r[8],
|
||||||
tm[ 8] * r[1] + tm[ 9] * r[4] + tm[10] * r[7],
|
tm[ 1] * r[6] + tm[ 5] * r[7] + tm[ 9] * r[8],
|
||||||
tm[ 8] * r[2] + tm[ 9] * r[5] + tm[10] * r[8] };
|
tm[ 2] * r[6] + tm[ 6] * r[7] + tm[10] * r[8] };
|
||||||
|
|
||||||
tm[ 0] = temp[0];
|
tm[ 0] = temp[0];
|
||||||
tm[ 1] = temp[1];
|
tm[ 1] = temp[1];
|
||||||
|
@ -188,17 +188,17 @@ Transform4x4f& Transform4x4f::rotateX(const float _angle)
|
||||||
float* tm = (float*)this;
|
float* tm = (float*)this;
|
||||||
const float s = Math::sinf(-_angle);
|
const float s = Math::sinf(-_angle);
|
||||||
const float c = Math::cosf(-_angle);
|
const float c = Math::cosf(-_angle);
|
||||||
const float temp[6] = { tm[ 1] * c + tm[ 2] * s,
|
const float temp[6] = { tm[ 4] * c + tm[ 8] * -s,
|
||||||
tm[ 1] * -s + tm[ 2] * c,
|
tm[ 5] * c + tm[ 9] * -c,
|
||||||
tm[ 5] * c + tm[ 6] * s,
|
tm[ 6] * c + tm[10] * -s,
|
||||||
tm[ 5] * -s + tm[ 6] * c,
|
tm[ 4] * s + tm[ 8] * c,
|
||||||
tm[ 9] * c + tm[10] * s,
|
tm[ 5] * s + tm[ 9] * c,
|
||||||
tm[ 9] * -s + tm[10] * c };
|
tm[ 6] * s + tm[10] * c };
|
||||||
|
|
||||||
tm[ 1] = temp[0];
|
tm[ 4] = temp[0];
|
||||||
tm[ 2] = temp[1];
|
tm[ 5] = temp[1];
|
||||||
tm[ 5] = temp[2];
|
tm[ 6] = temp[2];
|
||||||
tm[ 6] = temp[3];
|
tm[ 8] = temp[3];
|
||||||
tm[ 9] = temp[4];
|
tm[ 9] = temp[4];
|
||||||
tm[10] = temp[5];
|
tm[10] = temp[5];
|
||||||
|
|
||||||
|
@ -211,18 +211,18 @@ Transform4x4f& Transform4x4f::rotateY(const float _angle)
|
||||||
float* tm = (float*)this;
|
float* tm = (float*)this;
|
||||||
const float s = Math::sinf(-_angle);
|
const float s = Math::sinf(-_angle);
|
||||||
const float c = Math::cosf(-_angle);
|
const float c = Math::cosf(-_angle);
|
||||||
const float temp[6] = { tm[ 0] * c + tm[ 2] * -s,
|
const float temp[6] = { tm[ 0] * c + tm[ 8] * s,
|
||||||
tm[ 0] * s + tm[ 2] * c,
|
tm[ 1] * c + tm[ 9] * s,
|
||||||
tm[ 4] * c + tm[ 6] * -s,
|
tm[ 2] * c + tm[10] * s,
|
||||||
tm[ 4] * s + tm[ 6] * c,
|
tm[ 0] * -s + tm[ 8] * c,
|
||||||
tm[ 8] * c + tm[10] * -s,
|
tm[ 1] * -s + tm[ 9] * c,
|
||||||
tm[ 8] * s + tm[10] * c };
|
tm[ 2] * -s + tm[10] * c };
|
||||||
|
|
||||||
tm[ 0] = temp[0];
|
tm[ 0] = temp[0];
|
||||||
tm[ 2] = temp[1];
|
tm[ 1] = temp[1];
|
||||||
tm[ 4] = temp[2];
|
tm[ 2] = temp[2];
|
||||||
tm[ 6] = temp[3];
|
tm[ 8] = temp[3];
|
||||||
tm[ 8] = temp[4];
|
tm[ 9] = temp[4];
|
||||||
tm[10] = temp[5];
|
tm[10] = temp[5];
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -234,19 +234,19 @@ Transform4x4f& Transform4x4f::rotateZ(const float _angle)
|
||||||
float* tm = (float*)this;
|
float* tm = (float*)this;
|
||||||
const float s = Math::sinf(-_angle);
|
const float s = Math::sinf(-_angle);
|
||||||
const float c = Math::cosf(-_angle);
|
const float c = Math::cosf(-_angle);
|
||||||
const float temp[6] = { tm[ 0] * c + tm[ 1] * s,
|
const float temp[6] = { tm[ 0] * c + tm[ 4] * -s,
|
||||||
tm[ 0] * -s + tm[ 1] * c,
|
tm[ 1] * c + tm[ 5] * -s,
|
||||||
tm[ 4] * c + tm[ 5] * s,
|
tm[ 2] * c + tm[ 6] * -s,
|
||||||
tm[ 4] * -s + tm[ 5] * c,
|
tm[ 0] * s + tm[ 4] * c,
|
||||||
tm[ 8] * c + tm[ 9] * s,
|
tm[ 1] * s + tm[ 5] * c,
|
||||||
tm[ 8] * -s + tm[ 9] * c };
|
tm[ 2] * s + tm[ 6] * c };
|
||||||
|
|
||||||
tm[ 0] = temp[0];
|
tm[ 0] = temp[0];
|
||||||
tm[ 1] = temp[1];
|
tm[ 1] = temp[1];
|
||||||
tm[ 4] = temp[2];
|
tm[ 2] = temp[2];
|
||||||
tm[ 5] = temp[3];
|
tm[ 4] = temp[3];
|
||||||
tm[ 8] = temp[4];
|
tm[ 5] = temp[4];
|
||||||
tm[ 9] = temp[5];
|
tm[ 6] = temp[5];
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue