nCine::ParticleAffector class

Base class for all particle affectors.

An affector mutates one property of a particle (color, size, rotation, position or velocity) each frame, interpolating between user-defined steps according to the particle's normalized age. A ParticleSystem applies every attached affector to each alive particle before it is drawn.

Derived classes

class ColorAffector
Affector that animates the color of a particle.
class PositionAffector
Affector that animates the position of a particle.
class RotationAffector
Affector that animates the rotation of a particle.
class SizeAffector
Affector that animates the scale of a particle.
class VelocityAffector
Affector that animates the velocity of a particle.

Public types

enum class Type { COLOR, SIZE, ROTATION, POSITION, VELOCITY }
Affector type.

Constructors, destructors, conversion operators

ParticleAffector(Type type)
~ParticleAffector() virtual
ParticleAffector(const ParticleAffector& other) protected defaulted
Protected default copy constructor used to clone objects.

Public functions

void affect(Particle* particle)
Affects a property of the specified particle.
void affect(Particle* particle, float normalizedAge) pure virtual
Affects a property of the specified particle using a precomputed normalized age.
auto type() const -> Type
Returns the affector type.

Protected variables

Type type_
Affector type.

Enum documentation

enum class nCine::ParticleAffector::Type

Affector type.

Identifies which particle property the affector mutates and selects the matching subclass when cloning.

Enumerators
COLOR

Affects the particle color

SIZE

Affects the particle scale

ROTATION

Affects the particle rotation

POSITION

Affects the particle position

VELOCITY

Affects the particle velocity

Function documentation

void nCine::ParticleAffector::affect(Particle* particle)

Affects a property of the specified particle.

Computes the particle's normalized age from its remaining life and forwards to the overloaded method.

void nCine::ParticleAffector::affect(Particle* particle, float normalizedAge) pure virtual

Affects a property of the specified particle using a precomputed normalized age.

Parameters
particle Particle to mutate
normalizedAge Particle age mapped to the [0, 1] range, where 0 is birth and 1 is death