From 3aea48aa6fdf682198eb084e1986402a976960a4 Mon Sep 17 00:00:00 2001 From: b84330808 Date: Sat, 21 Nov 2026 18:02:46 +0900 Subject: [PATCH] [rmodels] Use the per-bone normal matrices in CPU skinning again #6191 computes each bone's normal matrix once per update, but #5921 (merged later from an older branch) brought back the per-vertex `MatrixTranspose(MatrixInvert(...))` call when it switched the loop to `Mesh *`. Since then the normal matrices are computed and never used, and every skinned vertex inverts up to four 4x4 matrices again. Use `boneNormalMatrices[boneIndex]` in the vertex loop. The animated vertices and normals are bit-identical. --- src/rmodels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rmodels.c b/src/rmodels.c index 79395d1a0f1a..c364093986d4 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -2587,7 +2587,7 @@ static void UpdateModelAnimationVertexBuffers(Model model) if ((mesh->normals != NULL) && (mesh->animNormals != NULL )) { animNormal = (Vector3){ mesh->normals[vCounter], mesh->normals[vCounter + 1], mesh->normals[vCounter + 2] }; - animNormal = Vector3Transform(animNormal, MatrixTranspose(MatrixInvert(model.boneMatrices[boneIndex]))); + animNormal = Vector3Transform(animNormal, boneNormalMatrices[boneIndex]); mesh->animNormals[vCounter] += animNormal.x*boneWeight; mesh->animNormals[vCounter + 1] += animNormal.y*boneWeight; mesh->animNormals[vCounter + 2] += animNormal.z*boneWeight;