|
group2 0.1.0
CSE 125 Group 2
|
Forward-declared to avoid circular includes. More...
#include <Renderer.hpp>
Public Member Functions | |
| bool | supports (RendererFeature) const override |
Report which RendererFeature entries this renderer implements. | |
| bool | init (SDL_Window *window) override |
| Initialise the GPU device, pipelines, and default scene assets. | |
| void | drawFrame (glm::vec3 eye, float yaw, float pitch, float roll) override |
| Render one frame from the given camera pose. | |
| void | requestScreenshot (const std::string &path) override |
| Queue a screenshot to be saved after the next frame. | |
| bool | setVSync (bool enabled) override |
| Enable or disable vertical sync. | |
| void | quit () override |
| Release all GPU resources and shut down the renderer. | |
| void | setParticleSystem (ParticleSystem *ps) override |
| Register a particle system to be rendered each frame (after scene, before ImGui). | |
| SDL_GPUDevice * | getDevice () const override |
| Returns the SDL GPU device. Valid between init() and quit(). | |
| const Camera & | getCamera () const override |
| Returns the current camera (updated every drawFrame call). | |
| SDL_GPUShaderFormat | getShaderFormat () const override |
| Shader format selected during init() (SPIR-V or MSL). | |
| void | setEntityRenderList (std::vector< EntityRenderCmd > cmds) override |
| Set the list of entity render commands for this frame. | |
| void | setPointLights (std::vector< PointLight > lights) override |
| Set dynamic point lights for this frame. | |
| void | setModelEmissive (int modelIndex, glm::vec4 emissiveFactor) override |
| Update the emissive factor on every mesh of a loaded model. | |
| void | setWeaponViewmodel (const WeaponViewmodel &vm) override |
| Set the first-person weapon viewmodel for this frame. | |
| int | loadSceneModel (const char *filename, glm::vec3 pos, float scale, bool flipUVs=false) override |
| Load a model and return its index in the models[] vector, or -1 on failure. | |
| int | uploadSceneModel (const LoadedModel &model) override |
| Upload a pre-built LoadedModel (e.g. from CharacterRig::templateLoadedModel()) and return its index. | |
| void | updateModelMeshVertices (int modelIndex, int meshIndex, const ModelVertex *vertices, Uint32 vertexCount) override |
| Queue a skinned vertex re-upload for one mesh of an animated model. | |
| int | modelCount () const override |
| Returns the number of loaded models. | |
| bool | loadHDRSkybox (const std::string &path) |
| Load an equirectangular HDR image as the environment skybox + IBL source. | |
| void | scanHDRFiles () |
| Scan the assets HDR directory and populate availableHDRFiles. | |
| glm::vec3 | getSunDirection () const |
| Compute the sun direction (unit vector TO sun) from azimuth/elevation. | |
Public Member Functions inherited from IRenderer | |
| virtual | ~IRenderer ()=default |
Static Public Member Functions | |
| static constexpr SDL_GPUTextureFormat | getHdrFormat () |
| HDR render target format (RGBA16F). Particle pipelines must match this. | |
Public Attributes | |
| std::vector< std::string > | availableHDRFiles |
| Available HDR file paths (populated by scanHDRFiles). | |
| std::string | currentHDRName = "(procedural)" |
| Currently loaded HDR file (display name). | |
| bool | useHDRSkybox = false |
| True when an HDR cubemap is loaded and should be used for skybox + IBL. | |
| int | ssrMode = 2 |
| 0=Sharp, 1=Stochastic, 2=Masked (default). | |
| RenderToggles | toggles |
| Live-tunable feature toggles (checked every frame). | |
| AAMode | aaMode = AAMode::SMAA_T2x |
| Current AA mode (default: recommended T2x). | |
| bool | casEnabled = true |
| CAS sharpening on/off. | |
| float | casStrength = 1.0f |
| CAS sharpness (0.0 = minimal, 1.0 = max). | |
| float | sunAzimuth = 210.0f |
| Degrees, 0=North, 90=East, 180=South (default ~SSW). | |
| float | sunElevation = 60.0f |
| Degrees above horizon (default 60° ≈ 11am). | |
| float | sunIntensity = 3.0f |
| Primary directional light intensity. | |
| float | fillIntensity = 0.8f |
| Fill/bounce light intensity. | |
| float | ambientR = 0.08f |
| float | ambientG = 0.09f |
| float | ambientB = 0.12f |
| PBR ambient color. | |
| float | iblDiffuseIntensity = 1.0f |
| Multiplier on IBL diffuse term. | |
| float | iblSpecularIntensity = 0.5f |
| Multiplier on IBL specular term – default below 1.0 to tame the over-glossy / pseudo-metallic look dielectric surfaces get from real-world HDR environment maps. | |
| float | bloomStr = 0.3f |
| Bloom compositing strength. | |
| float | ssaoStr = 0.8f |
| SSAO compositing strength. | |
| float | ssaoRadius = 0.8f |
| GTAO world-space radius. | |
| float | ssaoFalloff = 2.0f |
| GTAO distance falloff exponent. | |
| float | ssaoPower = 1.5f |
| AO power curve (1=linear, higher=softer). | |
| float | ssrStr = 0.4f |
| SSR compositing strength. | |
| float | volStr = 0.15f |
| Volumetric compositing strength. | |
| float | sharpenStr = 0.6f |
| Post-TAA sharpening strength. | |
| float | shadowBiasVal = 0.0005f |
| float | shadowNormalBiasVal = 1.5f |
| float | shadowDistance = 3000.0f |
| Max shadow range (world units). | |
| float | cascadeLambda = 0.92f |
| Log vs linear cascade split blend (0=linear, 1=log). | |
Forward-declared to avoid circular includes.
SDL3 GPU renderer – forward PBR pipeline with HDR + tone mapping.
Render-pass architecture: Pass 0 – Shadow map (depth-only from directional light, cascaded) Pass 1 – Main colour pass (forward PBR into HDR render target)
Also owns the imgui_impl_sdlgpu3 render backend. The ImGui context and SDL3 input backend are owned by DebugUI – initialise DebugUI first.
SDL3 GPU renderer with forward PBR pipeline.
|
overridevirtual |
Render one frame from the given camera pose.
| eye | Camera world position. |
| yaw | Horizontal rotation in radians. |
| pitch | Vertical rotation in radians. |
| roll | Camera roll in radians (default 0). |
< Per-cascade light VP.
< For view-space Z.
< Cascade far distances.
< Per-cascade resolution.
Implements IRenderer.
|
inlineoverridevirtual |
Returns the current camera (updated every drawFrame call).
Implements IRenderer.
|
inlineoverridevirtual |
|
inlinestaticconstexpr |
HDR render target format (RGBA16F). Particle pipelines must match this.
|
inlineoverridevirtual |
| glm::vec3 Renderer::getSunDirection | ( | ) | const |
Compute the sun direction (unit vector TO sun) from azimuth/elevation.
|
overridevirtual |
Initialise the GPU device, pipelines, and default scene assets.
| window | SDL window to render into. |
Implements IRenderer.
| bool Renderer::loadHDRSkybox | ( | const std::string & | path | ) |
Load an equirectangular HDR image as the environment skybox + IBL source.
|
overridevirtual |
Load a model and return its index in the models[] vector, or -1 on failure.
Implements IRenderer.
|
inlineoverridevirtual |
Returns the number of loaded models.
Implements IRenderer.
|
overridevirtual |
Release all GPU resources and shut down the renderer.
Implements IRenderer.
|
overridevirtual |
Queue a screenshot to be saved after the next frame.
| path | Output file path (PNG). |
Implements IRenderer.
| void Renderer::scanHDRFiles | ( | ) |
Scan the assets HDR directory and populate availableHDRFiles.
|
inlineoverridevirtual |
Set the list of entity render commands for this frame.
Implements IRenderer.
|
inlineoverridevirtual |
Update the emissive factor on every mesh of a loaded model.
Takes effect on the next drawFrame — the material UBO is pushed from CPU each frame, so no GPU re-upload is needed.
Implements IRenderer.
|
inlineoverridevirtual |
Register a particle system to be rendered each frame (after scene, before ImGui).
Implements IRenderer.
|
inlineoverridevirtual |
Set dynamic point lights for this frame.
Up to 6 point lights are supported (the UBO has 8 slots; 2 are reserved for the directional sun + fill). Excess lights are silently dropped.
Implements IRenderer.
|
overridevirtual |
Enable or disable vertical sync.
| enabled | True for VSync, false for uncapped. |
Implements IRenderer.
|
inlineoverridevirtual |
Set the first-person weapon viewmodel for this frame.
Implements IRenderer.
|
inlineoverridevirtual |
Report which RendererFeature entries this renderer implements.
The legacy renderer implements all of them.
Implements IRenderer.
|
overridevirtual |
Queue a skinned vertex re-upload for one mesh of an animated model.
The actual GPU copy is deferred to the next drawFrame() command buffer – no separate command submission, no pipeline stall.
| modelIndex | Index into the models[] vector. |
| meshIndex | Index into the model's meshes[] vector. |
| vertices | New vertex data. |
| vertexCount | Number of vertices. |
Implements IRenderer.
|
overridevirtual |
Upload a pre-built LoadedModel (e.g. from CharacterRig::templateLoadedModel()) and return its index.
Implements IRenderer.
| AAMode Renderer::aaMode = AAMode::SMAA_T2x |
Current AA mode (default: recommended T2x).
| float Renderer::ambientB = 0.12f |
PBR ambient color.
| float Renderer::ambientG = 0.09f |
| float Renderer::ambientR = 0.08f |
| std::vector<std::string> Renderer::availableHDRFiles |
Available HDR file paths (populated by scanHDRFiles).
| float Renderer::bloomStr = 0.3f |
Bloom compositing strength.
| float Renderer::cascadeLambda = 0.92f |
Log vs linear cascade split blend (0=linear, 1=log).
| bool Renderer::casEnabled = true |
CAS sharpening on/off.
| float Renderer::casStrength = 1.0f |
CAS sharpness (0.0 = minimal, 1.0 = max).
| std::string Renderer::currentHDRName = "(procedural)" |
Currently loaded HDR file (display name).
| float Renderer::fillIntensity = 0.8f |
Fill/bounce light intensity.
| float Renderer::iblDiffuseIntensity = 1.0f |
Multiplier on IBL diffuse term.
| float Renderer::iblSpecularIntensity = 0.5f |
Multiplier on IBL specular term – default below 1.0 to tame the over-glossy / pseudo-metallic look dielectric surfaces get from real-world HDR environment maps.
| float Renderer::shadowBiasVal = 0.0005f |
| float Renderer::shadowDistance = 3000.0f |
Max shadow range (world units).
| float Renderer::shadowNormalBiasVal = 1.5f |
| float Renderer::sharpenStr = 0.6f |
Post-TAA sharpening strength.
| float Renderer::ssaoFalloff = 2.0f |
GTAO distance falloff exponent.
| float Renderer::ssaoPower = 1.5f |
AO power curve (1=linear, higher=softer).
| float Renderer::ssaoRadius = 0.8f |
GTAO world-space radius.
| float Renderer::ssaoStr = 0.8f |
SSAO compositing strength.
| int Renderer::ssrMode = 2 |
0=Sharp, 1=Stochastic, 2=Masked (default).
| float Renderer::ssrStr = 0.4f |
SSR compositing strength.
| float Renderer::sunAzimuth = 210.0f |
Degrees, 0=North, 90=East, 180=South (default ~SSW).
| float Renderer::sunElevation = 60.0f |
Degrees above horizon (default 60° ≈ 11am).
| float Renderer::sunIntensity = 3.0f |
Primary directional light intensity.
| RenderToggles Renderer::toggles |
Live-tunable feature toggles (checked every frame).
| bool Renderer::useHDRSkybox = false |
True when an HDR cubemap is loaded and should be used for skybox + IBL.
| float Renderer::volStr = 0.15f |
Volumetric compositing strength.