Fix bug where an animated texture matrix could never be reset to identity. Fixes #2692

This commit is contained in:
auria.mg 2016-12-16 20:21:09 -05:00
parent 4ee6f6315f
commit 5f0a65a07b
5 changed files with 10 additions and 2 deletions

View File

@ -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];
}

View File

@ -53,6 +53,7 @@ public:
private:
RenderInfo* m_mesh_render_info;
bool m_all_parts_colorized;
bool m_got_animated_matrix;
};
#endif // STKANIMATEDMESH_HPP

View File

@ -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];
}

View File

@ -30,6 +30,7 @@ class STKMeshSceneNode : public irr::scene::CMeshSceneNode, public STKMeshCommon
protected:
PtrVector<RenderInfo> m_static_render_info;
int m_frame_for_mesh;
bool m_got_animated_matrix;
std::vector<GLMesh> GLmeshes;
core::matrix4 ModelViewProjectionMatrix;
core::vector3df windDir;

View File

@ -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);