class
ParticleSystem
Controls spawning, evolution and rendering of particles.
Particles can be 2D or 3D, with a variety of rendering options. Particle system should be used for rendering objects that cannot properly be represented using static or animated meshes, like liquids, smoke or flames.
The particle system requires you to specify at least one ParticleEmitter, which controls how are new particles generated. You will also want to specify one or more ParticleEvolvers, which change particle properties over time.
Public
Constructors
ParticleSystem
Methods
~ParticleSystem
SetSettings
Determines general purpose settings that apply to the particle system.
SetGpuSimulationSettings
Determines settings that control particle GPU simulation.
SetEmitters
Set of objects that determine initial position, normal and other properties of newly spawned particles.
Each particle system must have at least one emitter.
GetEmitters
SetEvolvers
Set of objects that determine how particle properties change during their lifetime.
Evolvers only affect CPU simulated particles.
GetEvolvers
SetLayer
Determines the layer bitfield that controls whether a system is considered visible in a specific camera.
Layer must match camera layer in order for the camera to render the component.
staticGetRttiStatic
GetSettings
Determines general purpose settings that apply to the particle system.
GetGpuSimulationSettings
Determines settings that control particle GPU simulation.
GetLayer
Determines the layer bitfield that controls whether a system is considered visible in a specific camera.
Layer must match camera layer in order for the camera to render the component.
Internal
Methods
GetId
Returns an ID that uniquely identifies the particle system.
Can be used for locating evaluated particle system render data in the structure output by the ParticlesManager.
TogglePreviewMode
Enables or disables preview mode.
Preview mode allows the particle system to play while the game is not running, primarily for preview purposes in the editor. Returns true if the preview mode was enabled, false if it was disabled or enabling preview failed.
Simulate
Updates the particle simulation by advancing it by .
New state will be updated in the internal ParticleSet.
CalculateBounds
Calculates the bounds of all the particles in the system.
Should be called after a call to SimulateInternal() to get up-to-date bounds. The bounds are in the simulation space of the particle system.
staticAdvanceTime
Advances the particle system time according to the current time, time delta and the provided settings.
- time
- Current time to use as a base.
- timeDelta
- Amount of time to advance the time by.
- duration
- Maximum time allowed by the particle system.
- loop
- Determines what happens when the time exceeds . If true the time will wrap around to 0 and start over, if false the time will be clamped to .
- outTimeStep
- Actual time-step the simulation was advanced by. This is normally equal to but might be a different value if time was clamped.
Returns: New time value.
Protected
Constructors
ParticleSystem
Methods
Initialize
Construct any resources the component needs before use.
Called when the parent scene object is initialized. A non-initialized component shouldn't be used in a live scene (i.e. it should not receive any of the component logic updates or events).
OnCreated
Called once when the component has been created.
Called regardless of the state the component is in.
OnDestroyed
Called once just before the component is destroyed.
Called regardless of the state the component is in.
OnDisabled
Called every time a component is placed into the Stopped state.
This includes component destruction if component wasn't already in Stopped state during destruction. When called during destruction it is called before OnDestroyed.
OnEnabled
Called every time a component leaves the Stopped state, if the component is enabled.
This includes component creation if requirements for leaving the Stopped state are met. When called during creation it is called after OnBeginPlay.
OnSceneChanged
Called when the parent SceneObject's ECS entity is migrated to a new registry (e.g. when moving between scenes).
The old scene and entity are provided so that components can access sub-systems (renderer, physics, etc.) and read any data stored only in ECS fragments.
OnTransformChanged
Called when the component's parent scene object has changed.
Not called if the component is in Stopped state. Also only called if necessary notify flags are set via SetNotifyFlagsInternal().
Play
Starts the particle system.
New particles will be emitted and existing particles will be evolved.
Pause
Pauses the particle system.
New particles will stop being emitted and existing particle state will be frozen.
Stop
Stops the particle system and resets it to initial state, clearing all particles.
GetCoreDependencies
Populates the provided array with all core objects that this core object depends upon.
Dependencies are required for syncing to the render thread, so the system can be aware to update the dependant objects if a dependency is marked as dirty (for example updating a camera's viewport should also trigger an update on camera so it has a chance to potentially update its data).
Fields
mPreviewMode
Private
Methods
GetParticleSystemData
Returns a reference to the particle system data for the CRTP getter interface.
GetFragment
Returns a mutable reference to the particle system ECS fragment.
GetFragment
Returns a const reference to the particle system ECS fragment.
GetSimulationFragment
Returns a mutable reference to the particle simulation ECS fragment.
GetSimulationFragment
Returns a const reference to the particle simulation ECS fragment.
MarkRenderProxyDataDirty
Marks the render proxy data as dirty.
This causes the SyncToRenderProxy() method to trigger the next time objects are synced to the render thread.
- flags
- Flags in case you want to signal that only part of the internal data is dirty. SyncToRenderProxy() will be called regardless and it's up to the implementation to read the flags value if needed.