From 784e5c24d505aab001ae398cd53b039baed59f1f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 12 Jan 2009 20:25:28 +0000 Subject: radius key for fx_particles, overrules the script value --- src/render/particles.cc | 71 ++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 33 deletions(-) (limited to 'src/render/particles.cc') 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; -- cgit v1.2.3