aboutsummaryrefslogtreecommitdiff
path: root/src/client/camera.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2023-03-19 21:31:15 +0100
committerGitHub <noreply@github.com>2023-03-19 21:31:15 +0100
commit6cd2eea48781dd7318b6ea78c5cdea4a3ee5db02 (patch)
treea5d0da127c7b4637adefde7a80e72580dff68484 /src/client/camera.cpp
parent09342c0811bb8d035e012a79dce714a6b63722e4 (diff)
downloadminetest-6cd2eea48781dd7318b6ea78c5cdea4a3ee5db02.tar.xz
Move drawing of wield tool into a dedicated step of the pipeline (#13338)
Diffstat (limited to 'src/client/camera.cpp')
-rw-r--r--src/client/camera.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/client/camera.cpp b/src/client/camera.cpp
index ba621d15b..13ca7aa5c 100644
--- a/src/client/camera.cpp
+++ b/src/client/camera.cpp
@@ -635,11 +635,14 @@ void Camera::wield(const ItemStack &item)
void Camera::drawWieldedTool(irr::core::matrix4* translation)
{
+ // Clear Z buffer so that the wielded tool stays in front of world geometry
+ m_wieldmgr->getVideoDriver()->clearBuffers(video::ECBF_DEPTH);
+
// Draw the wielded node (in a separate scene manager)
scene::ICameraSceneNode* cam = m_wieldmgr->getActiveCamera();
cam->setAspectRatio(m_cameranode->getAspectRatio());
cam->setFOV(72.0*M_PI/180.0);
- cam->setNearValue(40); // give wield tool smaller z-depth than the world in most cases.
+ cam->setNearValue(10);
cam->setFarValue(1000);
if (translation != NULL)
{