upright_sprite: Fix walk animation in first person (#12194)

This commit is contained in:
SmallJoker 2022-04-15 18:55:08 +02:00 committed by GitHub
parent a5d29fa1d4
commit 1d07a36552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 10 deletions

View File

@ -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