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-27 09:41:25 +0000
committerStijn Buys <ingar@osirion.org>2013-01-27 09:41:25 +0000
commitf096586dac6e6c0e083e23afafc99731bf2ba642 (patch)
tree2414c2ac1c115696e449c8006e70fae1ebb0d679 /src/render/particleejector.cc
parent52a0d3571f56187d8801793b36a5511966e1d9a0 (diff)
Added support for particles minimum/maximum speed,
renamed [ejector] sections in particle ini files, resolved the issue where only 1 particle per frame could be ejected.
Diffstat (limited to 'src/render/particleejector.cc')
-rw-r--r--src/render/particleejector.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/render/particleejector.cc b/src/render/particleejector.cc
index 92b8d8f..9ee9cc8 100644
--- a/src/render/particleejector.cc
+++ b/src/render/particleejector.cc
@@ -47,12 +47,11 @@ void ParticleEjector::frame(const float seconds, const math::Vector3f & ps_locat
it = particles().rbegin();
}
+ ejector_last_eject += (unsigned long) (1000.0f * seconds);
+
// 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) {
+ while (ejector_last_eject > interval()) {
math::Vector3f particle_location;
math::Axis particle_axis;
if (!attached()) {
@@ -75,9 +74,9 @@ void ParticleEjector::frame(const float seconds, const math::Vector3f & ps_locat
particle->set_radius(radius_vec()[0]);
particle->set_alpha(alpha_vec()[0]);
particle->set_rotation(math::randomf(2.0f * M_PI));
- particle->set_speed(speed());
+ particle->set_speed(math::randomf(speed_vec()[0], speed_vec()[1]));
particles().push_front(particle);
- ejector_last_eject = now;
+ ejector_last_eject -= interval();
}
} else {
ejector_last_eject = 0;