From 2425624c9dbe3f58359dda68365ceccb15dbf88f Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 20 Jul 2006 14:52:39 +0000 Subject: [PATCH] we can now perform an update on a single particle system --- .../particlesystem/particleSystemManager.cxx | 26 +++++++++++++++++++ .../particlesystem/particleSystemManager.h | 1 + 2 files changed, 27 insertions(+) diff --git a/panda/src/particlesystem/particleSystemManager.cxx b/panda/src/particlesystem/particleSystemManager.cxx index 0200c7559c..e30ca3b77d 100644 --- a/panda/src/particlesystem/particleSystemManager.cxx +++ b/panda/src/particlesystem/particleSystemManager.cxx @@ -127,6 +127,32 @@ do_particles(float dt) { // cout << "ParticleSystemManager::doparticles exiting." << endl; } +//////////////////////////////////////////////////////////////////// +// Function : do_particles +// Access : public +// Description : does an update and render for each ps in the list. +// this is probably the one you want to use. Rendering +// is the expensive operation, and particles REALLY +// should at least be updated every frame, so nth_frame +// stepping applies only to rendering. +//////////////////////////////////////////////////////////////////// +void ParticleSystemManager:: +do_particles(float dt, ParticleSystem *ps, bool do_render) { + if (ps->get_active_system_flag() == true) { + ps->update(dt); + // Handle age: + if (ps->get_system_grows_older_flag() == true) { + float age = ps->get_system_age() + dt; + ps->set_system_age(age); + } + + // handle render + if (do_render) { + ps->render(); + } + } +} + //////////////////////////////////////////////////////////////////// // Function : output // Access : Public diff --git a/panda/src/particlesystem/particleSystemManager.h b/panda/src/particlesystem/particleSystemManager.h index abbae0a946..407a5e7887 100644 --- a/panda/src/particlesystem/particleSystemManager.h +++ b/panda/src/particlesystem/particleSystemManager.h @@ -44,6 +44,7 @@ PUBLISHED: INLINE void clear(); void do_particles(float dt); + void do_particles(float dt, ParticleSystem * ps, bool do_render = true); virtual void output(ostream &out) const; virtual void write_ps_list(ostream &out, int indent=0) const;