Go to the documentation of this file.
24 PStatCollector 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);
148 output(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";
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void render()
Populates an attached GeomNode structure with the particle geometry for rendering.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ParticleSystemManager(int every_nth_frame=1)
default constructor
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
void remove_particlesystem(ParticleSystem *ps)
removes a ps from the maintenance list
virtual void write_ps_list(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual ~ParticleSystemManager()
Destructor.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that represents a single element that may be timed and/or counted via stats.
This is our own Panda specialization on the default STL list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
void update(PN_stdfloat dt)
Updates the particle system.
Contains and manages a particle system.
void do_particles(PN_stdfloat dt)
does an update and render for each ps in the list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.