ParticleSystem
- Module
- Particles
- Header
#include "Particles/ParticleSystem.h"- Namespace
Mowo
Public functions
| Returns | Name | Description |
|---|---|---|
void | Initialize | |
void | Shutdown | |
void | Update | |
bool | DeclaresComponentAccess | Reads where each emitter stands, writes only the emitters themselves: it creates no entities and adds no components. |
ComponentMask | GetReadMask | |
ComponentMask | GetWriteMask | |
void | SetSceneDriven | |
void | TickParticles | |
void | SubmitForRendering | Submit particle data to renderer (call for editor preview without full Update) |
void | SubmitForRendering | The same submission for emitters the caller names, without walking the World. |
void | SetCameraPosition | Set camera position for billboard orientation |
const Vec3& | GetCameraPosition | |
void | SetCameraVectors | Set the camera view matrix (needed for GPU billboard generation) |
void | SetParticleRenderer | |
ParticleRenderer* | GetParticleRenderer | |
void | SetLightingParams | The frame's main directional light and ambient/GI irradiance, used to shade billboard emitters whose shadingMode is Lit. |
void | SetGPUParticleRenderer | |
GPUParticleRenderer* | GetGPUParticleRenderer | |
float | GetCurrentTime | |
void | SetViewProjection | Set view projection matrix (GPU renderer + submission-time culling) |
void | SetCullingViewProjection | Emitters whose bounds fall outside this frustum are not submitted. |
uint32_t | GetSubmittedEmitterCount | Emitters submitted by the last SubmitForRendering, and how many the frustum/distance cull rejected — read by the self-tests. |
uint32_t | GetCulledEmitterCount | |
void | SetCollisionField | Scene representation collision modules resolve against. |
const ParticleCollisionField* | GetCollisionField | |
bool | WantsDepthCollision | True when at least one live emitter carries a collision module that can use the depth tier. |
bool | WantsSdfCollision | True when a live CPU emitter carries a collision module that can sample the distance field, as of the last tick. |
void | SetGpuCollisionField | |
void | BakeGPUSimParams | Bake an emitter's modules into GPU sim params (public so the collision parity self-test can assert the baked CollisionModule values without a GPU). |
uint32_t | GetCollisionCount | Contacts resolved across every emitter on the last Update. |
void | SetViewportSize | Backbuffer size, used to turn a world-space particle quad into an estimated pixel count for the fill budget. |
void | SetOverdrawBudget | Fill budget. |
float | GetOverdrawBudget | |
float | GetEstimatedOverdraw | Estimated screens of fill the last SubmitForRendering actually admitted, and how many emitters the budget rejected. |
uint32_t | GetFillBudgetRejectedCount | |
void | SetVisibilityFilter | Per-view visibility veto, rebound alongside the camera. |
void | SetEffectsScalability | Effects scalability scalars applied on top of authored emitter values: spawn rate, pool size and cull distance. |
float | GetSpawnRateScale | |
uint32_t | GetMaxActiveEmitters |
Function details
Initialize
void Initialize(World* world) overrideShutdown
void Shutdown() overrideUpdate
void Update(float deltaTime) overrideDeclaresComponentAccess
bool DeclaresComponentAccess() const overrideReads where each emitter stands, writes only the emitters themselves: it creates no entities and adds no components.
GetReadMask
ComponentMask GetReadMask() const overrideGetWriteMask
ComponentMask GetWriteMask() const overrideSetSceneDriven
void SetSceneDriven(bool sceneDriven)TickParticles
void TickParticles(float deltaTime)SubmitForRendering
void SubmitForRendering()Submit particle data to renderer (call for editor preview without full Update)
SubmitForRendering
void SubmitForRendering(const std::vector<Entity>& roots)The same submission for emitters the caller names, without walking the World. An editor preview records on the render thread, where iterating a World is not allowed, and it already knows its one emitter entity.
SetCameraPosition
void SetCameraPosition(const Vec3& cameraPos)Set camera position for billboard orientation
GetCameraPosition
const Vec3& GetCameraPosition() constSetCameraVectors
void SetCameraVectors(const Vec3& right, const Vec3& up, const Vec3& fwd)Set the camera view matrix (needed for GPU billboard generation)
SetParticleRenderer
void SetParticleRenderer(ParticleRenderer* renderer)GetParticleRenderer
ParticleRenderer* GetParticleRenderer() constSetLightingParams
void SetLightingParams(const Vec3& direction, const Vec3& color, float intensity, const Vec3& ambient)The frame's main directional light and ambient/GI irradiance, used to shade billboard emitters whose shadingMode is Lit. Mesh emitters are deferred-lit by the scene instead and ignore these.
SetGPUParticleRenderer
void SetGPUParticleRenderer(GPUParticleRenderer* renderer)GetGPUParticleRenderer
GPUParticleRenderer* GetGPUParticleRenderer() constGetCurrentTime
float GetCurrentTime() constSetViewProjection
void SetViewProjection(const Mat4& vp)Set view projection matrix (GPU renderer + submission-time culling)
SetCullingViewProjection
void SetCullingViewProjection(const Mat4& vp)Emitters whose bounds fall outside this frustum are not submitted. The matrix is the same view-projection used for rendering.
GetSubmittedEmitterCount
uint32_t GetSubmittedEmitterCount() constEmitters submitted by the last SubmitForRendering, and how many the frustum/distance cull rejected — read by the self-tests.
GetCulledEmitterCount
uint32_t GetCulledEmitterCount() constSetCollisionField
void SetCollisionField(const ParticleCollisionField* field)Scene representation collision modules resolve against. Owned by the caller and expected to stay valid for the frame; null disables collision without disabling the modules.
GetCollisionField
const ParticleCollisionField* GetCollisionField() constWantsDepthCollision
bool WantsDepthCollision() constTrue when at least one live emitter carries a collision module that can use the depth tier. The renderer reads this to decide whether the depth downsample and its readback are worth running at all — nothing pays for depth collision in a scene that does not ask for it.
WantsSdfCollision
bool WantsSdfCollision() constTrue when a live CPU emitter carries a collision module that can sample the distance field, as of the last tick. The host only asks the renderer for its CPU copy of the field while this holds.
SetGpuCollisionField
void SetGpuCollisionField(const GpuCollisionFieldParams& field)BakeGPUSimParams
void BakeGPUSimParams(const struct ParticleEmitterComponent& emitter, const Vec3& emitterPos, GPUParticleSimParams& params) constBake an emitter's modules into GPU sim params (public so the collision parity self-test can assert the baked CollisionModule values without a GPU).
GetCollisionCount
uint32_t GetCollisionCount() constContacts resolved across every emitter on the last Update.
SetViewportSize
void SetViewportSize(uint32_t width, uint32_t height)Backbuffer size, used to turn a world-space particle quad into an estimated pixel count for the fill budget. Zero disables the estimate.
SetOverdrawBudget
void SetOverdrawBudget(float screensOfFill)Fill budget. Particle cost is overdraw, not simulation, so the budget is denominated in screen coverage: an emitter's estimated covered pixels (quad areas summed, overlaps counted twice — that IS the overdraw) over the backbuffer's pixel count. A budget of 2 means "particles may cover the screen twice over". Emitters are admitted nearest-first and the first one that would blow the budget, and everything behind it, is dropped for the frame. Zero means unlimited.
GetOverdrawBudget
float GetOverdrawBudget() constGetEstimatedOverdraw
float GetEstimatedOverdraw() constEstimated screens of fill the last SubmitForRendering actually admitted, and how many emitters the budget rejected.
GetFillBudgetRejectedCount
uint32_t GetFillBudgetRejectedCount() constSetVisibilityFilter
void SetVisibilityFilter(std::function<bool(EntityID)> filter)Per-view visibility veto, rebound alongside the camera. Particles gather out of the World directly, so without this the scene's own layer mask and editor-hidden filter stop at every other renderable and let emitters through. Empty = submit everything, which is what a host with no scene (the standalone emitter tests) wants.
SetEffectsScalability
void SetEffectsScalability(float spawnRateScale, float maxParticleScale, float cullDistanceScale, uint32_t maxActiveEmitters)Effects scalability scalars applied on top of authored emitter values: spawn rate, pool size and cull distance. 1.0 leaves content untouched.
GetSpawnRateScale
float GetSpawnRateScale() constGetMaxActiveEmitters
uint32_t GetMaxActiveEmitters() const