|
group2 0.1.0
CSE 125 Group 2
|
Owns all particle GPU pipelines and per-category GPU buffers. More...
#include <ParticleRenderer.hpp>
Public Member Functions | |
| bool | init (SDL_GPUDevice *dev, SDL_GPUTextureFormat colorFmt, SDL_GPUShaderFormat shaderFmt) |
| Initialise GPU pipelines, buffers, and procedural textures. | |
| void | quit () |
| Release all GPU pipelines, buffers, and textures. | |
| void | uploadBillboards (SDL_GPUCommandBuffer *cmd, const BillboardParticle *data, uint32_t count) |
| Upload billboard particle data to the GPU. | |
| void | uploadTracers (SDL_GPUCommandBuffer *cmd, const TracerParticle *data, uint32_t count) |
| Upload tracer particle data to the GPU. | |
| void | uploadRibbon (SDL_GPUCommandBuffer *cmd, const RibbonVertex *data, uint32_t count) |
| Upload ribbon vertex data to the GPU. | |
| void | uploadHitscan (SDL_GPUCommandBuffer *cmd, const HitscanBeam *data, uint32_t count) |
| Upload hitscan beam data to the GPU. | |
| void | uploadArcs (SDL_GPUCommandBuffer *cmd, const ArcVertex *data, uint32_t count) |
| Upload lightning arc vertex data to the GPU. | |
| void | uploadSmoke (SDL_GPUCommandBuffer *cmd, const SmokeParticle *data, uint32_t count) |
| Upload smoke particle data to the GPU. | |
| void | uploadDecals (SDL_GPUCommandBuffer *cmd, const DecalInstance *data, uint32_t count) |
| Upload decal instance data to the GPU. | |
| void | uploadSdfWorld (SDL_GPUCommandBuffer *cmd, const SdfGlyphGPU *data, uint32_t count) |
| Upload world-space SDF glyph data to the GPU. | |
| void | uploadSdfHud (SDL_GPUCommandBuffer *cmd, const SdfGlyphGPU *data, uint32_t count) |
| Upload HUD SDF glyph data to the GPU. | |
| void | drawAll (SDL_GPURenderPass *pass, SDL_GPUCommandBuffer *cmd, float screenW, float screenH) |
| Issue all particle draw calls in the correct blend/depth order. | |
| SDL_GPUTexture * | smokeNoiseTex () const |
| SDL_GPUSampler * | smokeSampler () const |
| void | setSdfAtlas (SDL_GPUTexture *tex, SDL_GPUSampler *samp) |
| Register the SDF glyph atlas so drawAll() can bind it before drawing text. | |
Owns all particle GPU pipelines and per-category GPU buffers.
ParticleSystem calls uploadAll() (before render pass) and drawAll() (inside render pass).
| void ParticleRenderer::drawAll | ( | SDL_GPURenderPass * | pass, |
| SDL_GPUCommandBuffer * | cmd, | ||
| float | screenW, | ||
| float | screenH | ||
| ) |
Issue all particle draw calls in the correct blend/depth order.
| pass | The active render pass. |
| cmd | The command buffer (for push uniforms). |
| screenW | Window width in pixels for HUD uniform. |
| screenH | Window height in pixels for HUD uniform. |
| bool ParticleRenderer::init | ( | SDL_GPUDevice * | dev, |
| SDL_GPUTextureFormat | colorFmt, | ||
| SDL_GPUShaderFormat | shaderFmt | ||
| ) |
Initialise GPU pipelines, buffers, and procedural textures.
| dev | The SDL GPU device. |
| colorFmt | Swapchain colour format. |
| shaderFmt | Shader binary format (SPIRV or MSL). |
| void ParticleRenderer::quit | ( | ) |
Release all GPU pipelines, buffers, and textures.
|
inline |
Register the SDF glyph atlas so drawAll() can bind it before drawing text.
Call this once after SdfAtlas::init() succeeds.
|
inline |
|
inline |
| void ParticleRenderer::uploadArcs | ( | SDL_GPUCommandBuffer * | cmd, |
| const ArcVertex * | data, | ||
| uint32_t | count | ||
| ) |
Upload lightning arc vertex data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to arc vertex array. |
| count | Number of vertices to upload. |
| void ParticleRenderer::uploadBillboards | ( | SDL_GPUCommandBuffer * | cmd, |
| const BillboardParticle * | data, | ||
| uint32_t | count | ||
| ) |
Upload billboard particle data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to billboard particle array. |
| count | Number of particles to upload. |
| void ParticleRenderer::uploadDecals | ( | SDL_GPUCommandBuffer * | cmd, |
| const DecalInstance * | data, | ||
| uint32_t | count | ||
| ) |
Upload decal instance data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to decal instance array. |
| count | Number of instances to upload. |
| void ParticleRenderer::uploadHitscan | ( | SDL_GPUCommandBuffer * | cmd, |
| const HitscanBeam * | data, | ||
| uint32_t | count | ||
| ) |
Upload hitscan beam data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to hitscan beam array. |
| count | Number of beams to upload. |
| void ParticleRenderer::uploadRibbon | ( | SDL_GPUCommandBuffer * | cmd, |
| const RibbonVertex * | data, | ||
| uint32_t | count | ||
| ) |
Upload ribbon vertex data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to ribbon vertex array. |
| count | Number of vertices to upload. |
| void ParticleRenderer::uploadSdfHud | ( | SDL_GPUCommandBuffer * | cmd, |
| const SdfGlyphGPU * | data, | ||
| uint32_t | count | ||
| ) |
Upload HUD SDF glyph data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to SDF glyph array. |
| count | Number of glyphs to upload. |
| void ParticleRenderer::uploadSdfWorld | ( | SDL_GPUCommandBuffer * | cmd, |
| const SdfGlyphGPU * | data, | ||
| uint32_t | count | ||
| ) |
Upload world-space SDF glyph data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to SDF glyph array. |
| count | Number of glyphs to upload. |
| void ParticleRenderer::uploadSmoke | ( | SDL_GPUCommandBuffer * | cmd, |
| const SmokeParticle * | data, | ||
| uint32_t | count | ||
| ) |
Upload smoke particle data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to smoke particle array. |
| count | Number of particles to upload. |
| void ParticleRenderer::uploadTracers | ( | SDL_GPUCommandBuffer * | cmd, |
| const TracerParticle * | data, | ||
| uint32_t | count | ||
| ) |
Upload tracer particle data to the GPU.
| cmd | Active command buffer. |
| data | Pointer to tracer particle array. |
| count | Number of particles to upload. |