From 5f0a65a07bd9e31ada1e50d915a83790f764f574 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Fri, 16 Dec 2016 20:21:09 -0500 Subject: [PATCH] Fix bug where an animated texture matrix could never be reset to identity. Fixes #2692 --- src/graphics/stk_animated_mesh.cpp | 4 +++- src/graphics/stk_animated_mesh.hpp | 1 + src/graphics/stk_mesh_scene_node.cpp | 4 +++- src/graphics/stk_mesh_scene_node.hpp | 1 + src/states_screens/race_gui_base.cpp | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/graphics/stk_animated_mesh.cpp b/src/graphics/stk_animated_mesh.cpp index 74524dddb..da996c11a 100644 --- a/src/graphics/stk_animated_mesh.cpp +++ b/src/graphics/stk_animated_mesh.cpp @@ -40,6 +40,7 @@ const core::vector3df& scale, RenderInfo* render_info, bool all_parts_colorized) { isGLInitialized = false; isMaterialInitialized = false; + m_got_animated_matrix = false; m_mesh_render_info = render_info; m_all_parts_colorized = all_parts_colorized; #ifdef DEBUG @@ -192,10 +193,11 @@ void STKAnimatedMesh::updateNoGL() { // Test if texture matrix needs to be updated every frame const core::matrix4& mat = getMaterial(i).getTextureMatrix(0); - if (mat.isIdentity()) + if (mat.isIdentity() && !m_got_animated_matrix) continue; else { + m_got_animated_matrix = true; GLmeshes[i].texture_trans.X = mat[8]; GLmeshes[i].texture_trans.Y = mat[9]; } diff --git a/src/graphics/stk_animated_mesh.hpp b/src/graphics/stk_animated_mesh.hpp index f7c10019e..6bc2a3b5b 100644 --- a/src/graphics/stk_animated_mesh.hpp +++ b/src/graphics/stk_animated_mesh.hpp @@ -53,6 +53,7 @@ public: private: RenderInfo* m_mesh_render_info; bool m_all_parts_colorized; + bool m_got_animated_matrix; }; #endif // STKANIMATEDMESH_HPP diff --git a/src/graphics/stk_mesh_scene_node.cpp b/src/graphics/stk_mesh_scene_node.cpp index cf7473a58..749388d29 100644 --- a/src/graphics/stk_mesh_scene_node.cpp +++ b/src/graphics/stk_mesh_scene_node.cpp @@ -61,6 +61,7 @@ STKMeshSceneNode::STKMeshSceneNode(irr::scene::IMesh* mesh, ISceneNode* parent, update_each_frame = false; m_frame_for_mesh = frame_for_mesh; isGlow = false; + m_got_animated_matrix = false; m_debug_name = debug_name; @@ -244,10 +245,11 @@ void STKMeshSceneNode::updateNoGL() { // Test if texture matrix needs to be updated every frame const core::matrix4& mat = getMaterial(i).getTextureMatrix(0); - if (mat.isIdentity()) + if (mat.isIdentity() && !m_got_animated_matrix) continue; else { + m_got_animated_matrix = true; GLmeshes[i].texture_trans.X = mat[8]; GLmeshes[i].texture_trans.Y = mat[9]; } diff --git a/src/graphics/stk_mesh_scene_node.hpp b/src/graphics/stk_mesh_scene_node.hpp index c75e52d00..5275217f3 100644 --- a/src/graphics/stk_mesh_scene_node.hpp +++ b/src/graphics/stk_mesh_scene_node.hpp @@ -30,6 +30,7 @@ class STKMeshSceneNode : public irr::scene::CMeshSceneNode, public STKMeshCommon protected: PtrVector m_static_render_info; int m_frame_for_mesh; + bool m_got_animated_matrix; std::vector GLmeshes; core::matrix4 ModelViewProjectionMatrix; core::vector3df windDir; diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 800d68290..3320508f6 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -146,6 +146,8 @@ void RaceGUIBase::reset() m_referee_height = 10.0f; m_referee->attachToSceneNode(); + m_referee->selectReadySetGo(0); // set red color + m_plunger_move_time = 0; m_plunger_offset = core::vector2di(0,0); m_plunger_speed = core::vector2df(0,0);