aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2022-04-15 18:55:08 +0200
committerGitHub <noreply@github.com>2022-04-15 18:55:08 +0200
commit1d07a365528e3b947a03baba9ef986af2ecd23d1 (patch)
tree52611d0a6efdf550ae016d76305e8f646cc641d8
parenta5d29fa1d4bc6849d7a6529edc522accac8219d2 (diff)
downloadminetest-1d07a365528e3b947a03baba9ef986af2ecd23d1.tar.gz
minetest-1d07a365528e3b947a03baba9ef986af2ecd23d1.tar.bz2
minetest-1d07a365528e3b947a03baba9ef986af2ecd23d1.zip
upright_sprite: Fix walk animation in first person (#12194)
-rw-r--r--src/client/content_cao.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index 19569d4b6..3c31d4a36 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -1974,20 +1974,17 @@ void GenericCAO::updateMeshCulling()
const bool hidden = m_client->getCamera()->getCameraMode() == CAMERA_MODE_FIRST;
- if (m_meshnode && m_prop.visual == "upright_sprite") {
- u32 buffers = m_meshnode->getMesh()->getMeshBufferCount();
- for (u32 i = 0; i < buffers; i++) {
- video::SMaterial &mat = m_meshnode->getMesh()->getMeshBuffer(i)->getMaterial();
- // upright sprite has no backface culling
- mat.setFlag(video::EMF_FRONT_FACE_CULLING, hidden);
- }
- return;
- }
-
scene::ISceneNode *node = getSceneNode();
+
if (!node)
return;
+ if (m_prop.visual == "upright_sprite") {
+ // upright sprite has no backface culling
+ node->setMaterialFlag(video::EMF_FRONT_FACE_CULLING, hidden);
+ return;
+ }
+
if (hidden) {
// Hide the mesh by culling both front and
// back faces. Serious hackyness but it works for our