#include <WParticles.hpp>
|
| WParticlesBehavior (uint32_t maxParticles, uint32_t particleSize) |
|
uint32_t | UpdateAndCopyToBuffer (float curTime, void *buffer, uint32_t maxParticles, const WMatrix &worldMatrix, class WCamera *camera) |
|
virtual void | UpdateSystem (float curTime, const WMatrix &worldMatrix, class WCamera *camera)=0 |
|
virtual bool | UpdateParticle (float curTime, void *particleData, WParticlesInstance *outputInstance, const WMatrix &worldMatrix, class WCamera *camera)=0 |
|
virtual WVector3 & | GetMinPoint ()=0 |
|
virtual WVector3 & | GetMaxPoint ()=0 |
|
|
void | Emit (void *particle) |
|
This class can be derived to implement custom behavior for particles. Custom behavior includes rules for emission, motion, growth, etc... The typename T must have identical bytes to a WParticlesVertex at its beginning.
◆ WParticlesBehavior()
WParticlesBehavior::WParticlesBehavior |
( |
uint32_t |
maxParticles, |
|
|
uint32_t |
particleSize |
|
) |
| |
- Parameters
-
maxParticles | Maximum number of particles that the target system can render |
particleSize | Size of each particle structure |
◆ Emit()
void WParticlesBehavior::Emit |
( |
void * |
particle | ) |
|
|
protected |
Emits a particle if not at the limit. Emittion means placing the particle data in m_buffer and incrementing m_numParticles.
- Parameters
-
◆ GetMaxPoint()
virtual WVector3& WParticlesBehavior::GetMaxPoint |
( |
| ) |
|
|
inlinepure virtual |
Must be implemented to return the maximum point in the bounding box of the particles in local space of the instances.
Implemented in WDefaultParticleBehavior.
◆ GetMinPoint()
virtual WVector3& WParticlesBehavior::GetMinPoint |
( |
| ) |
|
|
inlinepure virtual |
Must be implemented to return the minimum point in the bounding box of the particles in local space of the instances.
Implemented in WDefaultParticleBehavior.
◆ UpdateAndCopyToBuffer()
uint32_t WParticlesBehavior::UpdateAndCopyToBuffer |
( |
float |
curTime, |
|
|
void * |
buffer, |
|
|
uint32_t |
maxParticles, |
|
|
const WMatrix & |
worldMatrix, |
|
|
class WCamera * |
camera |
|
) |
| |
Called by the WParticles implementation to update the particles and fill in the particles buffer with instance data. The size of the buffer is m_maxParticles * sizeof(WParticlesInstance)
- Parameters
-
curTime | The time elapsed since the beginning of the program |
buffer | Pointer to the buffer to be filled |
maxParticles | Maximum number of particles in the vb |
worldMatrix | The world matrix of the particles system |
camera | The camera used to render the frame |
- Returns
- Number of particles copied
◆ UpdateParticle()
virtual bool WParticlesBehavior::UpdateParticle |
( |
float |
curTime, |
|
|
void * |
particleData, |
|
|
WParticlesInstance * |
outputInstance, |
|
|
const WMatrix & |
worldMatrix, |
|
|
class WCamera * |
camera |
|
) |
| |
|
inlinepure virtual |
Must be implemented by a derived class to define the per-frame behavior of a single particle.
- Parameters
-
curTime | The time elapsed since the beginning of the program |
particleData | A pointer to the beginning of the vertices memory to fill. The memory will have sizeof(WParticlesInstance) bytes to be filled with the 4 vertices of the particle billboard. The output vertex must be in VIEW SPACE |
outputInstance | A pointer to the buffer to be filled with the instance data for the particle particleData. The transformation matrix is used as-is to transform from local space to projection space |
worldMatrix | The world matrix of the particles system |
camera | The camera used to render the frame |
- Returns
- True if the particle should die, false otherwise
Implemented in WDefaultParticleBehavior.
◆ UpdateSystem()
virtual void WParticlesBehavior::UpdateSystem |
( |
float |
curTime, |
|
|
const WMatrix & |
worldMatrix, |
|
|
class WCamera * |
camera |
|
) |
| |
|
pure virtual |
Must be implemented by a derived class to define the per-frame behavior of the particle system. Typically this should control emission by calling Emit() when a particle needs to be emitted.
- Parameters
-
curTime | The time elapsed since the beginning of the program |
worldMatrix | The world matrix of the camera rendering the particles |
camera | The camera used to render the frame |
Implemented in WDefaultParticleBehavior.
The documentation for this class was generated from the following file: