group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ParticleRenderer Class Reference

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.
 

Detailed Description

Owns all particle GPU pipelines and per-category GPU buffers.

ParticleSystem calls uploadAll() (before render pass) and drawAll() (inside render pass).

Member Function Documentation

◆ drawAll()

void ParticleRenderer::drawAll ( SDL_GPURenderPass *  pass,
SDL_GPUCommandBuffer *  cmd,
float  screenW,
float  screenH 
)

Issue all particle draw calls in the correct blend/depth order.

Parameters
passThe active render pass.
cmdThe command buffer (for push uniforms).
screenWWindow width in pixels for HUD uniform.
screenHWindow height in pixels for HUD uniform.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

bool ParticleRenderer::init ( SDL_GPUDevice *  dev,
SDL_GPUTextureFormat  colorFmt,
SDL_GPUShaderFormat  shaderFmt 
)

Initialise GPU pipelines, buffers, and procedural textures.

Parameters
devThe SDL GPU device.
colorFmtSwapchain colour format.
shaderFmtShader binary format (SPIRV or MSL).
Returns
True on success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ quit()

void ParticleRenderer::quit ( )

Release all GPU pipelines, buffers, and textures.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSdfAtlas()

void ParticleRenderer::setSdfAtlas ( SDL_GPUTexture *  tex,
SDL_GPUSampler *  samp 
)
inline

Register the SDF glyph atlas so drawAll() can bind it before drawing text.

Call this once after SdfAtlas::init() succeeds.

Here is the caller graph for this function:

◆ smokeNoiseTex()

SDL_GPUTexture * ParticleRenderer::smokeNoiseTex ( ) const
inline

◆ smokeSampler()

SDL_GPUSampler * ParticleRenderer::smokeSampler ( ) const
inline

◆ uploadArcs()

void ParticleRenderer::uploadArcs ( SDL_GPUCommandBuffer *  cmd,
const ArcVertex data,
uint32_t  count 
)

Upload lightning arc vertex data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to arc vertex array.
countNumber of vertices to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadBillboards()

void ParticleRenderer::uploadBillboards ( SDL_GPUCommandBuffer *  cmd,
const BillboardParticle data,
uint32_t  count 
)

Upload billboard particle data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to billboard particle array.
countNumber of particles to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadDecals()

void ParticleRenderer::uploadDecals ( SDL_GPUCommandBuffer *  cmd,
const DecalInstance data,
uint32_t  count 
)

Upload decal instance data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to decal instance array.
countNumber of instances to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadHitscan()

void ParticleRenderer::uploadHitscan ( SDL_GPUCommandBuffer *  cmd,
const HitscanBeam data,
uint32_t  count 
)

Upload hitscan beam data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to hitscan beam array.
countNumber of beams to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadRibbon()

void ParticleRenderer::uploadRibbon ( SDL_GPUCommandBuffer *  cmd,
const RibbonVertex data,
uint32_t  count 
)

Upload ribbon vertex data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to ribbon vertex array.
countNumber of vertices to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadSdfHud()

void ParticleRenderer::uploadSdfHud ( SDL_GPUCommandBuffer *  cmd,
const SdfGlyphGPU data,
uint32_t  count 
)

Upload HUD SDF glyph data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to SDF glyph array.
countNumber of glyphs to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadSdfWorld()

void ParticleRenderer::uploadSdfWorld ( SDL_GPUCommandBuffer *  cmd,
const SdfGlyphGPU data,
uint32_t  count 
)

Upload world-space SDF glyph data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to SDF glyph array.
countNumber of glyphs to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadSmoke()

void ParticleRenderer::uploadSmoke ( SDL_GPUCommandBuffer *  cmd,
const SmokeParticle data,
uint32_t  count 
)

Upload smoke particle data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to smoke particle array.
countNumber of particles to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadTracers()

void ParticleRenderer::uploadTracers ( SDL_GPUCommandBuffer *  cmd,
const TracerParticle data,
uint32_t  count 
)

Upload tracer particle data to the GPU.

Parameters
cmdActive command buffer.
dataPointer to tracer particle array.
countNumber of particles to upload.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: