Wasabi
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
WDefaultParticleBehavior Class Reference

#include <WParticles.hpp>

Inheritance diagram for WDefaultParticleBehavior:
WParticlesBehavior

Public Types

enum  Type : uint8_t { BILLBOARD = 0, NOVA = 1 }
 

Public Member Functions

 WDefaultParticleBehavior (uint32_t maxParticles)
 
virtual void UpdateSystem (float curTime, const WMatrix &worldMatrix, class WCamera *camera)
 
virtual bool UpdateParticle (float curTime, void *particleData, WParticlesInstance *outputInstance, const WMatrix &worldMatrix, class WCamera *camera)
 
virtual WVector3GetMinPoint ()
 
virtual WVector3GetMaxPoint ()
 
- Public Member Functions inherited from WParticlesBehavior
 WParticlesBehavior (uint32_t maxParticles, uint32_t particleSize)
 
uint32_t UpdateAndCopyToBuffer (float curTime, void *buffer, uint32_t maxParticles, const WMatrix &worldMatrix, class WCamera *camera)
 

Public Attributes

WVector3 m_emissionPosition
 
WVector3 m_emissionRandomness
 
float m_particleLife
 
WVector3 m_particleSpawnVelocity
 
bool m_moveOutwards
 
float m_emissionFrequency
 
float m_emissionSize
 
float m_deathSize
 
WDefaultParticleBehavior::Type m_type
 
uint32_t m_numTilesColumns
 
uint32_t m_numTiles
 
std::vector< std::pair< WColor, float > > m_colorGradient
 

Additional Inherited Members

- Protected Member Functions inherited from WParticlesBehavior
void Emit (void *particle)
 

Detailed Description

Default particles behavior implementation, good for basic/starter particle systems.

Member Enumeration Documentation

◆ Type

Type of the particle

Enumerator
BILLBOARD 

Particle is rendered such that it always faces the camera

NOVA 

Particle is rendered to be facing up

Member Function Documentation

◆ GetMaxPoint()

virtual WVector3& WDefaultParticleBehavior::GetMaxPoint ( )
inlinevirtual

Must be implemented to return the maximum point in the bounding box of the particles in local space of the instances.

Implements WParticlesBehavior.

◆ GetMinPoint()

virtual WVector3& WDefaultParticleBehavior::GetMinPoint ( )
inlinevirtual

Must be implemented to return the minimum point in the bounding box of the particles in local space of the instances.

Implements WParticlesBehavior.

◆ UpdateParticle()

virtual bool WDefaultParticleBehavior::UpdateParticle ( float  curTime,
void *  particleData,
WParticlesInstance outputInstance,
const WMatrix worldMatrix,
class WCamera camera 
)
inlinevirtual

Must be implemented by a derived class to define the per-frame behavior of a single particle.

Parameters
curTimeThe time elapsed since the beginning of the program
particleDataA 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
outputInstanceA 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
worldMatrixThe world matrix of the particles system
cameraThe camera used to render the frame
Returns
True if the particle should die, false otherwise

Implements WParticlesBehavior.

◆ UpdateSystem()

virtual void WDefaultParticleBehavior::UpdateSystem ( float  curTime,
const WMatrix worldMatrix,
class WCamera camera 
)
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
curTimeThe time elapsed since the beginning of the program
worldMatrixThe world matrix of the camera rendering the particles
cameraThe camera used to render the frame

Implements WParticlesBehavior.

Member Data Documentation

◆ m_colorGradient

std::vector<std::pair<WColor, float> > WDefaultParticleBehavior::m_colorGradient

An array of (color, time) where color is the color of the particle (multiplied by the texture) at a given time (starting from 0) and lasting for 'time'. The sum of the time element in the vector elements should be equal to 1, where 1 is the time of the particle's death. (default is {<(1,1,1,0), 0.2>, <(1,1,1,1), 0.8>, <(1,1,1,0), 0.0>}

◆ m_deathSize

float WDefaultParticleBehavior::m_deathSize

Size of a particle at death (default is 3)

◆ m_emissionFrequency

float WDefaultParticleBehavior::m_emissionFrequency

Number of particles to emit per second (default is 20)

◆ m_emissionPosition

WVector3 WDefaultParticleBehavior::m_emissionPosition

Position at which new particles spawn (default is (0,0,0))

◆ m_emissionRandomness

WVector3 WDefaultParticleBehavior::m_emissionRandomness

Dimensions of a cube at m_emissionPosition where particles randomly spawn (default is (1, 1, 1)

◆ m_emissionSize

float WDefaultParticleBehavior::m_emissionSize

Size of a particle at emission (default is 1)

◆ m_moveOutwards

bool WDefaultParticleBehavior::m_moveOutwards

If set to true, initial particle velocity will not be m_particleSpawnVelocity, but instead it will be calculated as the vector from m_emissionPosition to the spawn position (affected by m_emissionRandomness) with the speed being the length of m_particleSpawnVelocity

◆ m_numTiles

uint32_t WDefaultParticleBehavior::m_numTiles

Total number of tiles in the texture (default is 1)

◆ m_numTilesColumns

uint32_t WDefaultParticleBehavior::m_numTilesColumns

Number of columns in the texture if it is tiled (otherwise 1, which is the default)

◆ m_particleLife

float WDefaultParticleBehavior::m_particleLife

Lifetime (in seconds) of each particle (default is 1.5)

◆ m_particleSpawnVelocity

WVector3 WDefaultParticleBehavior::m_particleSpawnVelocity

A direction/velocity vector for spawned particles default is (0, 2, 0)

◆ m_type

WDefaultParticleBehavior::Type WDefaultParticleBehavior::m_type

Type of the particle (default is BILLBOARD)


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