diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/camera.cpp | 2 | ||||
-rw-r--r-- | src/client/hud.cpp | 2 | ||||
-rw-r--r-- | src/client/render/anaglyph.cpp | 2 | ||||
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/guiScene.cpp | 15 | ||||
-rw-r--r-- | src/gui/guiScene.h | 1 |
6 files changed, 19 insertions, 7 deletions
diff --git a/src/client/camera.cpp b/src/client/camera.cpp index 350b685e1..5158d0dd1 100644 --- a/src/client/camera.cpp +++ b/src/client/camera.cpp @@ -664,7 +664,7 @@ 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()->clearZBuffer(); + m_wieldmgr->getVideoDriver()->clearBuffers(video::ECBF_DEPTH); // Draw the wielded node (in a separate scene manager) scene::ICameraSceneNode* cam = m_wieldmgr->getActiveCamera(); diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 46736b325..74c1828e3 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -950,7 +950,7 @@ void drawItemStack( if (imesh && imesh->mesh) { scene::IMesh *mesh = imesh->mesh; - driver->clearZBuffer(); + driver->clearBuffers(video::ECBF_DEPTH); s32 delta = 0; if (rotation_kind < IT_ROT_NONE) { MeshTimeInfo &ti = rotation_time_infos[rotation_kind]; diff --git a/src/client/render/anaglyph.cpp b/src/client/render/anaglyph.cpp index 9ba4464a2..153e77400 100644 --- a/src/client/render/anaglyph.cpp +++ b/src/client/render/anaglyph.cpp @@ -40,7 +40,7 @@ void RenderingCoreAnaglyph::setupMaterial(int color_mask) void RenderingCoreAnaglyph::useEye(bool right) { RenderingCoreStereo::useEye(right); - driver->clearZBuffer(); + driver->clearBuffers(video::ECBF_DEPTH); setupMaterial(right ? video::ECP_GREEN | video::ECP_BLUE : video::ECP_RED); } diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 5aa6dc9ae..5d763a4be 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -2746,7 +2746,7 @@ void GUIFormSpecMenu::parseModel(parserData *data, const std::string &element) { std::vector<std::string> parts = split(element, ';'); - if (parts.size() < 5 || (parts.size() > 9 && + if (parts.size() < 5 || (parts.size() > 10 && m_formspec_version <= FORMSPEC_API_VERSION)) { errorstream << "Invalid model element (" << parts.size() << "): '" << element << "'" << std::endl; @@ -2766,6 +2766,7 @@ void GUIFormSpecMenu::parseModel(parserData *data, const std::string &element) bool inf_rotation = is_yes(parts[6]); bool mousectrl = is_yes(parts[7]) || parts[7].empty(); // default true std::vector<std::string> frame_loop = split(parts[8], ','); + std::string speed = unescape_string(parts[9]); MY_CHECKPOS("model", 0); MY_CHECKGEOM("model", 1); @@ -2825,6 +2826,7 @@ void GUIFormSpecMenu::parseModel(parserData *data, const std::string &element) } e->setFrameLoop(frame_loop_begin, frame_loop_end); + e->setAnimationSpeed(stof(speed)); auto style = getStyleForElement("model", spec.fname); e->setStyles(style); 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() diff --git a/src/gui/guiScene.h b/src/gui/guiScene.h index 08eb7f350..0f5f3a891 100644 --- a/src/gui/guiScene.h +++ b/src/gui/guiScene.h @@ -37,6 +37,7 @@ public: void setTexture(u32 idx, video::ITexture *texture); void setBackgroundColor(const video::SColor &color) noexcept { m_bgcolor = color; }; void setFrameLoop(s32 begin, s32 end); + void setAnimationSpeed(f32 speed); void enableMouseControl(bool enable) noexcept { m_mouse_ctrl = enable; }; void setRotation(v2f rot) noexcept { m_custom_rot = rot; }; void enableContinuousRotation(bool enable) noexcept { m_inf_rot = enable; }; |