SDL3ParticleRenderer Class
Definition
Namespace: Brine2D.Rendering
Hardware-instanced renderer for particle emitters. Manages a static unit-quad vertex buffer
(slot 0, 4 × float2 corners), a per-frame CPU staging array, a GPU instance buffer
\(slot 1, N × 48\-byte [ParticleInstance](ParticleInstance/index.md 'Brine2D\.Rendering\.SDL3ParticleRenderer\.ParticleInstance')\), and uploads all staged instances once
per frame inside the GPU copy pass issued by SDL3Renderer.
Inheritance System.Object → SDL3ParticleRenderer
Implements System.IDisposable
Remarks
Initialized and owned by SDL3Renderer. Accessed internally by
ParticleSystem through SDL3Renderer.ParticleRenderer.
| Fields | |
|---|---|
| FullTextureUVRect | UVRect covering the full texture \(UV 0–1 on both axes\). |
| InstanceSize | Byte size of one ParticleInstance. Must equal 48. |
| SdfCircleUVRect | UVRect sentinel that triggers the SDF filled-circle path in particle_fragment.hlsl. Equivalent to the [2,3]×[2,3] TexCoord range used by Brine2D.Rendering.SDL3BatchRenderer.DrawCircleFilled\(System\.Single,System\.Single,System\.Single,Brine2D\.Core\.Color,System\.Action\). |
| Properties | |
|---|---|
| InstanceBuffer | GPU instance buffer \(slot 1\). Sized for MaxParticlesPerFrame × 48 bytes. Overwritten once per frame via Brine2D.Rendering.SDL3ParticleRenderer.FlushToGPU\(System\.IntPtr\). |
| StagedCount | Number of instances staged into the CPU buffer so far this frame. |
| UnitQuadVertexBuffer | Static unit-quad vertex buffer \(slot 0\). Contains 4 × float2 corners: \(\-1,\-1\), \(1,\-1\), \(\-1,1\), \(1,1\). Never changes after initialization. |
| Methods | |
|---|---|
| AppendInstances\(ReadOnlySpan<ParticleInstance>\) | Appends instances to the CPU staging buffer and returns the firstInstance index to pass to DrawGPUIndexedPrimitives(6, count, 0, 0, firstInstance). Returns -1 when the per-frame instance budget is exhausted; the caller should skip recording the draw call. |
| NewFrame\(int\) | Resets the per-frame instance cursor. Called at the start of each frame by BeginFrame() after the frame-slot fence has been waited. |