diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-12 20:25:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-12 20:25:28 +0000 |
commit | 784e5c24d505aab001ae398cd53b039baed59f1f (patch) | |
tree | 5af692e35848cacff27c8ad529c4042b26b2d020 /src/render | |
parent | c55945a1e81f5e49ef706cb3d0d37f17dbb84709 (diff) |
radius key for fx_particles, overrules the script value
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/particles.cc | 71 | ||||
-rw-r--r-- | src/render/particles.h | 4 |
2 files changed, 40 insertions, 35 deletions
diff --git a/src/render/particles.cc b/src/render/particles.cc index 71ec26b..07a8dc1 100644 --- a/src/render/particles.cc +++ b/src/render/particles.cc @@ -188,8 +188,13 @@ ParticleSystem::ParticleSystem(ParticleScript *script, core::Entity *entity, mod if (particlesystem_script) { particlesystem_texture = Textures::load("textures/" + particlesystem_script->texture()); + + // map entity radius overrules script value + if (modelclass->radius()) + particlesystem_radius = modelclass->radius(); + else + particlesystem_radius = particlesystem_script->radius(); - radius = particlesystem_script->radius(); color.assign(particlesystem_script->color()); } @@ -310,7 +315,7 @@ void Jet::draw(float elapsed) { } f *= f; - float radius = particlesystem_script->radius() * f; + float radius = particlesystem_radius * f; color.a = f * particlesystem_script->alpha(); gl::color(color); @@ -369,7 +374,7 @@ void Spray::draw(float elapsed) { } f *= f; - float radius = particlesystem_script->radius() * f; + float radius = particlesystem_radius * f; color.a = f * particlesystem_script->alpha(); gl::color(color); @@ -437,9 +442,9 @@ void Trail::draw(float elapsed) { gl::color(color); glTexCoord2f(0,1); - gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_radius * fp); glTexCoord2f(1,1); - gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_radius * fp); Stats::quads++; } @@ -462,17 +467,17 @@ void Trail::draw(float elapsed) { gl::color(color); glTexCoord2f(1,0); - gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_radius * fp); glTexCoord2f(0,0); - gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_radius * fp); color.a = f * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,1); - gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_radius * f); glTexCoord2f(1,1); - gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_radius * f); Stats::quads++; @@ -533,9 +538,9 @@ void Flame::draw(float elapsed) { color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,tp); - gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_radius * fp); glTexCoord2f(1,tp); - gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_radius * fp); Stats::quads++; color.a = 0; @@ -548,9 +553,9 @@ void Flame::draw(float elapsed) { color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,tp); - gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_radius * fp); glTexCoord2f(1,tp); - gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_radius * fp); Stats::quads++; color.a = 0; @@ -563,9 +568,9 @@ void Flame::draw(float elapsed) { color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,tp); - gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_radius * fp); glTexCoord2f(1,tp); - gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_radius * fp); Stats::quads++; color.a = 0; @@ -578,9 +583,9 @@ void Flame::draw(float elapsed) { color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,tp); - gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_radius * fp); glTexCoord2f(1,tp); - gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_radius * fp); Stats::quads++; } @@ -601,61 +606,61 @@ void Flame::draw(float elapsed) { color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(1,tp); - gl::vertex((*first)->location() + (*first)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() + (*first)->axis().up() * particlesystem_radius * fp); glTexCoord2f(0,tp); - gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_radius * fp); color.a = f * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,t); - gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_radius * f); glTexCoord2f(1,t); - gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_radius * f); Stats::quads++; color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(1,tp); - gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_radius * fp); glTexCoord2f(0,tp); - gl::vertex((*first)->location() + (*first)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() + (*first)->axis().up() * particlesystem_radius * fp); color.a = f * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,t); - gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() + (*next)->axis().up() * particlesystem_radius * f); glTexCoord2f(1,t); - gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_radius * f); Stats::quads++; color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(1,tp); - gl::vertex((*first)->location() - (*first)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() - (*first)->axis().up() * particlesystem_radius * fp); glTexCoord2f(0,tp); - gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() + (*first)->axis().left() * particlesystem_radius * fp); color.a = f * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,t); - gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() + (*next)->axis().left() * particlesystem_radius * f); glTexCoord2f(1,t); - gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_radius * f); Stats::quads++; color.a = fp * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(1,tp); - gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() - (*first)->axis().left() * particlesystem_radius * fp); glTexCoord2f(0,tp); - gl::vertex((*first)->location() - (*first)->axis().up() * particlesystem_script->radius() * fp); + gl::vertex((*first)->location() - (*first)->axis().up() * particlesystem_radius * fp); color.a = f * particlesystem_script->alpha(); gl::color(color); glTexCoord2f(0,t); - gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() - (*next)->axis().up() * particlesystem_radius * f); glTexCoord2f(1,t); - gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_script->radius() * f); + gl::vertex((*next)->location() - (*next)->axis().left() * particlesystem_radius * f); Stats::quads++; first = next; diff --git a/src/render/particles.h b/src/render/particles.h index 88789a5..096833c 100644 --- a/src/render/particles.h +++ b/src/render/particles.h @@ -111,7 +111,7 @@ public: /// axis of the particle system within the entity inline const math::Axis &axis() const { return particlesystem_axis; } - + virtual void draw(float elapsed); void set_timeout(float timeout); @@ -141,7 +141,7 @@ protected: math::Vector3f ejector_location; bool ejector_active; - float radius; + float particlesystem_radius; float now; math::Color color; |