public

Inheritance Graph

graph BT
	ParticleSystemNode
	ParticleSystemNode --> Node
	click ParticleSystemNode "classMinSG_1_1ParticleSystemNode"
	click Node "classMinSG_1_1Node"

Description

Node holding particles and being the interface for different decorators. Contains only the logic for moving/animating and collecting particles, the rest is done by emitters, affectors and renderers.

Emitter: Produces and initializes particles. See ParticlePointEmitter for a simple example.

Affector: Processes all particles each frame (or: in every run of the behaviours). Affectors can do about everything. They could also produce output outside the particle system (e.g. by building a path using the particle data). The most important affector is ParticleAnimator . It calls ParticleSystemNode::collectAndAnimateParticles - without it not much will happen.

Renderer: Called by ParticleSystemNode to display the particles. Per default a simple PointRenderer, though you might want to use the BILLBOARD_RENDERER.

The user of the particle system is responsable for registering the behaviours (emitter/affector) with a behaviour manager, so that they are executed.

Author: Jan Krems, Benjamin Eikel

Date: 2010-06-04

Public Types

   
   
enum renderer_t {POINT_RENDERER, BILLBOARD_RENDERER}
   
typedef Util::Reference < ParticleSystemNode > ref_t
   
typedef std::function< void( ParticleSystemNode *, FrameContext &, const RenderParam &)> ParticleRenderer

Public Functions

     
     
  ParticleSystemNode()  
     
  ParticleSystemNode(const ParticleSystemNode & void)  
     
  ~ParticleSystemNode()
release data
 
     
void setRenderer( renderer_t typeId)
Set renderer based on rendererId.
 
     
void setRenderer( ParticleRenderer _renderer)
set custom renderer
 
     
renderer_t getRendererType() const
Get type-id of renderer. Used for serialization.
 
     
void doDisplay( FrameContext & context, const RenderParam & rp)
> Node
     
void addParticle(const Particle & particle)  
     
std::vector< Particle > & getParticles()
(internal) should only used by a ParticleAffector
 
     
uint32_t getParticleCount() const
(internal) should only used by a ParticleAffector
 
     
uint32_t getMaxParticleCount() const  
     
void setMaxParticleCount(uint32_t max)  
     
void collectAndAnimateParticles( AbstractBehaviour::timestamp_t elapsed)  

Documentation

enum
MinSG::ParticleSystemNode::renderer_t

public
 
 
enum renderer_t
Enumerator   Description
Enumerator   Description
POINT_RENDERER = 1024  
BILLBOARD_RENDERER = 1025  

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:58


typedef
MinSG::ParticleSystemNode::ref_t

public
 
 
typedef Util::Reference < ParticleSystemNode > ref_t

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:56


typedef
MinSG::ParticleSystemNode::ParticleRenderer

public
 
 
typedef std::function< void( ParticleSystemNode *, FrameContext &, const RenderParam &)> ParticleRenderer

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:63


function
MinSG::ParticleSystemNode::ParticleSystemNode

public
   
   
ParticleSystemNode( )

set default values & renderer

  • no particles

  • max particles: 1000

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:70


function
MinSG::ParticleSystemNode::ParticleSystemNode

public
     
     
ParticleSystemNode( const ParticleSystemNode & void )

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:71


function
MinSG::ParticleSystemNode::~ParticleSystemNode

public virtual
   
   
~ParticleSystemNode( )

release data

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:74


function
MinSG::ParticleSystemNode::setRenderer

public
     
     
void setRenderer( renderer_t typeId )

Set renderer based on rendererId.

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:77


function
MinSG::ParticleSystemNode::setRenderer

public
     
     
void setRenderer( ParticleRenderer _renderer )

set custom renderer

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:80


function
MinSG::ParticleSystemNode::getRendererType

public const inline
   
   
renderer_t getRendererType( ) const

Get type-id of renderer. Used for serialization.

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:83


function
MinSG::ParticleSystemNode::doDisplay

public virtual
     
     
void doDisplay( FrameContext & context,
  const RenderParam & rp
)    
> Node

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:86


function
MinSG::ParticleSystemNode::addParticle

public inline
     
     
void addParticle( const Particle & particle )

(internal) should only used by a ParticleEmitter Create a new particle and return it for initialization

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:90


function
MinSG::ParticleSystemNode::getParticles

public inline
   
   
std::vector< Particle > & getParticles( )

(internal) should only used by a ParticleAffector

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:95


function
MinSG::ParticleSystemNode::getParticleCount

public const inline
   
   
uint32_t getParticleCount( ) const

(internal) should only used by a ParticleAffector

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:100


function
MinSG::ParticleSystemNode::getMaxParticleCount

public const inline
   
   
uint32_t getMaxParticleCount( ) const

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:102


function
MinSG::ParticleSystemNode::setMaxParticleCount

public inline
     
     
void setMaxParticleCount( uint32_t max )

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:103


function
MinSG::ParticleSystemNode::collectAndAnimateParticles

public
     
     
void collectAndAnimateParticles( AbstractBehaviour::timestamp_t elapsed )

(internal)* ONLY CALLED BY ParticleAnimator

  • age particles (subtract the elapsed time from timeLeft)

  • collect dead particles (timeLeft <= 0)

  • animate particles left

Defined in MinSG/Ext/ParticleSystem/ParticleSystemNode.h:109