GRIM: EMI: Use new math vector and matrix multiplication

This commit is contained in:
Paweł Kołodziejski 2021-12-26 18:45:59 +01:00
parent dcce1f670d
commit 9ae57ad4c1
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7
4 changed files with 7 additions and 7 deletions

View File

@ -69,8 +69,8 @@ void EMIHead::lookAt(bool entering, const Math::Vector3d &point, float rate, con
Math::Vector3d modelFront(0, 0, 1);
Math::Vector3d modelUp(0, 1, 0);
joint->_absMatrix.inverseRotate(&modelFront);
joint->_absMatrix.inverseRotate(&modelUp);
modelFront = modelFront * joint->_absMatrix.getRotation();
modelUp = modelUp * joint->_absMatrix.getRotation();
// Generate a world-space look at matrix.
Math::Matrix4 lookAtTM;

View File

@ -315,8 +315,8 @@ bool EMIEngine::compareActor(const Actor *x, const Actor *y) {
Math::Vector3d xp(x->getWorldPos() - setup->_pos);
Math::Vector3d yp(y->getWorldPos() - setup->_pos);
camRot.inverseRotate(&xp);
camRot.inverseRotate(&yp);
xp = xp * camRot.getRotation();
yp = yp * camRot.getRotation();
if (fabs(xp.z() - yp.z()) < 0.001f) {
return x->getId() < y->getId();

View File

@ -249,12 +249,12 @@ void EMIModel::prepareForRender() {
Math::Vector3d vert = _vertices[boneVert];
vert -= bindPose.getPosition();
bindPose.inverseRotate(&vert);
vert = vert * bindPose.getRotation();
jointMatrix.transform(&vert, true);
_drawVertices[boneVert] += vert * _boneInfos[i]._weight;
Math::Vector3d normal = _normals[boneVert];
bindPose.inverseRotate(&normal);
normal = normal * bindPose.getRotation();
jointMatrix.transform(&normal, false);
_drawNormals[boneVert] += normal * _boneInfos[i]._weight;
}

View File

@ -94,7 +94,7 @@ void SoundTrack::updatePosition() {
Math::Matrix4 worldRot = setup->_rot;
Math::Vector3d relPos = (_pos - setup->_pos);
Math::Vector3d p(relPos);
worldRot.inverseRotate(&p);
p = p * worldRot.getRotation();
float angle = atan2(p.x(), p.z());
float pan = sin(angle);
_balance = (int)(pan * 127.0f);