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

Steps every ParticleEmitter's CPU particle simulation. More...

#include <particle_system.h>

Inheritance diagram for Vkm::Engine::ParticleSystem:
Vkm::Engine::System

Public Member Functions

void update (FrameContext &ctx) override
 Execute this system for the current frame.
Public Member Functions inherited from Vkm::Engine::System
virtual bool isReplayed () const
 Whether this system may be re-run over a tick that already happened.
virtual void init (FrameContext &ctx)
 Called once after all systems are registered, before the first update.
virtual void shutdown ()
 Called once on engine shutdown.
virtual void fixedUpdate (FrameContext &ctx)
 Execute this system at the fixed simulation rate.

Static Public Member Functions

static glm::vec3 swirlAt (const glm::vec3 &position, float time)
 The swirl the turbulence pushes along, at position and time.

Static Public Attributes

static constexpr float SWIRL_REACH = 1.5f
 The most any axis of swirlAt reaches.

Detailed Description

Steps every ParticleEmitter's CPU particle simulation.

Runs after HierarchySystem in the Transform stage: particles are world-space and never re-based, so an unresolved emitter transform bakes its error into every particle it emits. A colliding emitter's particles ask the physics world's bodies where they are this frame.

Publishes FrameContext::particles every frame, paused ones too.

Member Function Documentation

◆ update()

void Vkm::Engine::ParticleSystem::update ( FrameContext & ctx)
overridevirtual

Execute this system for the current frame.

Parameters
ctxThis frame's services and the products published so far.

Reimplemented from Vkm::Engine::System.

◆ swirlAt()

glm::vec3 Vkm::Engine::ParticleSystem::swirlAt ( const glm::vec3 & position,
float time )
static

The swirl the turbulence pushes along, at position and time.

Divergence-free: as a flow it neither gathers nor spreads.

Parameters
positionWhere, in units of ParticleEmitter::turbulenceScale.
timeSeconds of simulation, which drift it.
Returns
The swirl's direction and strength there.

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