Fix updating of vertex normals for animated meshes (#77)

Updates cached positions and normals of animated vertices
from the mesh. Useful when using meshManipulator to update
the normals.
This commit is contained in:
x2048
2021-11-16 12:30:31 +01:00
committed by GitHub
parent 81bae5b717
commit 39cad3e618
4 changed files with 28 additions and 0 deletions

View File

@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CMeshManipulator.h"
#include "ISkinnedMesh.h"
#include "SMesh.h"
#include "CMeshBuffer.h"
#include "SAnimatedMesh.h"
@ -149,6 +150,12 @@ void CMeshManipulator::recalculateNormals(scene::IMesh* mesh, bool smooth, bool
const u32 bcount = mesh->getMeshBufferCount();
for ( u32 b=0; b<bcount; ++b)
recalculateNormals(mesh->getMeshBuffer(b), smooth, angleWeighted);
if (mesh->getMeshType() == EAMT_SKINNED)
{
ISkinnedMesh *smesh = (ISkinnedMesh *) mesh;
smesh->refreshJointCache();
}
}