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;
67 set_soft_birth_rate(br);
68 _cur_birth_rate = _soft_birth_rate;
69 _tics_since_birth = 0.0f;
75 INLINE
void ParticleSystem::
76 set_pool_size(
int size) {
83 INLINE
void ParticleSystem::
84 set_birth_rate(PN_stdfloat new_br) {
86 _cur_birth_rate = _birth_rate;
87 if(IS_NEARLY_ZERO(_birth_rate)) _birth_rate = NEARLY_ZERO(PN_stdfloat);
93 INLINE
void ParticleSystem::
94 set_soft_birth_rate(PN_stdfloat new_br) {
95 _soft_birth_rate = new_br;
96 if(IS_NEARLY_ZERO(_soft_birth_rate)) _soft_birth_rate = NEARLY_ZERO(PN_stdfloat);
102 INLINE
void ParticleSystem::
103 set_litter_size(
int new_ls) {
104 _litter_size = new_ls;
110 INLINE
void ParticleSystem::
111 set_litter_spread(
int new_ls) {
112 _litter_spread = new_ls;
118 INLINE
void ParticleSystem::
121 _renderer->resize_pool(_particle_pool_size);
124 _render_node_path = _renderer->get_render_node_path();
131 INLINE
void ParticleSystem::
139 INLINE
void ParticleSystem::
141 int pool_size = _particle_pool_size;
145 set_pool_size(pool_size);
151 INLINE
void ParticleSystem::
152 set_floor_z(PN_stdfloat z) {
159 INLINE
void ParticleSystem::
160 set_active_system_flag(
bool a) {
161 _active_system_flag = a;
167 INLINE
void ParticleSystem::
168 set_local_velocity_flag(
bool lv) {
169 _local_velocity_flag = lv;
175 INLINE
void ParticleSystem::
176 set_spawn_on_death_flag(
bool sod) {
177 _spawn_on_death_flag = sod;
183 INLINE
void ParticleSystem::
184 set_system_grows_older_flag(
bool sgo) {
185 _system_grows_older_flag = sgo;
191 INLINE
void ParticleSystem::
192 set_system_lifespan(PN_stdfloat sl) {
193 _system_lifespan = sl;
199 INLINE
void ParticleSystem::
200 set_system_age(PN_stdfloat age) {
207 INLINE
void ParticleSystem::
209 set_spawn_render_node_path(
NodePath(node));
215 INLINE
void ParticleSystem::
216 set_spawn_render_node_path(
const NodePath &node) {
217 _spawn_render_node_path = node;
223 INLINE
void ParticleSystem::
231 INLINE
void ParticleSystem::
232 set_render_parent(
const NodePath &node) {
235 _render_parent = node;
236 _render_node_path = _renderer->get_render_node_path();
243 INLINE
void ParticleSystem::
244 set_template_system_flag(
bool tsf) {
245 _template_system_flag = tsf;
251 INLINE
void ParticleSystem::
253 _spawn_templates.push_back(ps);
259 INLINE
void ParticleSystem::
260 clear_spawn_templates() {
261 _spawn_templates.erase(_spawn_templates.begin(),
262 _spawn_templates.end());
268 INLINE
void ParticleSystem::
270 _floor_z = -HUGE_VAL;
276 INLINE
int ParticleSystem::
277 get_pool_size()
const {
278 return _particle_pool_size;
284 INLINE PN_stdfloat ParticleSystem::
285 get_birth_rate()
const {
292 INLINE PN_stdfloat ParticleSystem::
293 get_soft_birth_rate()
const {
294 return _soft_birth_rate;
300 INLINE
int ParticleSystem::
301 get_litter_size()
const {
308 INLINE
int ParticleSystem::
309 get_litter_spread()
const {
310 return _litter_spread;
317 get_renderer()
const {
325 get_emitter()
const {
333 get_factory()
const {
340 INLINE PN_stdfloat ParticleSystem::
341 get_floor_z()
const {
348 INLINE
int ParticleSystem::
349 get_living_particles()
const {
350 return _living_particles;
356 INLINE
bool ParticleSystem::
357 get_active_system_flag()
const {
358 return _active_system_flag;
364 INLINE
bool ParticleSystem::
365 get_local_velocity_flag()
const {
366 return _local_velocity_flag;
372 INLINE
bool ParticleSystem::
373 get_spawn_on_death_flag()
const {
374 return _spawn_on_death_flag;
380 INLINE
bool ParticleSystem::
381 get_system_grows_older_flag()
const {
382 return _system_grows_older_flag;
388 INLINE PN_stdfloat ParticleSystem::
389 get_system_lifespan()
const {
390 return _system_lifespan;
396 INLINE PN_stdfloat ParticleSystem::
397 get_system_age()
const {
404 INLINE
bool ParticleSystem::
405 get_i_was_spawned_flag()
const {
406 return _i_was_spawned_flag;
413 get_spawn_render_node()
const {
414 return _spawn_render_node_path.
node();
421 get_spawn_render_node_path()
const {
422 return _spawn_render_node_path;
429 get_render_parent()
const {
430 return _render_parent;
A basic node of the scene graph or data graph.
Pure Virtual base class for creating particles.
void induce_labor()
Forces the birth of a particle litter this frame by resetting _tics_since_birth.
void clear_physics_objects()
Erases the object list.
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 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...
Pure virtual particle renderer base class.
void soft_stop(PN_stdfloat br=0.0)
Causes system to use birth rate set by set_soft_birth_rate()
void clear_to_initial()
Resets the system to its start state by resizing to 0, then resizing back to current size.
PandaNode * node() const
Returns the referenced node of the path.
An individual, physically-modelable particle abstract base class.
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
void render()
Populates an attached GeomNode structure with the particle geometry for rendering.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...