From cc0a4412a4ac7f1f78ef7e644a0c06c6dd6dd129 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 26 Aug 2008 17:42:30 +0000 Subject: improved dust rendering --- src/render/dust.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/render/dust.cc') diff --git a/src/render/dust.cc b/src/render/dust.cc index 25df9f9..ad337b3 100644 --- a/src/render/dust.cc +++ b/src/render/dust.cc @@ -91,8 +91,9 @@ void Dust::draw() return; } - if (! core::localcontrol()->speed()) - return; + alpha = math::max(core::localcontrol()->movement(), core::localcontrol()->speed()); + math::clamp(alpha, 0.0f, 1.0f); + alpha = 0.2f + alpha * 0.8f; if (!dust) { con_debug << " generating dust..." << std::endl; @@ -105,17 +106,10 @@ void Dust::draw() dust[i*3+2] = core::localcontrol()->location().z + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius()); } } - - math::Color color(1.0f, 1.0f); - alpha = core::localcontrol()->speed() / LOWSPEEDLIMIT; - if (alpha > DUSTMAXALPHA) - alpha = DUSTMAXALPHA; - color.a = alpha; - - traillength = core::localcontrol()->speed() / LOWSPEEDLIMIT; - /*if (traillength > 1) - traillength = 1.0f; */ - traillength *= TRAILLENGHT; + + math::Color color(1.0f, alpha); + traillength = math::max(math::max(core::localcontrol()->movement(), core::localcontrol()->speed()), 0.5f); + traillength = traillength * TRAILLENGHT / LOWSPEEDLIMIT; gl::color(color); gl::begin(gl::Lines); -- cgit v1.2.3