mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-04-28 13:07:59 +03:00
FIXED LIBERTY BOAT ROTATION ISSUES.
This commit is contained in:
parent
4d13e821b5
commit
dc96ffc551
5 changed files with 17 additions and 27 deletions
|
@ -454,7 +454,7 @@ operator*(const CMatrix &m1, const CMatrix &m2)
|
|||
{
|
||||
// TODO: VU0 code
|
||||
CMatrix out;
|
||||
#if defined(RW_DC)
|
||||
#ifdef DC_SH4
|
||||
mat_mult(out, m1, m2);
|
||||
#else
|
||||
out.rx = m1.rx * m2.rx + m1.fx * m2.ry + m1.ux * m2.rz;
|
||||
|
|
|
@ -63,7 +63,6 @@ public:
|
|||
void SetScale(float s);
|
||||
void Scale(float scale)
|
||||
{
|
||||
#ifndef DC_SH4
|
||||
for (int i = 0; i < 3; i++)
|
||||
#ifdef FIX_BUGS // BUGFIX from VC
|
||||
for (int j = 0; j < 3; j++)
|
||||
|
@ -71,11 +70,6 @@ public:
|
|||
for (int j = 0; j < 4; j++)
|
||||
#endif
|
||||
f[i][j] *= scale;
|
||||
#else
|
||||
mat_load(*this);
|
||||
mat_scale(scale, scale, scale);
|
||||
mat_store(*this);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +106,7 @@ CMatrix Invert(const CMatrix &matrix);
|
|||
CMatrix operator*(const CMatrix &m1, const CMatrix &m2);
|
||||
inline CVector MultiplyInverse(const CMatrix &mat, const CVector &vec)
|
||||
{
|
||||
#ifndef DC_SH4
|
||||
#if 1
|
||||
CVector v(vec.x - mat.px, vec.y - mat.py, vec.z - mat.pz);
|
||||
return CVector(
|
||||
mat.rx * v.x + mat.ry * v.y + mat.rz * v.z,
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
}
|
||||
|
||||
const CQuaternion &operator/=(float right) {
|
||||
right = dc::Invert(right);
|
||||
right = dc::Invert<false>(right);
|
||||
x *= right;
|
||||
y *= right;
|
||||
z *= right;
|
||||
|
@ -115,5 +115,6 @@ inline CQuaternion operator*(float left, const CQuaternion &right)
|
|||
|
||||
inline CQuaternion operator/(const CQuaternion &left, float right)
|
||||
{
|
||||
return CQuaternion(left.x / right, left.y / right, left.z / right, left.w / right);
|
||||
right = Invert<false>(right);
|
||||
return CQuaternion(left.x * right, left.y * right, left.z * right, left.w * right);
|
||||
}
|
||||
|
|
|
@ -27,23 +27,17 @@ CrossProduct(const CVector &v1, const CVector &v2)
|
|||
CVector
|
||||
Multiply3x3(const CMatrix &mat, const CVector &vec)
|
||||
{
|
||||
#ifdef DC_SH4
|
||||
register float __x __asm__("fr12") = vec.x;
|
||||
register float __y __asm__("fr13") = vec.y;
|
||||
register float __z __asm__("fr14") = vec.z;
|
||||
register float __w __asm__("fr15") = 0.0f;
|
||||
|
||||
mat_load(reinterpret_cast<matrix_t *>(const_cast<CMatrix *>(&mat)));
|
||||
|
||||
asm volatile( "ftrv xmtrx, fv12\n"
|
||||
: "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w)
|
||||
: "0" (__x), "1" (__y), "2" (__z), "3" (__w) );
|
||||
return { __x, __y, __z };
|
||||
#else
|
||||
#ifndef DC_SH4
|
||||
// TODO: VU0 code
|
||||
return CVector(mat.rx * vec.x + mat.fx * vec.y + mat.ux * vec.z,
|
||||
mat.ry * vec.x + mat.fy * vec.y + mat.uy * vec.z,
|
||||
mat.rz * vec.x + mat.fz * vec.y + mat.uz * vec.z);
|
||||
#else
|
||||
CVector out;
|
||||
mat_load(mat);
|
||||
mat_trans_normal3_nomod(vec.x, vec.y, vec.z,
|
||||
out.x, out.y, out.z);
|
||||
return out;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -58,7 +52,7 @@ Multiply3x3(const CVector &vec, const CMatrix &mat)
|
|||
CVector out;
|
||||
mat_load(mat);
|
||||
mat_transpose();
|
||||
mat_trans_vec3_nomod(vec.x, vec.y, vec.z,
|
||||
mat_trans_normal3_nomod(vec.x, vec.y, vec.z,
|
||||
out.x, out.y, out.z);
|
||||
return out;
|
||||
#endif
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
}
|
||||
|
||||
const CVector &operator/=(float right) {
|
||||
right = Invert(right);
|
||||
right = Invert<false>(right);
|
||||
x *= right;
|
||||
y *= right;
|
||||
z *= right;
|
||||
|
@ -112,7 +112,8 @@ inline CVector operator*(float left, const CVector &right)
|
|||
|
||||
inline CVector operator/(const CVector &left, float right)
|
||||
{
|
||||
return CVector(left.x / right, left.y / right, left.z / right);
|
||||
right = Invert<false>(right);
|
||||
return CVector(left.x * right, left.y * right, left.z * right);
|
||||
}
|
||||
|
||||
__always_inline float
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue