vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::ParticleEmitter Struct Reference

CPU-simulated particle emitter: fire, smoke, sparks, impacts, trails, heat haze. More...

#include <particle_emitter.h>

Public Attributes

float rate = 30.0f
 Particles a second.
float ratePerMetre = 0.0f
 Particles a metre the emitter travels, besides the rate.
uint32_t maxParticles = 256
 Cap on live particles.
uint32_t burst = 0
 Particles to spawn at once on the next update, besides the rates; set again to fire again.
bool destroyWhenSpent = false
EmitShape shape = EmitShape::Cone
 Where particles are born and which way they leave, in the emitter's frame.
float radius = 0.0f
 Sphere, Hemisphere, Cone and Disc, metres.
float angle = glm::radians(25.0f)
 Cone and Box: radians off +Y a particle may leave at.
glm::vec3 halfExtents {0.5f}
 Box, metres.
bool fromSurface = false
 Born on the shape's surface or rim, not inside it.
Math::FloatRange lifetime {1.5f, 1.5f}
 Seconds.
Math::FloatRange speed {2.0f, 2.0f}
float inheritVelocity = 0.0f
glm::vec3 acceleration {0.0f, -2.0f, 0.0f}
 World space, metres a second squared: gravity.
float drag = 0.0f
 Velocity lost a second: it keeps exp(-drag) of it.
float turbulence = 0.0f
 Scales the swirl it accelerates by (ParticleSystem::swirlAt).
float turbulenceScale = 1.0f
 Metres the swirls span.
Math::FloatRange size {0.25f, 0.25f}
 Half the card's width, metres, drawn at birth.
Math::Curve sizeOverLife {{{0.0f, 1.0f}, {1.0f, 0.08f}}}
 Multiplies the drawn size.
float intensity = 1.0f
 Multiplies the colour: past 1, an emitting one blooms.
Math::FloatRange rotation {0.0f, 0.0f}
 Radians it is born turned by, about the view.
Math::FloatRange spin {0.0f, 0.0f}
 Radians a second it turns.
float softness = 1.0f
 The disc's edge, 1 soft to 0 hard. Unread with a texture.
float emission = 0.0f
 Alpha: the share of its colour it gives off - fire in smoke.
float distortion = 0.03f
 Distortion: how far it bends what is behind, in view heights.
float lightIntensity = 0.0f
glm::vec3 lightColor {1.0f, 0.6f, 0.3f}
 The light's colour.
float lightRadius = 8.0f
 Metres the light reaches.
float stretch = 0.05f
 Stretched: seconds of its travel the card spans.
float trailLength = 0.3f
 Trail: seconds of where it was the strip spans.
TextureHandle texture
TextureHandle normalMap
uint32_t sheetColumns = 1
 The texture as a sheet of frames, columns by rows, read left to right from the top.
float sheetFps = 0.0f
 Frames a second, looping; 0 plays the sheet once over a life.
bool randomFrame = false
 Each particle starts on a frame of its own.
bool sheetBlend = false
 Each frame fades into the next: a slow flipbook moves smoothly.
bool collide = false
float bounce = 0.3f
 The share of its speed into the surface it keeps, turned back.
float lifeLostOnHit = 0.0f
 The share of its whole life a strike takes; 1 ends it.
SeenBy seenBy = SeenBy::All

Detailed Description

CPU-simulated particle emitter: fire, smoke, sparks, impacts, trails, heat haze.

Each particle is born on the emitter's shape, in its frame, with what its ranges draw; its size and colour then follow their curves over its life, forces move it, and it may strike the physics world. It draws as render says, blended as blend says, as a soft disc or a frame of its texture read as a sheet. Authored data, burst too, which the system spends: live particles are ParticleSystem's (LiveParticles).

A one-off puff is an entity - a prefab, say - with emitting off, a burst, and destroyWhenSpent: it fires once, and goes once its last particle has. A child entity with a ParticleEmitter and a ParticleTrigger is a sub-emitter: it spawns where the parent's particles are born, die or strike.

Member Data Documentation

◆ destroyWhenSpent

bool Vkm::Engine::ParticleEmitter::destroyWhenSpent = false

Destroy the entity, and everything under it, once it has fired, neither emits nor holds a burst, and its last particle has died; one waiting to be fired stays.

◆ speed

Math::FloatRange Vkm::Engine::ParticleEmitter::speed {2.0f, 2.0f}

Metres a second, the way the shape sends it.

◆ inheritVelocity

float Vkm::Engine::ParticleEmitter::inheritVelocity = 0.0f

The share of its source's velocity it takes: the emitter's own, or a sub-emitter's parent particle's.

◆ lightIntensity

float Vkm::Engine::ParticleEmitter::lightIntensity = 0.0f

A point light its live particles give off together, at their middle: this much intensity for each one at full alpha, summed by its colour's alpha, so it fades and dies as they do - a fireball's flash, a fire's glow. 0 gives none. It casts no shadow, and no capture bakes it: a fire the probes should see is a flickering Light.

◆ texture

TextureHandle Vkm::Engine::ParticleEmitter::texture

What each particle shows, tinted by its colour; none draws the soft disc. A Distortion particle reads it as a normal map, so import it with TextureUsage::Normal.

◆ normalMap

TextureHandle Vkm::Engine::ParticleEmitter::normalMap

Alpha: a normal map laid over the sheet frame for frame, lighting each puff by its own folds rather than as a ball.

◆ collide

bool Vkm::Engine::ParticleEmitter::collide = false

Strike the physics world's bodies along each step. A strike counts - for lifeLostOnHit and a Collision trigger - only when it comes in faster than settling would bring it.

◆ seenBy

SeenBy Vkm::Engine::ParticleEmitter::seenBy = SeenBy::All

Who draws its particles, as for a Mesh. Particles cast no shadow and no probe captures them, and a planar reflection draws those the eye does, less the viewmodel layer, so through a scene camera AllButEye draws none and EyeOnly draws as All; Viewmodel lines a muzzle flash up with the weapon in hand and shows it in front of it.


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