Panda3D
 All Classes Functions Variables Enumerations
particleSystemManager.h
00001 // Filename: particleSystemManager.h
00002 // Created by:  charles (28Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PARTICLESYSTEMMANAGER_H
00016 #define PARTICLESYSTEMMANAGER_H
00017 
00018 #include "pandabase.h"
00019 #include "plist.h"
00020 #include "particleSystem.h"
00021 #include "pStatCollector.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : ParticleSystemManager
00025 // Description : Manages a set of individual ParticleSystem objects,
00026 //               so that each individual one doesn't have to be
00027 //               updated and rendered every frame
00028 //    See Also : particleSystemManager.cxx
00029 ////////////////////////////////////////////////////////////////////
00030 class EXPCL_PANDAPHYSICS ParticleSystemManager {
00031 PUBLISHED:
00032   ParticleSystemManager(int every_nth_frame = 1);
00033   virtual ~ParticleSystemManager();
00034 
00035   INLINE void set_frame_stepping(int every_nth_frame);
00036   INLINE int get_frame_stepping() const;
00037 
00038   INLINE void attach_particlesystem(ParticleSystem *ps);
00039   void remove_particlesystem(ParticleSystem *ps);
00040   INLINE void clear();
00041 
00042   void do_particles(PN_stdfloat dt);
00043   void do_particles(PN_stdfloat dt, ParticleSystem * ps, bool do_render = true);
00044 
00045   virtual void output(ostream &out) const;
00046   virtual void write_ps_list(ostream &out, int indent=0) const;
00047   virtual void write(ostream &out, int indent=0) const;
00048 
00049 private:
00050   plist< PT(ParticleSystem) > _ps_list;
00051 
00052   int _nth_frame;
00053   int _cur_frame;
00054 
00055   static PStatCollector _do_particles_collector;
00056 };
00057 
00058 #include "particleSystemManager.I"
00059 
00060 #endif // PARTICLESYSTEMMANAGER_H
 All Classes Functions Variables Enumerations