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>2013-09-24 19:15:17 +0000
committerStijn Buys <ingar@osirion.org>2013-09-24 19:15:17 +0000
commit6ae26b0fabe80dfbc4e3e50309a94ff1149343ea (patch)
treef656eedbc58b380728c1918ba12f2a20852a7536
parent11b9c77a453c946bfa4963d8339bc748c9251f83 (diff)
Apply particle system scales,
do not render thrust-enabled particle systems on impulse speed.
-rw-r--r--src/render/particlesystem.cc59
-rw-r--r--src/render/particlesystem.h2
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;