Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
DefaultPipeline::Resource::GBuffer Class Reference

#include <GBuffer.hpp>

Inheritance diagram for DefaultPipeline::Resource::GBuffer:
Graphic::Resource::ASingleExecutionRenderPass< GBuffer > Graphic::Resource::ARenderPass

Public Member Functions

 GBuffer (std::string_view name=GBUFFER_PASS_NAME)
 Constructs a GBuffer render pass with an optional name.
void UniqueRenderCallback (wgpu::RenderPassEncoder &renderPass, Engine::Core &core) override
 Render all entities with GPUTransform and GPUMesh into the G-buffer using the active camera.
Public Member Functions inherited from Graphic::Resource::ASingleExecutionRenderPass< GBuffer >
 ASingleExecutionRenderPass (std::string_view name)
void Execute (Engine::Core &core) override
Public Member Functions inherited from Graphic::Resource::ARenderPass
 ARenderPass (std::string_view name)
void BindShader (std::string_view shaderName)
void AddInput (uint32_t groupIndex, std::string_view bindGroupName)
void AddOutput (uint32_t id, ColorOutput &&output)
void AddOutput (DepthOutput &&output)
std::vector< Utils::ValidationErrorvalidate (Engine::Core &core) const
const auto & GetBoundShader (void) const
const auto & GetInputs (void) const
const auto & GetName (void) const
const auto & GetOutputs (void) const
auto & GetOutputs (void)

Static Public Member Functions

static Graphic::Resource::Shader CreateShader (Graphic::Resource::Context &graphicContext)
 Constructs and returns a shader configured for the G-buffer pass.

Constructor & Destructor Documentation

◆ GBuffer()

DefaultPipeline::Resource::GBuffer::GBuffer ( std::string_view name = GBUFFER_PASS_NAME)
inlineexplicit

Constructs a GBuffer render pass with an optional name.

Parameters
nameHuman-readable name for the render pass; defaults to GBUFFER_PASS_NAME.

Member Function Documentation

◆ CreateShader()

Graphic::Resource::Shader DefaultPipeline::Resource::GBuffer::CreateShader ( Graphic::Resource::Context & graphicContext)
inlinestatic

Constructs and returns a shader configured for the G-buffer pass.

The shader includes vertex and fragment entry points ("vs_main", "fs_main"), bind-group layouts for camera, model, and material, a vertex buffer layout with position/normal/uv attributes, two color outputs (normal as RGBA16Float and albedo as BGRA8Unorm), and a depth output (Depth32Float).

Parameters
graphicContextGraphics resource context used to create the shader.
Returns
Graphic::Resource::Shader A shader instance configured for the G-buffer rendering pass.

◆ UniqueRenderCallback()

void DefaultPipeline::Resource::GBuffer::UniqueRenderCallback ( wgpu::RenderPassEncoder & renderPass,
Engine::Core & core )
inlineoverridevirtual

Render all entities with GPUTransform and GPUMesh into the G-buffer using the active camera.

Binds the first available camera's bind group, then for each entity with GPUTransform and GPUMesh: binds the entity's transform and material bind groups (falls back to the default material if none), binds the vertex and index buffers, and issues an indexed draw call to populate the G-buffer outputs.

If no entity exposes a GPUCamera component, logs an error and returns without drawing.

Parameters
renderPassThe render pass encoder used to record bind-group bindings, buffer bindings, and draw commands.
coreEngine core providing access to resources and the entity registry.

Implements Graphic::Resource::ASingleExecutionRenderPass< GBuffer >.


The documentation for this class was generated from the following file:
  • src/plugin/default-pipeline/src/resource/pass/GBuffer.hpp