Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/render/dust.cc29
1 files changed, 16 insertions, 13 deletions
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;
}
}