24PStatCollector ParticleSystemManager::_do_particles_collector(
"App:Particles:Do Particles");
31 _nth_frame(every_nth_frame), _cur_frame(0) {
49 found = find(_ps_list.begin(), _ps_list.end(), ptps);
51 if (found == _ps_list.end())
54 _ps_list.erase(found);
70 bool render_due =
false;
74 if (_cur_frame >= _nth_frame) {
79 cur = _ps_list.begin();
84 while (cur != _ps_list.end()) {
88 if (cur_ps->get_active_system_flag() ==
true) {
94 if (cur_ps->get_system_grows_older_flag() ==
true) {
95 PN_stdfloat age = cur_ps->get_system_age() + dt;
96 cur_ps->set_system_age(age);
99 if (age >= cur_ps->get_system_lifespan()) {
103 _ps_list.erase(kill);
114 if (cur != _ps_list.end()) {
129 if (ps->get_active_system_flag() ==
true) {
132 if (ps->get_system_grows_older_flag() ==
true) {
133 PN_stdfloat age = ps->get_system_age() + dt;
134 ps->set_system_age(age);
148output(std::ostream &out)
const {
150 out<<
"ParticleSystemManager";
161 out<<
""<<
"_ps_list ("<<_ps_list.size()<<
" systems)\n";
165 (*i)->write(out,
indent+2);
176 out.width(
indent); out<<
""; out<<
"ParticleSystemManager:\n";
177 out.width(
indent+2); out<<
""; out<<
"_nth_frame "<<_nth_frame<<
"\n";
178 out.width(
indent+2); out<<
""; out<<
"_cur_frame "<<_cur_frame<<
"\n";
A lightweight class that represents a single element that may be timed and/or counted via stats.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
void do_particles(PN_stdfloat dt)
does an update and render for each ps in the list.
virtual void write_ps_list(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
ParticleSystemManager(int every_nth_frame=1)
default constructor
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
virtual ~ParticleSystemManager()
Destructor.
void remove_particlesystem(ParticleSystem *ps)
removes a ps from the maintenance list
Contains and manages a particle system.
void update(PN_stdfloat dt)
Updates the particle system.
void render()
Populates an attached GeomNode structure with the particle geometry for rendering.
This is our own Panda specialization on the default STL list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.