mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 09:49:14 +00:00
GRIM: EMI: Use new math vector and matrix multiplication
This commit is contained in:
parent
dcce1f670d
commit
9ae57ad4c1
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user