1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Refactor matrix4.h

Sets the surprising row-major conventions used here straight.

Renames rotateVect to rotateAndScaleVect:
If the matrix also scales, that is applied as well by the method.
Obsolete rotateVect variants are removed.
The inverseRotateVect method is also renamed accordingly.
Note that this applies the transpose of the product
of the scale and rotation matrices, which inverts just the rotation.
This commit is contained in:
Lars Mueller 2024-05-14 23:48:36 +02:00 committed by sfan5
parent c8f1efebea
commit 7e4919c6ed
11 changed files with 46 additions and 68 deletions

View file

@ -354,8 +354,7 @@ static void transformVertices(std::vector<video::S3DVertex> &vertices, const cor
// Apply scaling, rotation and rotation (in that order) to the position.
transform.transformVect(vertex.Pos);
// For the normal, we do not want to apply the translation.
// TODO note that this also applies scaling; the Irrlicht method is misnamed.
transform.rotateVect(vertex.Normal);
vertex.Normal = transform.rotateAndScaleVect(vertex.Normal);
// Renormalize (length might have been affected by scaling).
vertex.Normal.normalize();
}