Kuesa Runtime

Particles Class

class Kuesa::Particles

Particle system that controls emission and the various properties or particles over their lifetime. More...

Header: #include <Kuesa/Particles>
Since: Kuesa 1.3

This class was introduced in Kuesa 1.3.

Public Types

enum class AlignMode { FaceCamera, Velocity }

Properties

Public Functions

Kuesa::Particles::AlignMode alignMode() const
QVector3D emitterPosition() const
QVector3D emitterPositionRandom() const
QVector3D emitterVelocity() const
QVector3D emitterVelocityRandom() const
QVector4D finalColor() const
QVector2D finalSize() const
float frameTime() const
QVector3D gravity() const
float initialAngle() const
float initialAngleRandom() const
QVector4D initialColor() const
QVector2D initialSize() const
int maxParticlesEmittedPerFrame() const
int particleCount() const
float particleLifespan() const
float particleLifespanRandom() const
float rotationRate() const
float rotationRateRandom() const
Qt3DRender::QAbstractTexture *spriteTexture() const

Public Slots

void setAlignMode(Kuesa::Particles::AlignMode alignMode)
void setEmitterPosition(const QVector3D &emitterPosition)
void setEmitterPositionRandom(const QVector3D &emitterPositionRandom)
void setEmitterVelocity(const QVector3D &emitterVelocity)
void setEmitterVelocityRandom(const QVector3D &emitterVelocityRandom)
void setFinalColor(const QVector4D &finalColor)
void setFinalSize(const QVector2D &finalSize)
void setFrameTime(float frameTime)
void setGravity(const QVector3D &gravity)
void setInitialAngle(float initialAngle)
void setInitialAngleRandom(float initialAngleRandom)
void setInitialColor(const QVector4D &initialColor)
void setInitialSize(const QVector2D &initialSize)
void setMaxParticlesEmittedPerFrame(int maxParticlesEmittedPerFrame)
void setParticleCount(int particleCount)
void setParticleLifespan(float lifespan)
void setParticleLifespanRandom(float lifespanRandom)
void setRotationRate(float rotationRate)
void setRotationRateRandom(float rotationRateRandom)
void setSpriteTexture(Qt3DRender::QAbstractTexture *spriteTexture)

Signals

void alignModeChanged(Kuesa::Particles::AlignMode alignMode)
void emitterPositionChanged(const QVector3D &emitterPosition)
void emitterPositionRandomChanged(const QVector3D &emitterPositionRandom)
void emitterVelocityChanged(const QVector3D &emitterVelocity)
void emitterVelocityRandomChanged(const QVector3D &emitterVelocityRandom)
void finalColorChanged(const QVector4D &finalColor)
void finalSizeChanged(const QVector2D &finalSize)
void frameTimeChanged(float frameTime)
void gravityChanged(const QVector3D &gravity)
void initialAngleChanged(float initialAngle)
void initialAngleRandomChanged(float initialAngleRandom)
void initialColorChanged(const QVector4D &initialColor)
void initialSizeChanged(const QVector2D &initialSize)
void maxParticlesEmittedPerFrameChanged(int maxParticlesEmittedPerFrame)
void particleCountChanged(int particleCount)
void particleLifespanChanged(float particleLifespan)
void particleLifespanRandomChanged(float particleLifespanRandom)
void rotationRateChanged(float rotationRate)
void rotationRateRandomChanged(float rotationRateRandom)
void spriteTextureChanged(const Qt3DRender::QAbstractTexture *spriteTexture)

Detailed Description

 #include <Qt3DExtras/Qt3DWindow>
 #include <ForwardRenderer>
 #include <SceneEntity>
 #include <Particles>

 Qt3DExtras::Qt3DWindow win;
 Kuesa::SceneEntity *root = new Kuesa::SceneEntity();
 Kuesa::ForwardRenderer *frameGraph = new Kuesa::ForwardRenderer();
 frameGraph->setParticlesEnabled(true)

 Kuesa::Particles *particles = new Kuesa::Particles(root);
 particles->setParticleCount(128);
 particles->setMaxParticlesEmittedPerFrame(4);
 particles->setGravity(QVector3D(0.0f, -1.0f, 0.0f));
 ...

 win->setRootEntity(root);
 win->setActiveFrameGraph(forwardRenderer);
 ...

Member Type Documentation

enum class Particles::AlignMode

This enum type describes the available particle alignment modes.

ConstantValueDescription
Kuesa::Particles::AlignMode::FaceCamera0The particle faces the camera at all times.
Kuesa::Particles::AlignMode::Velocity1The particle's local Y axis is aligned to its direction.

Property Documentation

alignMode : AlignMode

Holds the alignment mode for the particles.

If the Velocity alignment mode is used, the initialAngle and rotationRate properties are ignored.

This property was introduced in Kuesa 1.3.

Access functions:

Kuesa::Particles::AlignMode alignMode() const
void setAlignMode(Kuesa::Particles::AlignMode alignMode)

Notifier signal:

void alignModeChanged(Kuesa::Particles::AlignMode alignMode)

emitterPosition : QVector3D

Holds the world position of the particle emitter.

This property was introduced in Kuesa 1.3.

Access functions:

QVector3D emitterPosition() const
void setEmitterPosition(const QVector3D &emitterPosition)

Notifier signal:

void emitterPositionChanged(const QVector3D &emitterPosition)

emitterPositionRandom : QVector3D

Holds the randomness factor applied to the world position.

This property was introduced in Kuesa 1.3.

Access functions:

QVector3D emitterPositionRandom() const
void setEmitterPositionRandom(const QVector3D &emitterPositionRandom)

Notifier signal:

void emitterPositionRandomChanged(const QVector3D &emitterPositionRandom)

emitterVelocity : QVector3D

Holds the velocity applied to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector3D emitterVelocity() const
void setEmitterVelocity(const QVector3D &emitterVelocity)

Notifier signal:

void emitterVelocityChanged(const QVector3D &emitterVelocity)

emitterVelocityRandom : QVector3D

Holds the velocity randomness factor applied to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector3D emitterVelocityRandom() const
void setEmitterVelocityRandom(const QVector3D &emitterVelocityRandom)

Notifier signal:

void emitterVelocityRandomChanged(const QVector3D &emitterVelocityRandom)

finalColor : QVector4D

Holds the final color of the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector4D finalColor() const
void setFinalColor(const QVector4D &finalColor)

Notifier signal:

void finalColorChanged(const QVector4D &finalColor)

finalSize : QVector2D

Holds the final size of the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector2D finalSize() const
void setFinalSize(const QVector2D &finalSize)

Notifier signal:

void finalSizeChanged(const QVector2D &finalSize)

frameTime : float

Holds the speed at which updates need to be made in milliseconds.

This property was introduced in Kuesa 1.3.

Access functions:

float frameTime() const
void setFrameTime(float frameTime)

Notifier signal:

void frameTimeChanged(float frameTime)

gravity : QVector3D

Holds the gravity value to apply to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector3D gravity() const
void setGravity(const QVector3D &gravity)

Notifier signal:

void gravityChanged(const QVector3D &gravity)

initialAngle : float

Holds the initial rotation angle in radians of the particles.

This property was introduced in Kuesa 1.3.

Access functions:

float initialAngle() const
void setInitialAngle(float initialAngle)

Notifier signal:

void initialAngleChanged(float initialAngle)

initialAngleRandom : float

Holds the initial rotation randomness factor applied to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

float initialAngleRandom() const
void setInitialAngleRandom(float initialAngleRandom)

Notifier signal:

void initialAngleRandomChanged(float initialAngleRandom)

initialColor : QVector4D

Holds the initial color of the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector4D initialColor() const
void setInitialColor(const QVector4D &initialColor)

Notifier signal:

void initialColorChanged(const QVector4D &initialColor)

initialSize : QVector2D

Holds the initial size of the particles.

This property was introduced in Kuesa 1.3.

Access functions:

QVector2D initialSize() const
void setInitialSize(const QVector2D &initialSize)

Notifier signal:

void initialSizeChanged(const QVector2D &initialSize)

maxParticlesEmittedPerFrame : int

Holds the maximum number of new particles that can be created each frame.

This property was introduced in Kuesa 1.3.

Access functions:

int maxParticlesEmittedPerFrame() const
void setMaxParticlesEmittedPerFrame(int maxParticlesEmittedPerFrame)

Notifier signal:

void maxParticlesEmittedPerFrameChanged(int maxParticlesEmittedPerFrame)

particleCount : int

Holds the maximum number of particles the system can handle. Currently the maximum value is 2048.

This property was introduced in Kuesa 1.3.

Access functions:

int particleCount() const
void setParticleCount(int particleCount)

Notifier signal:

void particleCountChanged(int particleCount)

particleLifespan : float

Holds the lifetime of the particles.

This property was introduced in Kuesa 1.3.

Access functions:

float particleLifespan() const
void setParticleLifespan(float lifespan)

Notifier signal:

void particleLifespanChanged(float particleLifespan)

particleLifespanRandom : float

Holds the lifetime randomness factor applied to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

float particleLifespanRandom() const
void setParticleLifespanRandom(float lifespanRandom)

Notifier signal:

void particleLifespanRandomChanged(float particleLifespanRandom)

rotationRate : float

Holds the rotation speed applied to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

float rotationRate() const
void setRotationRate(float rotationRate)

Notifier signal:

void rotationRateChanged(float rotationRate)

rotationRateRandom : float

Holds the rotation speed randomness factor applied to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

float rotationRateRandom() const
void setRotationRateRandom(float rotationRateRandom)

Notifier signal:

void rotationRateRandomChanged(float rotationRateRandom)

spriteTexture : Qt3DRender::QAbstractTexture*

Holds the 2D sprite texture to apply to the particles.

This property was introduced in Kuesa 1.3.

Access functions:

Qt3DRender::QAbstractTexture *spriteTexture() const
void setSpriteTexture(Qt3DRender::QAbstractTexture *spriteTexture)

Notifier signal:

void spriteTextureChanged(const Qt3DRender::QAbstractTexture *spriteTexture)