diff --git a/src/graphics/material.cpp b/src/graphics/material.cpp index 97f9e7c4b..d73d5ebad 100644 --- a/src/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -740,6 +740,26 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m m->setTexture(7, colorization_mask_tex); } + + if (race_manager->getReverseTrack() && + m_mirror_axis_when_reverse != ' ') + { + if (m_mirrorred_mesh_buffers.find((void*)mb) == m_mirrorred_mesh_buffers.end()) + { + m_mirrorred_mesh_buffers[(void*)mb] = true; + //irr::video::S3DVertex* mbVertices = (video::S3DVertex*)mb->getVertices(); + for (unsigned int i = 0; i < mb->getVertexCount(); i++) + { + core::vector2df &tc = mb->getTCoords(i); + if (m_mirror_axis_when_reverse == 'V') + tc.Y = 1 - tc.Y; + else + tc.X = 1 - tc.X; + } + } + } // reverse track and texture needs mirroring + + switch (m_shader_type) { case SHADERTYPE_SOLID_UNLIT: @@ -986,25 +1006,6 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m } #endif - - if (race_manager->getReverseTrack() && - m_mirror_axis_when_reverse != ' ') - { - if (m_mirrorred_mesh_buffers.find((void*)mb) == m_mirrorred_mesh_buffers.end()) - { - m_mirrorred_mesh_buffers[(void*)mb] = true; - //irr::video::S3DVertex* mbVertices = (video::S3DVertex*)mb->getVertices(); - for (unsigned int i = 0; i < mb->getVertexCount(); i++) - { - core::vector2df &tc = mb->getTCoords(i); - if (m_mirror_axis_when_reverse == 'V') - tc.Y = 1 - tc.Y; - else - tc.X = 1 - tc.X; - } - } - } // reverse track and texture needs mirroring - } // setMaterialProperties //-----------------------------------------------------------------------------