Skip to content

Commit

Permalink
Recalculate normals before adding mesh to the scene
Browse files Browse the repository at this point in the history
  • Loading branch information
x2048 committed Jan 2, 2022
1 parent 8910c7f commit e030d9c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/client/content_cao.cpp
Expand Up @@ -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);

Expand Down

0 comments on commit e030d9c

Please sign in to comment.