aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-01-02 14:32:13 +0100
committerGitHub <noreply@github.com>2022-01-02 14:32:13 +0100
commite030d9cff08636a3c9ed301efb5e35b7642ac166 (patch)
tree7c926ebff4bfebd1626dd74a6ff4cbd8c150c55c
parent8910c7f8ae1862d3d81e6f635789e765ae2e80b9 (diff)
downloadminetest-e030d9cff08636a3c9ed301efb5e35b7642ac166.tar.gz
minetest-e030d9cff08636a3c9ed301efb5e35b7642ac166.tar.bz2
minetest-e030d9cff08636a3c9ed301efb5e35b7642ac166.zip
Recalculate normals before adding mesh to the scene
-rw-r--r--src/client/content_cao.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index a80a3ce4e..db01945eb 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -764,10 +764,6 @@ 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;
@@ -775,6 +771,9 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
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);