Panda3D
Public Member Functions | Static Public Member Functions | Friends | List of all members
ParticleSystem Class Reference

Contains and manages a particle system. More...

#include "particleSystem.h"

Inheritance diagram for ParticleSystem:
Physical TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

Public Member Functions

 ParticleSystem (int pool_size=0)
 Default Constructor. More...
 
 ParticleSystem (const ParticleSystem &copy)
 Copy Constructor. More...
 
 ~ParticleSystem ()
 You get the ankles and I'll get the wrists. More...
 
void add_spawn_template (ParticleSystem *ps)
 
void clear_floor_z ()
 
void clear_spawn_templates ()
 
void clear_to_initial ()
 Resets the system to its start state by resizing to 0, then resizing back to current size. More...
 
virtual TypeHandle force_init_type ()
 
bool get_active_system_flag () const
 
PN_stdfloat get_birth_rate () const
 
BaseParticleEmitterget_emitter () const
 
BaseParticleFactoryget_factory () const
 
PN_stdfloat get_floor_z () const
 
bool get_i_was_spawned_flag () const
 
int get_litter_size () const
 
int get_litter_spread () const
 
int get_living_particles () const
 
bool get_local_velocity_flag () const
 
int get_pool_size () const
 
NodePath get_render_parent () const
 
BaseParticleRendererget_renderer () const
 
PN_stdfloat get_soft_birth_rate () const
 
bool get_spawn_on_death_flag () const
 
PandaNodeget_spawn_render_node () const
 
NodePath get_spawn_render_node_path () const
 
PN_stdfloat get_system_age () const
 
bool get_system_grows_older_flag () const
 
PN_stdfloat get_system_lifespan () const
 
virtual TypeHandle get_type () const
 
void induce_labor ()
 Forces the birth of a particle litter this frame by resetting _tics_since_birth. More...
 
virtual void output (std::ostream &out) const
 Write a string representation of this instance to <out>. More...
 
void render ()
 Populates an attached GeomNode structure with the particle geometry for rendering. More...
 
void set_active_system_flag (bool a)
 
void set_birth_rate (PN_stdfloat new_br)
 
void set_emitter (BaseParticleEmitter *e)
 
void set_factory (BaseParticleFactory *f)
 
void set_floor_z (PN_stdfloat z)
 
void set_litter_size (int new_ls)
 
void set_litter_spread (int new_ls)
 
void set_local_velocity_flag (bool lv)
 
void set_pool_size (int size)
 
void set_render_parent (PandaNode *node)
 
void set_render_parent (const NodePath &node)
 
void set_renderer (BaseParticleRenderer *r)
 
void set_soft_birth_rate (PN_stdfloat new_br)
 
void set_spawn_on_death_flag (bool sod)
 
void set_spawn_render_node (PandaNode *node)
 
void set_spawn_render_node_path (const NodePath &node)
 
void set_system_age (PN_stdfloat age)
 
void set_system_grows_older_flag (bool sgo)
 
void set_system_lifespan (PN_stdfloat sl)
 
void set_template_system_flag (bool tsf)
 
void soft_start (PN_stdfloat br=0.0)
 Causes system to use birth rate set by set_birth_rate() More...
 
void soft_stop (PN_stdfloat br=0.0)
 Causes system to use birth rate set by set_soft_birth_rate() More...
 
void update (PN_stdfloat dt)
 Updates the particle system. More...
 
