Overview
The particle system allows you to create and manage particle effects with customizable emission patterns, physics simulation, and rendering. Particles automatically face the camera using billboarding.ParticleEmitter
TheParticleEmitter class manages particle spawning, updates, and rendering.
Constructor
Creates a new particle emitter.Parameters:
maxParticles- Maximum number of particles the emitter can handle (default:100)
Core Methods
Allocates buffers and shader state necessary for particle simulation. Called automatically when added to a scene.
Renders all active particles with billboarding logic.Parameters:
dt- Delta time since last framecommandBuffer- Command buffer for renderingupdatePipeline- Whether to update the pipeline (default:false)
Updates particle lifetimes, spawns new particles, and applies forces.Parameters:
window- The window context for updates
Configuration Methods
Sets the type of particle emission pattern.Parameters:
type- Emission type (ParticleEmissionType::FountainorParticleEmissionType::Ambient)
Sets the direction in which particles are emitted.Parameters:
dir- Direction vector
Sets the radius around the emitter from which particles are spawned.Parameters:
radius- Spawn radius
Sets how many particles are spawned per second.Parameters:
particlesPerSecond- Number of particles to spawn per second (float or int)
Sets the settings for particle behavior and appearance.Parameters:
particleSettings- ParticleSettings structure
Emission Control
Emits particles once, then stops.
Emits particles continuously at the configured spawn rate.
Starts emitting particles.
Stops emitting particles.
Emits a burst of particles immediately.Parameters:
count- Number of particles to emit in the burst
Appearance Methods
Binds a sprite texture that will be used for each particle.Parameters:
tex- Texture to use for particles
Sets a tint color that modulates the particle sprite.Parameters:
newColor- Color tint
Enables the use of a texture for particles.
Disables the use of a texture for particles.
Transform Methods
Sets the emitter position.Parameters:
newPosition- New position in 3D space
Moves the emitter by a delta.Parameters:
deltaPosition- Position offset to apply
Returns the current emitter position.
Properties
The settings used for particle behavior and appearance.
ParticleEmissionType
Describes how particles are emitted:
Fountain- Particles emit in a directional cone (good for fountains, fire, smoke)Ambient- Particles emit uniformly in all directions (good for snow, rain, ambient effects)
ParticleSettings
Structure containing all particle behavior parameters.Minimum lifetime of a particle in seconds.
Maximum lifetime of a particle in seconds.
Minimum size of a particle.
Maximum size of a particle.
Speed at which particles fade out.
Gravitational force applied to particles (negative for downward).
Spread of particles from the emitter (angular variation).
Speed variation of particles (how much the speed is randomized).
Particle
Structure representing a single particle in the system.The position of the particle in 3D space.
The velocity of the particle in 3D space.
The color of the particle.
The current life of the particle in seconds.
The maximum life of the particle in seconds.
The scale of the particle.
Whether the particle is active or not.