From e9f09d2624e62343d94fc199ddd5a544b52ce1ba Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 30 Nov 2008 08:57:44 +0000 Subject: adjusted dust size, radius and alpha --- src/render/dust.cc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/render') diff --git a/src/render/dust.cc b/src/render/dust.cc index 4b74ef9..cb48137 100644 --- a/src/render/dust.cc +++ b/src/render/dust.cc @@ -31,7 +31,7 @@ void Dust::init() r_dust = core::Cvar::get("r_dust", "1", core::Cvar::Archive); r_dust->set_info("[bool] render dust"); - r_dustsize = core::Cvar::get("r_dustsize", "128", core::Cvar::Archive); + r_dustsize = core::Cvar::get("r_dustsize", "1024", core::Cvar::Archive); r_dustsize->set_info("[int] number of dust particles"); dust = 0; @@ -91,9 +91,7 @@ void Dust::draw(math::Color const &dustcolor) return; } - alpha = math::max(core::localcontrol()->movement()*0.5f, core::localcontrol()->speed()); - math::clamp(alpha, 0.0f, 1.0f); - alpha = 0.2f + alpha * 0.7f; + if (!dust) { con_debug << " generating dust..." << std::endl; @@ -101,19 +99,24 @@ void Dust::draw(math::Color const &dustcolor) dust = (float *) malloc(sizeof(float) * dustsize* 3); for (size_t i = 0; i < dustsize; i++) { - dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius()); - dust[i*3+1] = core::localcontrol()->location().y + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius()); - dust[i*3+2] = core::localcontrol()->location().z + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius()); + dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius() * 2.0f); + dust[i*3+1] = core::localcontrol()->location().y + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius() * 2.0f); + dust[i*3+2] = core::localcontrol()->location().z + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius() * 2.0f); } } - math::Color color(dustcolor); - color.a = alpha; - traillength = math::max(math::max(core::localcontrol()->movement(), core::localcontrol()->speed()), 0.5f); + + traillength = math::max(math::max(core::localcontrol()->movement(), core::localcontrol()->speed() * 0.5f), 0.5f); traillength = traillength * TRAILLENGHT / LOWSPEEDLIMIT; - gl::color(color); + math::Color color(dustcolor); + alpha = math::max(core::localcontrol()->movement(), core::localcontrol()->speed() * 0.5f); + math::clamp(alpha, 0.0f, 1.0f); + alpha = 0.1f + alpha * 0.5f; + color.a = alpha; + gl::begin(gl::Lines); + gl::color(color); math::Vector3f v; for (size_t i = 0; i < dustsize; i++) { @@ -123,9 +126,9 @@ void Dust::draw(math::Color const &dustcolor) v[j] = dust[i*3+j] - core::localcontrol()->axis().forward()[j] * traillength; } - if (dsquare > (core::localcontrol()->radius() + DUSTDISTANCE)*(core::localcontrol()->radius() + DUSTDISTANCE)) { + if (dsquare > (2.0f * core::localcontrol()->radius() + DUSTDISTANCE)*(2.0f * core::localcontrol()->radius() + DUSTDISTANCE)) { for (size_t j = 0; j < 3; j++) { - dust[i*3+j] = core::localcontrol()->location()[j] + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius()); + dust[i*3+j] = core::localcontrol()->location()[j] + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius() * 2.0f); v[j] = dust[i*3+j] - core::localcontrol()->axis().forward()[j] * traillength; } } -- cgit v1.2.3