virtual void write (std::ostream &out, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
virtual void write_free_particle_fifo (std::ostream &out, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
virtual void write_spawn_templates (std::ostream &out, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
- Public Member Functions inherited from Physical
 Physical (int total_objects=1, bool pre_alloc=false)
 Default Constructor The idea here is that most physicals will NOT be collections of sets (i.e. More...
 
 Physical (const Physical &copy)
 copy constructor (note- does deep copy of pn's) but does NOT attach itself to its template's physicsmanager. More...
 
virtual ~Physical ()
 destructor More...
 
void add_angular_force (AngularForce *f)
 Adds an angular force to the force list. More...
 
void add_linear_force (LinearForce *f)
 Adds a linear force to the force list. More...
 
void add_physics_object (PhysicsObject *po)
 Adds an object to the physics object vector. More...
 
void clear_angular_forces ()
 Erases the angular force list. More...
 
void clear_linear_forces ()
 Erases the linear force list. More...
 
void clear_physics_objects ()
 Erases the object list. More...
 
const AngularForceVectorget_angular_forces () const
 
const LinearForceVectorget_linear_forces () const
 
int get_num_angular_forces () const
 
int get_num_linear_forces () const
 
const PhysicsObject::Vectorget_object_vector () const
 
const PhysicsObjectCollection get_objects () const
 
PhysicsObjectget_phys_body () const
 
PhysicalNodeget_physical_node () const
 
NodePath get_physical_node_path () const
 
PhysicsManagerget_physics_manager () const
 
PN_stdfloat get_viscosity () const
 Get the local viscosity. More...
 
 PT (LinearForce) get_linear_force(int index) const
 
 PT (AngularForce) get_angular_force(int index) const
 
void remove_angular_force (AngularForce *f)
 removes an angular force from the force list More...
 
void remove_linear_force (LinearForce *f)
 removes a linear force from the force list More...
 
void set_viscosity (PN_stdfloat viscosity)
 
virtual void write_angular_forces (std::ostream &out=std::cout, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
virtual void write_linear_forces (std::ostream &out=std::cout, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
virtual void write_physics_objects (std::ostream &out=std::cout, int indent=0) const
 Write a string representation of this instance to <out>. More...
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from Physical
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Friends

class ParticleSystemManager
 

Additional Inherited Members

- Public Types inherited from Physical
typedef pvector< PT(AngularForce)> AngularForceVector
 
typedef pvector< PT(LinearForce)> LinearForceVector
 
- Public Attributes inherited from Physical
 get_angular_force
 
 get_linear_force
 
 get_num_angular_forces
 
 get_num_linear_forces
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

Contains and manages a particle system.

Definition at line 40 of file particleSystem.h.

Constructor & Destructor Documentation

◆ ParticleSystem() [1/2]

ParticleSystem::ParticleSystem ( int  pool_size = 0)
explicit

Default Constructor.

Definition at line 45 of file particleSystem.cxx.

References Physical::clear_physics_objects().

◆ ParticleSystem() [2/2]

ParticleSystem::ParticleSystem ( const ParticleSystem copy)

Copy Constructor.

Definition at line 88 of file particleSystem.cxx.

References NodePath::reparent_to().

◆ ~ParticleSystem()

ParticleSystem::~ParticleSystem ( )

You get the ankles and I'll get the wrists.

Definition at line 121 of file particleSystem.cxx.

References NodePath::remove_node().

Member Function Documentation

◆ clear_to_initial()

void ParticleSystem::clear_to_initial ( )
inline

Resets the system to its start state by resizing to 0, then resizing back to current size.

Definition at line 37 of file particleSystem.I.

◆ induce_labor()

void ParticleSystem::induce_labor ( )
inline

Forces the birth of a particle litter this frame by resetting _tics_since_birth.

Definition at line 28 of file particleSystem.I.

◆ output()

void ParticleSystem::output ( std::ostream &  out) const
virtual

Write a string representation of this instance to <out>.

Reimplemented from Physical.

Definition at line 679 of file particleSystem.cxx.

◆ render()

void ParticleSystem::render ( )
inline

Populates an attached GeomNode structure with the particle geometry for rendering.

This is a wrapper for accessability.

Definition at line 19 of file particleSystem.I.

Referenced by ParticleSystemManager::do_particles().

◆ soft_start()

void ParticleSystem::soft_start ( PN_stdfloat  br = 0.0)
inline

Causes system to use birth rate set by set_birth_rate()

Definition at line 54 of file particleSystem.I.

◆ soft_stop()

void ParticleSystem::soft_stop ( PN_stdfloat  br = 0.0)
inline

Causes system to use birth rate set by set_soft_birth_rate()

Definition at line 65 of file particleSystem.I.

◆ update()

void ParticleSystem::update ( PN_stdfloat  dt)

Updates the particle system.

Call once per frame.

Definition at line 457 of file particleSystem.cxx.

References PhysicsObject::get_position().

Referenced by ParticleSystemManager::do_particles().

◆ write()

void ParticleSystem::write ( std::ostream &  out,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Reimplemented from Physical.

Definition at line 721 of file particleSystem.cxx.

References indent(), Physical::write(), write_free_particle_fifo(), and write_spawn_templates().

◆ write_free_particle_fifo()

void ParticleSystem::write_free_particle_fifo ( std::ostream &  out,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Definition at line 689 of file particleSystem.cxx.

References indent().

Referenced by write().

◆ write_spawn_templates()

void ParticleSystem::write_spawn_templates ( std::ostream &  out,
int  indent = 0 
) const
virtual

Write a string representation of this instance to <out>.

Definition at line 705 of file particleSystem.cxx.

References indent().

Referenced by write().


The documentation for this class was generated from the following files: