33#include <SDL3/SDL_gpu.h>
54 void init(SDL_GPUDevice* device,
55 SDL_GPUTextureFormat& colorTarget,
56 const SDL_GPUShaderFormat& shaderFormat);
113 void setFrame(
const std::vector<glm::mat4>& palette,
114 const std::vector<SkinnedInstance>& instances,
125 void uploadFrame(SDL_GPUCommandBuffer* cmd, SDL_GPUCopyPass* copyPass);
133 void draw(SDL_GPURenderPass* renderPass, SDL_GPUCommandBuffer* cmd);
144 void drawDepth(SDL_GPURenderPass* renderPass, SDL_GPUCommandBuffer* cmd);
151 void drawChams(SDL_GPURenderPass* renderPass, SDL_GPUCommandBuffer* cmd);
184 SDL_GPUBuffer*
vb =
nullptr;
186 SDL_GPUBuffer*
ib =
nullptr;
198 bool ensureSsbos(Uint32 paletteBytes, Uint32 instanceBytes);
Camera class for the new renderer with combined view-projection matrix.
Shared data types exchanged between Game (producer) and NewRenderer (consumer).
std::vector< Uint32 > chamsIndices_
Indices into frameInstances_ of wallhack-revealed enemies.
Definition SkinnedRenderer.hpp:243
bool frameDirty_
Definition SkinnedRenderer.hpp:288
bool frustumCullEnabled_
Optional per-instance frustum cull in setFrame.
Definition SkinnedRenderer.hpp:255
SsboInfo instancesSsboInfo_
Definition SkinnedRenderer.hpp:269
SDL_GPUTransferBuffer * paletteXfer_
Definition SkinnedRenderer.hpp:271
int numJoints() const
Number of joints in the installed rig (0 if not installed).
Definition SkinnedRenderer.hpp:166
bool setRig(const std::vector< RigMeshSource > &meshes, int numJoints)
Install the shared character rig.
Definition SkinnedRenderer.cpp:97
SDL_GPUTransferBuffer * instanceXfer_
Definition SkinnedRenderer.hpp:272
void draw(SDL_GPURenderPass *renderPass, SDL_GPUCommandBuffer *cmd)
Issue the instanced draws for every visible skinned character.
Definition SkinnedRenderer.cpp:421
void shutdown()
Release all GPU resources owned by this subsystem.
Definition SkinnedRenderer.cpp:41
std::vector< glm::mat4 > framePalette_
Definition SkinnedRenderer.hpp:285
SkinnedRenderer & operator=(SkinnedRenderer &&)=delete
void init(SDL_GPUDevice *device, SDL_GPUTextureFormat &colorTarget, const SDL_GPUShaderFormat &shaderFormat)
Bind the SDL GPU device.
Definition SkinnedRenderer.cpp:22
std::vector< SkinnedInstance > frameInstances_
Definition SkinnedRenderer.hpp:286
bool ensureSsbos(Uint32 paletteBytes, Uint32 instanceBytes)
Grow palette/instance SSBOs (and their transfer buffers) to at least these byte sizes.
Definition SkinnedRenderer.cpp:339
void uploadFrame(SDL_GPUCommandBuffer *cmd, SDL_GPUCopyPass *copyPass)
Upload this frame's palette + instance buffers to the GPU.
Definition SkinnedRenderer.cpp:388
glm::vec3 rigBoundingCenter_
Definition SkinnedRenderer.hpp:260
bool rigInstalled_
Definition SkinnedRenderer.hpp:249
SDL_GPUTextureFormat colorFormat_
Cached formats (from init) needed to build the chams pipeline.
Definition SkinnedRenderer.hpp:239
SDL_GPUShaderFormat shaderFormat_
Definition SkinnedRenderer.hpp:240
void drawKillcamHighlight(SDL_GPURenderPass *renderPass, SDL_GPUCommandBuffer *cmd)
Draw the killcam killer full-body red highlight.
Definition SkinnedRenderer.cpp:537
Uint32 visibleInstanceCount_
Definition SkinnedRenderer.hpp:287
SDL_GPUGraphicsPipeline * depthPipeline_
Depth-only variant of the skinned pipeline, used to rasterise the rig into the shadow map so the play...
Definition SkinnedRenderer.hpp:229
SsboInfo palettesSsboInfo_
Definition SkinnedRenderer.hpp:268
SkinnedRenderer()=default
SkinnedRenderer & operator=(const SkinnedRenderer &)=delete
bool createChamsPipeline()
Create the wallhack chams pipeline.
Definition SkinnedRenderer.cpp:720
std::vector< SkinnedMesh > skinnedMeshes_
Definition SkinnedRenderer.hpp:251
SDL_GPUGraphicsPipeline * pipeline_
The skinned graphics pipeline.
Definition SkinnedRenderer.hpp:225
SkinnedRenderer(SkinnedRenderer &&)=delete
void drawChams(SDL_GPURenderPass *renderPass, SDL_GPUCommandBuffer *cmd)
Draw wallhack chams for flagged instances.
Definition SkinnedRenderer.cpp:500
std::vector< Uint32 > killcamHighlightIndices_
Indices into frameInstances_ of killcam-highlighted killers.
Definition SkinnedRenderer.hpp:246
bool createSkinningPipeline(SDL_GPUTextureFormat &colorTarget, const SDL_GPUShaderFormat &shaderFormat)
Definition SkinnedRenderer.cpp:610
~SkinnedRenderer()=default
size_t pendingInstanceCount() const
Number of instances pending render this frame (0 if no frame submitted).
Definition SkinnedRenderer.hpp:172
static bool sphereInFrustum(const glm::vec3 ¢er, float radius, const FrustumPlanes &planes)
Test whether a world-space bounding sphere intersects (or lies inside) the view frustum.
Definition SkinnedRenderer.cpp:236
Uint32 instanceXferCapacityBytes_
Definition SkinnedRenderer.hpp:274
float rigBoundingRadius_
Definition SkinnedRenderer.hpp:261
bool createSkinnedDepthPipeline(const SDL_GPUShaderFormat &shaderFormat)
Definition SkinnedRenderer.cpp:659
void setFrame(const std::vector< glm::mat4 > &palette, const std::vector< SkinnedInstance > &instances, const FrustumPlanes &frustum)
Push this frame's per-character bone palette + per-instance data and frustum-cull it down to the on-s...
Definition SkinnedRenderer.cpp:256
bool createKillcamHighlightPipeline()
Create the killcam full-body highlight pipeline.
Definition SkinnedRenderer.cpp:804
void drawDepth(SDL_GPURenderPass *renderPass, SDL_GPUCommandBuffer *cmd)
Issue the instanced draws for every visible skinned character into a depth-only shadow pass.
Definition SkinnedRenderer.cpp:571
SkinnedRenderer(const SkinnedRenderer &)=delete
SDL_GPUDevice * device_
Definition SkinnedRenderer.hpp:218
int numJoints_
Definition SkinnedRenderer.hpp:250
SDL_GPUGraphicsPipeline * chamsPipeline_
Wallhack chams pipeline: flat-red, GREATER depth test, no depth write — draws flagged players where t...
Definition SkinnedRenderer.hpp:233
void setFrustumCullEnabled(bool enabled)
Enable/disable per-instance frustum culling in setFrame.
Definition SkinnedRenderer.hpp:60
bool rigInstalled() const
True after a successful setRig.
Definition SkinnedRenderer.hpp:169
Uint32 paletteXferCapacityBytes_
Definition SkinnedRenderer.hpp:273
SDL_GPUGraphicsPipeline * killcamHighlightPipeline_
Killcam full-body red highlight pipeline.
Definition SkinnedRenderer.hpp:236
One mesh of the installed skinned rig.
Definition SkinnedRenderer.hpp:183
SDL_GPUBuffer * vb
Definition SkinnedRenderer.hpp:184
SDL_GPUBuffer * ib
Definition SkinnedRenderer.hpp:186
Uint32 indexCount
Definition SkinnedRenderer.hpp:187
Uint32 vertexCount
Definition SkinnedRenderer.hpp:188
SDL_GPUBuffer * boneVb
Definition SkinnedRenderer.hpp:185
Definition SkinnedRenderer.hpp:192
Uint32 capacityBytes_
Definition SkinnedRenderer.hpp:194
SDL_GPUBuffer * ssbo_
Definition SkinnedRenderer.hpp:193