From 6ae26b0fabe80dfbc4e3e50309a94ff1149343ea Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 24 Sep 2013 19:15:17 +0000 Subject: Apply particle system scales, do not render thrust-enabled particle systems on impulse speed. --- src/render/particlesystem.cc | 59 +++++++++++++++++++++++++------------------- src/render/particlesystem.h | 2 +- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/render/particlesystem.cc b/src/render/particlesystem.cc index 87cb7bc..7cf8f2f 100644 --- a/src/render/particlesystem.cc +++ b/src/render/particlesystem.cc @@ -108,7 +108,16 @@ ParticleSystem::ParticleSystem(const ParticleSystemScript *script, const core::E ejector->get_radius_vec() *= entity->radius(); ejector->set_acceleration(ejector->acceleration() * entity->radius()); } - } + + if (modelclass && (modelclass->scale() != 1.0f)) { + ejector->get_speed_vec() *= modelclass->scale(); + ejector->get_tailspeed_vec() *= modelclass->scale(); + ejector->get_radius_vec() *= modelclass->scale(); + ejector->set_acceleration(ejector->acceleration() * modelclass->scale()); + } + + } + } } @@ -148,33 +157,33 @@ void ParticleSystem::draw(const float seconds) if (entity()) { bool ejector_active = true; + + if (ejector->impulse() || ejector->thrust()) { + ejector_active = false; + } if (entity()->type() == core::Entity::Controlable) { const core::EntityControlable *controlable = static_cast(entity()); - - if (ejector->impulse() || ejector->thrust()) { - ejector_active = false; - - switch (controlable->state()) { - case core::Entity::Impulse: - case core::Entity::ImpulseInitiate: - if (ejector->impulse() || ejector->thrust()) { + + switch (controlable->state()) { + case core::Entity::Impulse: + case core::Entity::ImpulseInitiate: + if (ejector->impulse()) { + ejector_active = true; + } + break; + + case core::Entity::Normal: + if (ejector->thrust()) { + if (controlable->thrust() > 0.0f) { ejector_active = true; } - break; - - case core::Entity::Normal: - if (ejector->thrust()) { - if (controlable->thrust() > 0.0f) { - ejector_active = true; - } - } - break; - - default: - ejector_active = false; - break; - } + } + break; + + default: + ejector_active = false; + break; } } else if (entity()->type() == core::Entity::Dynamic) { @@ -183,10 +192,8 @@ void ParticleSystem::draw(const float seconds) if (dynamic->state() == core::Entity::NoPower) { ejector_active = false; } - } - + } ejector->enable(ejector_active); - } (*it)->frame(seconds, current_location, current_axis * ejector->axis()); diff --git a/src/render/particlesystem.h b/src/render/particlesystem.h index b3edce4..05bbe7d 100644 --- a/src/render/particlesystem.h +++ b/src/render/particlesystem.h @@ -50,7 +50,7 @@ public: } /** - * @brief axisof the particlesystem + * @brief axis of the particlesystem * */ inline const math::Axis &axis() const { return particlesystem_axis; -- cgit v1.2.3