20 _renderer->render(_physics_objects, _living_particles);
29 _tics_since_birth = _cur_birth_rate;
41 for(i = 0; i < (int)_physics_objects.size(); i++) {
47 _tics_since_birth = 0.0f;
57 _cur_birth_rate = _birth_rate;
58 _tics_since_birth = 0.0f;
68soft_start(PN_stdfloat br, PN_stdfloat first_birth_delay) {
70 _tics_since_birth = -first_birth_delay;
79 set_soft_birth_rate(br);
80 _cur_birth_rate = _soft_birth_rate;
81 _tics_since_birth = 0.0f;
87INLINE
void ParticleSystem::
88set_pool_size(
int size) {
95INLINE
void ParticleSystem::
96set_birth_rate(PN_stdfloat new_br) {
98 _cur_birth_rate = _birth_rate;
99 if(IS_NEARLY_ZERO(_birth_rate)) _birth_rate = NEARLY_ZERO(PN_stdfloat);
105INLINE
void ParticleSystem::
106set_soft_birth_rate(PN_stdfloat new_br) {
107 _soft_birth_rate = new_br;
108 if(IS_NEARLY_ZERO(_soft_birth_rate)) _soft_birth_rate = NEARLY_ZERO(PN_stdfloat);
114INLINE
void ParticleSystem::
115set_litter_size(
int new_ls) {
116 _litter_size = new_ls;
122INLINE
void ParticleSystem::
123set_litter_spread(
int new_ls) {
124 _litter_spread = new_ls;
130INLINE
void ParticleSystem::
133 _renderer->resize_pool(_particle_pool_size);
136 _render_node_path = _renderer->get_render_node_path();
143INLINE
void ParticleSystem::
151INLINE
void ParticleSystem::
153 int pool_size = _particle_pool_size;
157 set_pool_size(pool_size);
163INLINE
void ParticleSystem::
164set_floor_z(PN_stdfloat z) {
171INLINE
void ParticleSystem::
172set_active_system_flag(
bool a) {
173 _active_system_flag = a;
179INLINE
void ParticleSystem::
180set_local_velocity_flag(
bool lv) {
181 _local_velocity_flag = lv;
187INLINE
void ParticleSystem::
188set_spawn_on_death_flag(
bool sod) {
189 _spawn_on_death_flag = sod;
195INLINE
void ParticleSystem::
196set_system_grows_older_flag(
bool sgo) {
197 _system_grows_older_flag = sgo;
203INLINE
void ParticleSystem::
204set_system_lifespan(PN_stdfloat sl) {
205 _system_lifespan = sl;
211INLINE
void ParticleSystem::
212set_system_age(PN_stdfloat age) {
219INLINE
void ParticleSystem::
221 set_spawn_render_node_path(
NodePath(node));
227INLINE
void ParticleSystem::
228set_spawn_render_node_path(
const NodePath &node) {
229 _spawn_render_node_path = node;
235INLINE
void ParticleSystem::
243INLINE
void ParticleSystem::
244set_render_parent(
const NodePath &node) {
247 _render_parent = node;
248 _render_node_path = _renderer->get_render_node_path();
255INLINE
void ParticleSystem::
256set_template_system_flag(
bool tsf) {
257 _template_system_flag = tsf;
263INLINE
void ParticleSystem::
265 _spawn_templates.push_back(ps);
271INLINE
void ParticleSystem::
272clear_spawn_templates() {
273 _spawn_templates.erase(_spawn_templates.begin(),
274 _spawn_templates.end());
280INLINE
void ParticleSystem::
282 _floor_z = -HUGE_VAL;
288INLINE
int ParticleSystem::
289get_pool_size()
const {
290 return _particle_pool_size;
296INLINE PN_stdfloat ParticleSystem::
297get_birth_rate()
const {
304INLINE PN_stdfloat ParticleSystem::
305get_soft_birth_rate()
const {
306 return _soft_birth_rate;
312INLINE
int ParticleSystem::
313get_litter_size()
const {
320INLINE
int ParticleSystem::
321get_litter_spread()
const {
322 return _litter_spread;
329get_renderer()
const {
352INLINE PN_stdfloat ParticleSystem::
360INLINE PN_stdfloat ParticleSystem::
361get_tics_since_birth()
const {
362 return _tics_since_birth;
368INLINE
int ParticleSystem::
369get_living_particles()
const {
370 return _living_particles;
376INLINE
bool ParticleSystem::
377get_active_system_flag()
const {
378 return _active_system_flag;
384INLINE
bool ParticleSystem::
385get_local_velocity_flag()
const {
386 return _local_velocity_flag;
392INLINE
bool ParticleSystem::
393get_spawn_on_death_flag()
const {
394 return _spawn_on_death_flag;
400INLINE
bool ParticleSystem::
401get_system_grows_older_flag()
const {
402 return _system_grows_older_flag;
408INLINE PN_stdfloat ParticleSystem::
409get_system_lifespan()
const {
410 return _system_lifespan;
416INLINE PN_stdfloat ParticleSystem::
417get_system_age()
const {
424INLINE
bool ParticleSystem::
425get_i_was_spawned_flag()
const {
426 return _i_was_spawned_flag;
433get_spawn_render_node()
const {
434 return _spawn_render_node_path.
node();
441get_spawn_render_node_path()
const {
442 return _spawn_render_node_path;
449get_render_parent()
const {
450 return _render_parent;
Pure Virtual base class for creating particles.
Pure virtual particle renderer base class.
An individual, physically-modelable particle abstract base class.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
PandaNode * node() const
Returns the referenced node of the path.
void reparent_to(const NodePath &other, int sort=0, Thread *current_thread=Thread::get_current_thread())
Removes the referenced node of the NodePath from its current parent and attaches it to the referenced...
A basic node of the scene graph or data graph.
Contains and manages a particle system.
void soft_start(PN_stdfloat br=0.0)
Causes system to use birth rate set by set_birth_rate()
void induce_labor()
Forces the birth of a particle litter this frame by resetting _tics_since_birth.
void clear_to_initial()
Resets the system to its start state by resizing to 0, then resizing back to current size.
void soft_stop(PN_stdfloat br=0.0)
Causes system to use birth rate set by set_soft_birth_rate()
void render()
Populates an attached GeomNode structure with the particle geometry for rendering.
void clear_physics_objects()
Erases the object list.