aboutsummaryrefslogtreecommitdiff
path: root/src/gui/guiScene.cpp
diff options
context:
space:
mode:
authorJean-Patrick Guerrero <kilbith@users.noreply.github.com>2021-03-16 23:28:16 +0100
committerGitHub <noreply@github.com>2021-03-16 23:28:16 +0100
commit285ba74723695c4b51192dac0e1e17c5d8f880db (patch)
tree5b6147a093f28d01d7a6b9da40770e2c434b1641 /src/gui/guiScene.cpp
parent66b5c086644ac18845731d6f3556d9e7cde4ee28 (diff)
downloadminetest-285ba74723695c4b51192dac0e1e17c5d8f880db.tar.gz
minetest-285ba74723695c4b51192dac0e1e17c5d8f880db.tar.bz2
minetest-285ba74723695c4b51192dac0e1e17c5d8f880db.zip
GUIScene: Clear depth buffer + replace deprecated clearZBuffer calls
Diffstat (limited to 'src/gui/guiScene.cpp')
-rw-r--r--src/gui/guiScene.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gui/guiScene.cpp b/src/gui/guiScene.cpp
index 5f4c50b91..f0cfbec5e 100644
--- a/src/gui/guiScene.cpp
+++ b/src/gui/guiScene.cpp
@@ -34,9 +34,6 @@ GUIScene::GUIScene(gui::IGUIEnvironment *env, scene::ISceneManager *smgr,
m_cam = m_smgr->addCameraSceneNode(0, v3f(0.f, 0.f, -100.f), v3f(0.f));
m_cam->setFOV(30.f * core::DEGTORAD);
- scene::ILightSceneNode *light = m_smgr->addLightSceneNode(m_cam);
- light->setRadius(1000.f);
-
m_smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
}
@@ -60,6 +57,7 @@ scene::IAnimatedMeshSceneNode *GUIScene::setMesh(scene::IAnimatedMesh *mesh)
m_mesh = m_smgr->addAnimatedMeshSceneNode(mesh);
m_mesh->setPosition(-m_mesh->getBoundingBox().getCenter());
m_mesh->animateJoints();
+
return m_mesh;
}
@@ -73,10 +71,13 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
material.setFlag(video::EMF_FOG_ENABLE, true);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
material.setFlag(video::EMF_BACK_FACE_CULLING, false);
+ material.setFlag(video::EMF_ZWRITE_ENABLE, true);
}
void GUIScene::draw()
{
+ m_driver->clearBuffers(video::ECBF_DEPTH);
+
// Control rotation speed based on time
u64 new_time = porting::getTimeMs();
u64 dtime_ms = 0;
@@ -161,6 +162,14 @@ void GUIScene::setFrameLoop(s32 begin, s32 end)
m_mesh->setFrameLoop(begin, end);
}
+/**
+ * Sets the animation speed (FPS) for the mesh
+ */
+void GUIScene::setAnimationSpeed(f32 speed)
+{
+ m_mesh->setAnimationSpeed(speed);
+}
+
/* Camera control functions */
inline void GUIScene::calcOptimalDistance()