Skip to content
Permalink
Browse files
Recalculate normals before adding mesh to the scene
  • Loading branch information
x2048 committed Jan 2, 2022
1 parent 8910c7f commit e030d9cff08636a3c9ed301efb5e35b7642ac166
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/client/content_cao.cpp
@@ -764,17 +764,16 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
grabMatrixNode();
scene::IAnimatedMesh *mesh = m_client->getMesh(m_prop.mesh, true);
if (mesh) {
m_animated_meshnode = m_smgr->addAnimatedMeshSceneNode(mesh, m_matrixnode);
m_animated_meshnode->grab();
mesh->drop(); // The scene node took hold of it

if (!checkMeshNormals(mesh)) {
infostream << "GenericCAO: recalculating normals for mesh "
<< m_prop.mesh << std::endl;
m_smgr->getMeshManipulator()->
recalculateNormals(mesh, true, false);
}

m_animated_meshnode = m_smgr->addAnimatedMeshSceneNode(mesh, m_matrixnode);
m_animated_meshnode->grab();
mesh->drop(); // The scene node took hold of it
m_animated_meshnode->animateJoints(); // Needed for some animations
m_animated_meshnode->setScale(m_prop.visual_size);

0 comments on commit e030d9c

Please sign in to comment.