Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::ParticleFunctionController Class Reference

Helper class used to provide a function as a particle controller without going in the process of making a new class. More...

Inheritance diagram for Nz::ParticleFunctionController:
Nz::ParticleController Nz::RefCounted

Public Types

using Controller = std::function< void(ParticleGroup &, ParticleMapper &, unsigned int, unsigned int, float)>
 

Public Member Functions

 ParticleFunctionController (Controller controller)
 
 ParticleFunctionController (const ParticleFunctionController &)=default
 
void Apply (ParticleGroup &group, ParticleMapper &mapper, unsigned int startId, unsigned int endId, float elapsedTime) override final
 Calls the controller function. More...
 
const Controller & GetController () const
 Gets the controller function. More...
 
void SetController (Controller controller)
 Sets the controller function. More...
 
- Public Member Functions inherited from Nz::ParticleController
 ParticleController (const ParticleController &controller)
 Constructs a ParticleController object by assignation. More...
 
virtual ~ParticleController ()
 Destructs the object and calls OnParticleControllerRelease. More...
 
 NazaraSignal (OnParticleControllerRelease, const ParticleController *)
 
- Public Member Functions inherited from Nz::RefCounted
 RefCounted (bool persistent=true)
 Constructs a RefCounted object with a persistance aspect. More...
 
 RefCounted (const RefCounted &)=delete
 
 RefCounted (RefCounted &&)=default
 
virtual ~RefCounted ()
 Destructs the object. More...
 
void AddReference () const
 Adds a reference to the object.
 
unsigned int GetReferenceCount () const
 Gets the number of references to the object. More...
 
bool IsPersistent () const
 Checks whether the object is persistent. More...
 
bool RemoveReference () const
 Removes a reference to the object. More...
 
bool SetPersistent (bool persistent=true, bool checkReferenceCount=false)
 Sets the persistence of the object. More...
 
RefCountedoperator= (const RefCounted &)=delete
 
RefCountedoperator= (RefCounted &&)=default
 

Static Public Member Functions

template<typename... Args>
static ParticleFunctionControllerRef New (Args &&... args)
 

Detailed Description

Helper class used to provide a function as a particle controller without going in the process of making a new class.

Member Function Documentation

◆ Apply()

void Nz::ParticleFunctionController::Apply ( ParticleGroup &  group,
ParticleMapper mapper,
unsigned int  startId,
unsigned int  endId,
float  elapsedTime 
)
finaloverridevirtual

Calls the controller function.

Parameters
groupParticle group responsible of the particles
mapperParticle mapper, allowing access to the particle data
startIdThe first ID of the particle to update (inclusive)
endIdThe last ID of the particle to update (inclusive)
elapsedTimeElapsed time in seconds since the last update

Implements Nz::ParticleController.

◆ GetController()

const ParticleFunctionController::Controller & Nz::ParticleFunctionController::GetController ( ) const
inline

Gets the controller function.

Returns
Controller function responsible for particle update

◆ SetController()

void Nz::ParticleFunctionController::SetController ( Controller  controller)
inline

Sets the controller function.

Remarks
The controller function must be valid

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