cAudioManager::TranslateEntity cleanup
This commit is contained in:
parent
c3c6c51003
commit
fcfdaa9534
@ -9109,18 +9109,9 @@ cAudioManager::Terminate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::TranslateEntity(CVector *v1, CVector *v2) const
|
cAudioManager::TranslateEntity(CVector *in, CVector *out) const
|
||||||
{
|
{
|
||||||
const RwMatrix &cM = TheCamera.GetMatrix().m_matrix;
|
*out = MultiplyInverse(TheCamera.GetMatrix(), *in);
|
||||||
const CVector &cV = TheCamera.GetPosition();
|
|
||||||
|
|
||||||
float a = v1->z - cV.z;
|
|
||||||
float b = v1->y - cV.y;
|
|
||||||
float c = v1->x - cV.x;
|
|
||||||
|
|
||||||
v2->x = cM.right.y * b + cM.right.x * c + cM.right.z * a;
|
|
||||||
v2->y = cM.up.y * b + cM.up.x * c + cM.up.z * a;
|
|
||||||
v2->z = cM.at.y * b + cM.at.x * c + cM.at.z * a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -249,7 +249,15 @@ public:
|
|||||||
CMatrix &Invert(const CMatrix &src, CMatrix &dst);
|
CMatrix &Invert(const CMatrix &src, CMatrix &dst);
|
||||||
CVector operator*(const CMatrix &mat, const CVector &vec);
|
CVector operator*(const CMatrix &mat, const CVector &vec);
|
||||||
CMatrix operator*(const CMatrix &m1, const CMatrix &m2);
|
CMatrix operator*(const CMatrix &m1, const CMatrix &m2);
|
||||||
CVector MultiplyInverse(const CMatrix &mat, const CVector &vec);
|
inline CVector MultiplyInverse(const CMatrix &mat, const CVector &vec)
|
||||||
|
{
|
||||||
|
CVector v(vec.x - mat.m_matrix.pos.x, vec.y - mat.m_matrix.pos.y, vec.z - mat.m_matrix.pos.z);
|
||||||
|
return CVector(
|
||||||
|
mat.m_matrix.right.x * v.x + mat.m_matrix.right.y * v.y + mat.m_matrix.right.z * v.z,
|
||||||
|
mat.m_matrix.up.x * v.x + mat.m_matrix.up.y * v.y + mat.m_matrix.up.z * v.z,
|
||||||
|
mat.m_matrix.at.x * v.x + mat.m_matrix.at.y * v.y + mat.m_matrix.at.z * v.z);
|
||||||
|
}
|
||||||
|
|
||||||
const CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
const CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
|
||||||
const CVector Multiply3x3(const CVector &vec, const CMatrix &mat);
|
const CVector Multiply3x3(const CVector &vec, const CMatrix &mat);
|
||||||
|
|
||||||
|
@ -126,16 +126,6 @@ operator*(const CMatrix &m1, const CMatrix &m2)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVector
|
|
||||||
MultiplyInverse(const CMatrix &mat, const CVector &vec)
|
|
||||||
{
|
|
||||||
CVector v(vec.x - mat.m_matrix.pos.x, vec.y - mat.m_matrix.pos.y, vec.z - mat.m_matrix.pos.z);
|
|
||||||
return CVector(
|
|
||||||
mat.m_matrix.right.x * v.x + mat.m_matrix.right.y * v.y + mat.m_matrix.right.z * v.z,
|
|
||||||
mat.m_matrix.up.x * v.x + mat.m_matrix.up.y * v.y + mat.m_matrix.up.z * v.z,
|
|
||||||
mat.m_matrix.at.x * v.x + mat.m_matrix.at.y * v.y + mat.m_matrix.at.z * v.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CVector
|
const CVector
|
||||||
Multiply3x3(const CMatrix &mat, const CVector &vec)
|
Multiply3x3(const CMatrix &mat, const CVector &vec)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user