Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-07-18 22:07:46 +0000
committerStijn Buys <ingar@osirion.org>2008-07-18 22:07:46 +0000
commitc3d90b226bdd83592d08704aa918f155f4c757e2 (patch)
treedd9ef9b9ebec66c707744de05ad39fd8918452fa /src/render/dust.cc
parent2698d8cd1d28cd9649fcfe35a3397d52b28f1b34 (diff)
reset spacedust on ship change, audio distance model changes (should fix win32 ui sound dissapearing in the distance)
Diffstat (limited to 'src/render/dust.cc')
-rw-r--r--src/render/dust.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/render/dust.cc b/src/render/dust.cc
index b9e53a5..37dd217 100644
--- a/src/render/dust.cc
+++ b/src/render/dust.cc
@@ -17,11 +17,11 @@ namespace render
core::Cvar *r_dust;
core::Cvar *r_dustsize;
-const float MAXDUSTDISTANCE = 8.0f;
-const float MINDUSTDISTANCE = 6.0f;
const float LOWSPEEDLIMIT = 5.0f;
const float TRAILLENGHT = 0.25f;
-const float MAXDUSTALPHA = 0.8f;
+const float DUSTMAXALPHA = 0.8f;
+const float DUSTDISTANCE = 8.0f;
+
float *dust;
size_t dustsize;
@@ -46,6 +46,12 @@ void Dust::shutdown()
}
}
+void Dust::reset()
+{
+ delete dust;
+ dust = 0;
+}
+
void Dust::draw()
{
if (!r_dust->value()) {
@@ -83,9 +89,9 @@ void Dust::draw()
dust = new float[dustsize*3];
for (size_t i = 0; i < dustsize; i++) {
- dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * MINDUSTDISTANCE;
- dust[i*3+1] = core::localcontrol()->location().y + (math::randomf(2) - 1) * MINDUSTDISTANCE;
- dust[i*3+2] = core::localcontrol()->location().z + (math::randomf(2) - 1) * MINDUSTDISTANCE;
+ 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());
}
}
@@ -96,7 +102,7 @@ void Dust::draw()
if (core::localcontrol()->speed() < LOWSPEEDLIMIT) {
color.a = core::localcontrol()->speed() / LOWSPEEDLIMIT;
}
- color.a *= MAXDUSTALPHA;
+ color.a *= DUSTMAXALPHA;
gl::color(color);
gl::begin(gl::Lines);
@@ -107,19 +113,11 @@ void Dust::draw()
for (size_t j = 0; j < 3; j++)
v[j] -= dust[i*3+j];
- if (v.lengthsquared() > (core::localcontrol()->radius() + MAXDUSTDISTANCE)*(core::localcontrol()->radius() + MAXDUSTDISTANCE)) {
-/*
- v.assign(core::localcontrol()->state()->location());
- v += core::localcontrol()->state()->axis().forward() * (core::localcontrol()->radius() + math::randomf(MAXDUSTDISTANCE));
- v += core::localcontrol()->state()->axis().left() * (math::randomf(2*MINDUSTDISTANCE) - MINDUSTDISTANCE);
- v += core::localcontrol()->state()->axis().up() * (math::randomf(2*MINDUSTDISTANCE) - MINDUSTDISTANCE);
+ if (v.lengthsquared() > (core::localcontrol()->radius() + DUSTDISTANCE)*(core::localcontrol()->radius() + DUSTDISTANCE)) {
- for (size_t j = 0; j < 3; j++)
- dust[i*3+j] = v[j];
-*/
- dust[i*3] = core::localcontrol()->location().x + (math::randomf(2) - 1) * (MAXDUSTDISTANCE + core::localcontrol()->radius());
- dust[i*3+1] = core::localcontrol()->location().y + (math::randomf(2) - 1) * (MAXDUSTDISTANCE + core::localcontrol()->radius());
- dust[i*3+2] = core::localcontrol()->location().z + (math::randomf(2) - 1) * (MAXDUSTDISTANCE + core::localcontrol()->radius());
+ 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());
}
glVertex3fv(dust+3*i);