class

ParticleRenderer

Abstract CPU particle renderer interface. The concrete backend (RHIParticleRenderer) is implemented on the Platform/ RHI API (Shader/Pipeline/VertexBuffer/DescriptorSet) and draws into an off-screen target via SetTargetFramebuffer. The GPU-compute path lives separately in GPUParticleRenderer.

Module
Particles
Header
#include "Particles/ParticleRenderer.h"
Namespace
Mowo

Constructors

SignatureNameDescription
virtual ~ParticleRenderer() = default~ParticleRenderer

Public functions

ReturnsNameDescription
boolInitialize
voidShutdown
voidSetTargetFramebufferOff-screen target the renderer draws into (set before Initialize).
voidSetBatchStateOpen (or reuse) the batch subsequent AddParticle calls append to.
voidAddParticleAdd a single particle quad to the current batch.
FQuadSpanReserveQuads
voidWriteQuad
voidRender
voidRenderWithDSRender with an externally-owned depth descriptor set (caller binds the scene depth) — backend-agnostic surface used by SceneRenderer so it never downcasts to the concrete backend.
Ref<DescriptorSet>AllocateDepthDS
Ref<Sampler>GetNearestSampler
voidSetDepthLinearizeParamsCoefficients that turn an NDC depth back into a view-space distance, taken from the projection matrix: (m22, m23, m32, m33).
voidClear
voidEndFrameSwap buffers for double-buffering (call at end of frame)
boolHasData
ParticleRenderer*CreateFactory — returns the RHI-generic backend (RHIParticleRenderer).
voidDestroy

Function details

~ParticleRenderer

C++
virtual ~ParticleRenderer() = default

Initialize

C++
virtual bool Initialize(const std::string& vfsShaderPath) = 0

Shutdown

C++
virtual void Shutdown() = 0

SetTargetFramebuffer

C++
virtual void SetTargetFramebuffer(const FramebufferSpecification& spec) = 0

Off-screen target the renderer draws into (set before Initialize).

SetBatchState

C++
void SetBatchState(const Ref<Image2D>& texture, ParticleBlendMode blend, bool depthTest, float softFadeDistance)

Open (or reuse) the batch subsequent AddParticle calls append to.

AddParticle

C++
void AddParticle(const Vec3& position, const Vec3& right, const Vec3& up, const Vec4& color, const Vec2& uvMin, const Vec2& uvSize)

Add a single particle quad to the current batch. right and up are pre-scaled by half-size; uvMin/uvSize select the flipbook cell.

ReserveQuads

C++
FQuadSpan ReserveQuads(uint32_t count)

WriteQuad

C++
void WriteQuad(const FQuadSpan& span, uint32_t quad, const Vec3& position, const Vec3& right, const Vec3& up, const Vec4& color, const Vec2& uvMin, const Vec2& uvSize)

Render

C++
virtual void Render(const Mat4& viewProjection, bool depthTest) = 0

RenderWithDS

C++
virtual void RenderWithDS(const Mat4& viewProjection, Ref<DescriptorSet> depthDS, uint32_t viewportWidth, uint32_t viewportHeight) = 0

Render with an externally-owned depth descriptor set (caller binds the scene depth) — backend-agnostic surface used by SceneRenderer so it never downcasts to the concrete backend.

AllocateDepthDS

C++
virtual Ref<DescriptorSet> AllocateDepthDS(const std::string& debugName) = 0

GetNearestSampler

C++
virtual Ref<Sampler> GetNearestSampler() const = 0

SetDepthLinearizeParams

C++
void SetDepthLinearizeParams(const Vec4& params)

Coefficients that turn an NDC depth back into a view-space distance, taken from the projection matrix: (m22, m23, m32, m33). Without them the soft-particle fade has no way to work in world units.

Clear

C++
void Clear()

EndFrame

C++
void EndFrame()

Swap buffers for double-buffering (call at end of frame)

HasData

C++
bool HasData() const

Create

C++
static ParticleRenderer* Create()

Factory — returns the RHI-generic backend (RHIParticleRenderer).

Destroy

C++
static void Destroy(ParticleRenderer* renderer)
Generated from Particles/ParticleRenderer.h via particles.json · Dec 5, 2026Version 1.1.0