From ad4b28abd9a545bebaf4dd77cb6a13863ace9843 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 26 Jul 2008 15:44:17 +0000 Subject: make statefull engine trails --- src/render/draw.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/render') diff --git a/src/render/draw.cc b/src/render/draw.cc index 01cddf3..7866dbe 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -607,7 +607,7 @@ void draw_pass_model_fragments() } /* draw model lights and engines */ -void draw_pass_model_fx() +void draw_pass_model_fx(float elapsed) { float t; @@ -724,8 +724,12 @@ void draw_pass_model_fx() float u = static_cast(entity)->thrust(); if (u > 0) { - float fraction = (core::application()->time() + entity->state()->fuzz()) * 4.0f * u; - fraction = fraction - floorf(fraction); + float fraction = entity->state()->state_engine_trail_offset; + fraction += elapsed * 4.0f * u; + + while (fraction - 1.0f > 0) + fraction -= 1.0f; + entity->state()->state_engine_trail_offset = fraction; for(model::Model::Engines::iterator eit = entity->model()->engines().begin(); eit != entity->model()->engines().end(); eit++) { @@ -960,7 +964,7 @@ void draw(float seconds) Dust::draw(); // draw spacedust - draw_pass_model_fx(); // draw entity lights and engines + draw_pass_model_fx(seconds); // draw entity lights and engines gl::enable(GL_LIGHTING); gl::enable(GL_RESCALE_NORMAL); -- cgit v1.2.3