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-20 21:37:11 +0000
committerStijn Buys <ingar@osirion.org>2013-01-20 21:37:11 +0000
commitd4f9da2f3c19511b028da2569d7b6a8d1371e135 (patch)
treee1bba0d8dd3b15169612f865612d3fca6475639a /src/render/renderext.cc
parent4feff2411d1b703a3b93d8a342112bd998b1ffed (diff)
Major overhaul of the particle system back-end, support multiple ejectors per particle system.
Diffstat (limited to 'src/render/renderext.cc')
-rw-r--r--src/render/renderext.cc37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/render/renderext.cc b/src/render/renderext.cc
index 1dc82f8..25e0cab 100644
--- a/src/render/renderext.cc
+++ b/src/render/renderext.cc
@@ -7,6 +7,7 @@
#include <sstream>
#include <iomanip>
+#include "render/particlesystemscript.h"
#include "math/functions.h"
#include "core/application.h"
#include "core/entity.h"
@@ -39,7 +40,7 @@ RenderExt::RenderExt(core::Entity *entity) : core::Extension(core::Extension::Re
if (entity->model()) {
model::Model *model = entity->model();
- for (model::Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) {
+ for (model::Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); ++lit) {
model::Light *light = (*lit);
// load light texture
@@ -48,7 +49,7 @@ RenderExt::RenderExt(core::Entity *entity) : core::Extension(core::Extension::Re
light->set_texture(Textures::load(flarename.str()));
}
- for (model::Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); flit++) {
+ for (model::Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); ++flit) {
model::Flare *flare = (*flit);
// load flare texture
@@ -57,30 +58,12 @@ RenderExt::RenderExt(core::Entity *entity) : core::Extension(core::Extension::Re
flare->set_texture(Textures::load(flarename.str()));
}
- for (model::Model::ParticleSystems::const_iterator pit = model->particles().begin(); pit != model->particles().end(); pit++) {
- // model attachment location tag
- const model::Particles *particlesystem = (*pit);
-
+ for (model::Model::ParticleSystems::const_iterator pit = model->particles().begin(); pit != model->particles().end(); ++pit) {
// load particle systems
- const ParticleScript *script = ParticleScript::load(particlesystem->script());
- while (script) {
- if ( script->type() == render::ParticleScript::Trail) {
- Trail *trail = new Trail(script, entity, particlesystem);
- state_particles.push_back(trail);
-
- } else if (script->type() == render::ParticleScript::Jet) {
- Jet *jet = new Jet(script, entity, particlesystem);
- state_particles.push_back(jet);
-
- } else if (script->type() == render::ParticleScript::Spray) {
- Spray *spray = new Spray(script, entity, particlesystem);
- state_particles.push_back(spray);
-
- } else if (script->type() == render::ParticleScript::Flame) {
- Flame *flame = new Flame(script, entity, particlesystem);
- state_particles.push_back(flame);
- }
- script = script->next();
+ const ParticleSystemScript *script = ParticleSystemScript::load((*pit)->script());
+ if (script) {
+ ParticleSystem *ps = new ParticleSystem(script, entity, (*pit));
+ state_particles.push_back(ps);
}
}
@@ -181,9 +164,9 @@ void RenderExt::frame(float elapsed)
if (!state_explosion) {
// add explosion
- const ParticleScript *script = ParticleScript::load("explosion");
+ const ParticleSystemScript *script = ParticleSystemScript::load("explosion");
if (script) {
- state_explosion = (ParticleSystem *) new Spray(script, entity(), 0);
+ state_explosion = new ParticleSystem(script, entity(), 0);
state_particles.push_back(state_explosion);
}
}