From be4654c63b80862352961160446155238eee3ef5 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Fri, 19 Oct 2012 22:43:18 +0200 Subject: Fix track mapping and sphere particle position --- src/graphics/engine/engine.cpp | 11 +++++------ src/graphics/engine/particle.cpp | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/graphics/engine') diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 90c00f5..6d07b62 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -1260,10 +1260,7 @@ bool CEngine::TrackTextureMapping(int objRank, const Material& mat, int state, std::vector& vs = triangles->vertices; while (pos < 0.0f) - pos += 1000000.0f; // never negative! - - // TODO: might still be buggy as track animation seems to be choppy - // but the code should work exactly as in original + pos += 1.0f; // never negative! Math::Vector current; @@ -1310,12 +1307,14 @@ bool CEngine::TrackTextureMapping(int objRank, const Material& mat, int state, float pps = ps + pos; float ppe = pe + pos; - float offset = static_cast( static_cast(pps) ); + int offset = static_cast(pps); ppe -= offset; + pps -= offset; for (int i = 0; i < 3; i++) { - vs[tBase + is[i]].texCoord.x = ((ppe * tl) + ts) / tt; + vs[tBase + is[i]].texCoord.x = ((pps * tl) + ts) / tt; + vs[tBase + ie[i]].texCoord.x = ((ppe * tl) + ts) / tt; } } diff --git a/src/graphics/engine/particle.cpp b/src/graphics/engine/particle.cpp index acc40df..388c189 100644 --- a/src/graphics/engine/particle.cpp +++ b/src/graphics/engine/particle.cpp @@ -3214,7 +3214,7 @@ void CParticle::DrawParticleSphere(int i) angle.z = m_particle[i].angle*0.7f; Math::Matrix rot; Math::LoadRotationZXYMatrix(rot, angle); - mat = Math::MultiplyMatrices(rot, mat); + mat = Math::MultiplyMatrices(mat, rot); } m_device->SetTransform(TRANSFORM_WORLD, mat); -- cgit v1.2.3-1-g7c22