particleSystem derived from ygNode | Example | Source | Header |
***********************************************************************
***********************************************************************
Messages |
file | file | load particle system editor file |
restart | ||
emitpos | three floats | this message is for moving emit position |
emitstart | three floats | minimum emit start location |
emitend | three floats | maximum emit start location |
emitrate | float | set emit rate |
emit | [bool] | turn emit on/off |
blend | [modulate | blend | decal | add] | set blend type |
maxParticles | [integer] | set max number of alive particles |
lifeMin | float | set minimum particle life |
lifeMax | float | set maximum particle life |
size | float | set initial particle size |
sizeend | float | set end particle size |
speedMin | float | set minimum particle speed |
speedMax | float | set maximum particle speed |
Comments |
constructor Particle
1 local geometry data manipulated by Particle itself
destructor ~Particle
method initGeometry
1 init geometry data
2 create the geometry set and add the geometry data to it
3 texture
3.1 get number of image components4 Create a new material
3.2 if alpha channel then set transparency
3.2.1 gstate->setMode(PFSTATE_ALPHAFUNC, PFAF_NOTEQUAL);
3.2.2 pfGStateVal (gstate, PFSTATE_ALPHAREF, 0.0f);
5 Create a pfGeostate, add the material, and then assign it to our geometry
6 PFTE_MODULATE, PFTE_BLEND, PFTE_DECAL, PFTE_ADD
method setBlend
1 PFTE_MODULATE, PFTE_BLEND, PFTE_DECAL, PFTE_ADD
method Restart
1 draw
method Update
0.1 do something here to hide this particle
0.2 hide
0.1 changing vertex color & alpha
method UpdateTransform
1 find viewer in the world
2 if a viewer is found
2.1 get viewer position vector relative to this node
2.2 get the cross product of the viewer vector and the rotation axis
2.3 establish the object front as the negative Y-axis
2.4 get the cross product of the front axis and the rotation axis
2.5 get a normal towards the viewer by crossing this cross with the rotaion axis
2.6 get the rotation to the viewer vector
2.7 create a matrix with this rotation
constructor particleSystem
1 original fire setting
2 initialize system geometry data
destructor ~particleSystem
method InitSystem
1 reset timer
method reset
method app
1 update elapsed time
method IsColliding
method IsAttractive
method Update
1 temporary pointer of Particle vertex position & normal
2 temporary pointer of Particle vertex color
3 temporary pointer of Particle vertex texture coord
4 for loop
4.0.0.0.1 texture coordinate
method Move
method NumParticles
method message
1 load particle system editor file
2 this message is for moving emit position
3 minimum emit start location
4 maximum emit start location
5 set emit rate
6 turn emit on/off
7 set blend type
8 set max number of alive particles
9 set minimum particle life
10 set maximum particle life
11 set initial particle size
12 set end particle size
13 set minimum particle speed
14 set maximum particle speed
method LoadSFXFile
1 declare variables
2 read first two line: spec version and empty line
3 modified for unit change(from DX to PF)
4 read and set values
5 close the infile
method ResetPartlceArray
1 enable emit
2 reset timer
method setBlend
method Restart
1 reset timer
method LoadChainSystem
1 open file and read spec
method KillThemAll
method GetLocation