Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/particleejector.cc')
-rw-r--r--src/render/particleejector.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/render/particleejector.cc b/src/render/particleejector.cc
index 091743d..c697e8f 100644
--- a/src/render/particleejector.cc
+++ b/src/render/particleejector.cc
@@ -49,6 +49,9 @@ void ParticleEjector::frame(const float seconds, const math::Vector3f & ps_locat
// add new particles
if (ejector_enabled) {
+ // FIXME currently, only one particle per frame is ejected
+ // particle ejection rate should be independent of framerate, but we run into issues
+ // of the particle systems not rendered
if (ejector_last_eject + interval() <= now) {
math::Vector3f particle_location;
math::Axis particle_axis;
@@ -72,6 +75,7 @@ void ParticleEjector::frame(const float seconds, const math::Vector3f & ps_locat
Particle *particle = new Particle(particle_location, particle_axis.forward() * speed(), now);
particle->set_radius(radius_vec()[0]);
particle->set_alpha(alpha_vec()[0]);
+ particle->set_rotation(math::randomf(2.0f * M_PI));
particles().push_front(particle);
ejector_last_eject = now;
@@ -131,19 +135,19 @@ void ParticleEjector::draw(const math::Vector3f & ps_location, const math::Axis
}
-/* ---- class ParticleEjectorSpray --------------------------------- */
+/* ---- class ParticleEjectorSprite --------------------------------- */
-ParticleEjectorSpray::ParticleEjectorSpray(const ParticleEjectorScript &script) : ParticleEjector(script)
+ParticleEjectorSprite::ParticleEjectorSprite(const ParticleEjectorScript &script) : ParticleEjector(script)
{
}
-ParticleEjectorSpray::~ParticleEjectorSpray()
+ParticleEjectorSprite::~ParticleEjectorSprite()
{
}
-void ParticleEjectorSpray::draw(const math::Vector3f & ps_location, const math::Axis & ps_axis)
+void ParticleEjectorSprite::draw(const math::Vector3f & ps_location, const math::Axis & ps_axis)
{
math::Vector3f quad[4];
Textures::bind(texture());
@@ -159,6 +163,9 @@ void ParticleEjectorSpray::draw(const math::Vector3f & ps_location, const math::
for (Particles::iterator it = particles().begin(); it != particles().end(); it++) {
Particle *particle = (*it);
+ math::Axis rotation;
+ rotation.rotate(Camera::axis().forward(), particle->rotation());
+
math::Vector3f l(attached() ? ps_location + ps_axis * particle->location() : particle->location());
const float r = particle->radius();
@@ -166,13 +173,13 @@ void ParticleEjectorSpray::draw(const math::Vector3f & ps_location, const math::
gl::color(c);
glTexCoord2f(0, 1);
- gl::vertex(l + quad[0] * r);
+ gl::vertex(l + rotation * quad[0] * r);
glTexCoord2f(0, 0);
- gl::vertex(l + quad[1] * r);
+ gl::vertex(l + rotation * quad[1] * r);
glTexCoord2f(1, 0);
- gl::vertex(l + quad[2] * r);
+ gl::vertex(l + rotation * quad[2] * r);
glTexCoord2f(1, 1);
- gl::vertex(l + quad[3] * r);
+ gl::vertex(l + rotation * quad[3] * r);
Stats::quads++;
}
gl::end();