Skip to content

Commit b504a1a

Browse files
committedNov 12, 2020
Fix player sprite visibility in first person
closes #10525
1 parent c441baa commit b504a1a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
 

Diff for: ‎src/client/content_cao.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -1919,13 +1919,23 @@ void GenericCAO::updateMeshCulling()
19191919
if (!m_is_local_player)
19201920
return;
19211921

1922-
// Grab the active player scene node so we know there's
1923-
// at least a mesh to occlude from the camera.
1922+
const bool hidden = m_client->getCamera()->getCameraMode() == CAMERA_MODE_FIRST;
1923+
1924+
if (m_meshnode && m_prop.visual == "upright_sprite") {
1925+
u32 buffers = m_meshnode->getMesh()->getMeshBufferCount();
1926+
for (u32 i = 0; i < buffers; i++) {
1927+
video::SMaterial &mat = m_meshnode->getMesh()->getMeshBuffer(i)->getMaterial();
1928+
// upright sprite has no backface culling
1929+
mat.setFlag(video::EMF_FRONT_FACE_CULLING, hidden);
1930+
}
1931+
return;
1932+
}
1933+
19241934
irr::scene::ISceneNode *node = getSceneNode();
19251935
if (!node)
19261936
return;
19271937

1928-
if (m_client->getCamera()->getCameraMode() == CAMERA_MODE_FIRST) {
1938+
if (hidden) {
19291939
// Hide the mesh by culling both front and
19301940
// back faces. Serious hackyness but it works for our
19311941
// purposes. This also preserves the skeletal armature.

0 commit comments

Comments
 (0)
Please sign in to comment.