diff options
author | Stijn Buys <ingar@osirion.org> | 2013-09-24 19:15:17 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-09-24 19:15:17 +0000 |
commit | 6ae26b0fabe80dfbc4e3e50309a94ff1149343ea (patch) | |
tree | f656eedbc58b380728c1918ba12f2a20852a7536 | |
parent | 11b9c77a453c946bfa4963d8339bc748c9251f83 (diff) |
Apply particle system scales,
do not render thrust-enabled particle systems on impulse speed.
-rw-r--r-- | src/render/particlesystem.cc | 59 | ||||
-rw-r--r-- | 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<const core::EntityControlable *>(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; |