Skip to content

Commit

Permalink
upright_sprite: Fix walk animation in first person (minetest#12194)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Apr 15, 2022
1 parent a5d29fa commit 1d07a36
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/client/content_cao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1d07a36

Please sign in to comment.