summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-11-10 21:36:58 +0100
committersfan5 <sfan5@live.de>2020-11-12 21:08:26 +0100
commitb504a1aa4bdc56676b4b1c398ebfe98d336f8f6e (patch)
tree5069e573e93500728158aed9041781e8c544c03f /src/client
parentc441baa91b71c48a369178df287eeb91e15ea7d1 (diff)
downloadminetest-b504a1aa4bdc56676b4b1c398ebfe98d336f8f6e.tar.gz
minetest-b504a1aa4bdc56676b4b1c398ebfe98d336f8f6e.tar.bz2
minetest-b504a1aa4bdc56676b4b1c398ebfe98d336f8f6e.zip
Fix player sprite visibility in first person
closes #10525
Diffstat (limited to 'src/client')
-rw-r--r--src/client/content_cao.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index c52bc62c5..c645900aa 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -1919,13 +1919,23 @@ void GenericCAO::updateMeshCulling()
if (!m_is_local_player)
return;
- // Grab the active player scene node so we know there's
- // at least a mesh to occlude from the camera.
+ 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;
+ }
+
irr::scene::ISceneNode *node = getSceneNode();
if (!node)
return;
- if (m_client->getCamera()->getCameraMode() == CAMERA_MODE_FIRST) {
+ if (hidden) {
// Hide the mesh by culling both front and
// back faces. Serious hackyness but it works for our
// purposes. This also preserves the skeletal armature.