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-01-21 18:37:59 +0000
committerStijn Buys <ingar@osirion.org>2013-01-21 18:37:59 +0000
commit266d0d2cf6648509650bdd490c8e9c64be75b92e (patch)
treedf5fdb640ed09edcf044efdc8784b18a5881a513 /src/render/particlesystem.cc
parentd4f9da2f3c19511b028da2569d7b6a8d1371e135 (diff)
Added attached property to draw particle systems in entity space instead of world space,
corrected several bugs in the initial particle system implementation, added impulse key to have particle systems react on impulse drive.
Diffstat (limited to 'src/render/particlesystem.cc')
-rw-r--r--src/render/particlesystem.cc39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/render/particlesystem.cc b/src/render/particlesystem.cc
index ff9c720..920d77c 100644
--- a/src/render/particlesystem.cc
+++ b/src/render/particlesystem.cc
@@ -4,6 +4,7 @@
the terms of the GNU General Public License version 2
*/
+#include "render/gl.h"
#include "render/particlesystem.h"
namespace render {
@@ -121,23 +122,45 @@ void ParticleSystem::draw(const float seconds)
math::Axis current_axis(entity() ? entity()->axis() * axis() : axis());
for (Ejectors::iterator it = ejectors().begin(); it != ejectors().end(); ++it) {
-
+
+ ParticleEjector *ejector = (*it);
+
if (entity()) {
bool ejector_active = true;
+
if (entity()->type() == core::Entity::Controlable) {
+ const core::EntityControlable *controlable = static_cast<const core::EntityControlable *>(entity());
- if ((*it)->thrust()) {
- // thrust activated
- const core::EntityControlable *controlable = static_cast<const core::EntityControlable *>(entity());
- if ( controlable->thrust() == 0.0f ) {
- ejector_active = false;
+ if (ejector->impulse() || ejector->thrust()) {
+ ejector_active = false;
+
+ switch (controlable->state()) {
+ case core::Entity::Impulse:
+ case core::Entity::ImpulseInitiate:
+ if (ejector->impulse() || ejector->thrust()) {
+ 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;
}
- (*it)->enable(ejector_active);
+ ejector->enable(ejector_active);
}
}
}
- (*it)->frame(seconds, current_location, current_axis);
+ (*it)->frame(seconds, current_location, current_axis * ejector->axis());
+
}
}