Files
Seele/src/Engine/Graphics/RenderPass/DepthPrepass.h
T

65 lines
2.0 KiB
C++
Raw Normal View History

2021-05-06 17:02:10 +02:00
#pragma once
#include "MinimalEngine.h"
#include "MeshProcessor.h"
#include "RenderPass.h"
namespace Seele
{
class DepthPrepassMeshProcessor : public MeshProcessor
{
public:
2022-11-17 16:47:42 +01:00
DepthPrepassMeshProcessor(Gfx::PGraphics graphics);
2021-05-06 17:02:10 +02:00
virtual ~DepthPrepassMeshProcessor();
2022-04-15 23:45:44 +02:00
virtual void processMeshBatch(
2021-05-06 17:02:10 +02:00
const MeshBatch& batch,
2022-11-17 16:47:42 +01:00
Gfx::PViewport target,
Gfx::PRenderPass renderPass,
2021-05-06 17:02:10 +02:00
Gfx::PPipelineLayout pipelineLayout,
Gfx::PDescriptorLayout primitiveLayout,
2021-11-24 12:10:23 +01:00
Array<Gfx::PDescriptorSet> descriptorSets,
2021-05-06 17:02:10 +02:00
int32 staticMeshId = -1) override;
private:
};
DEFINE_REF(DepthPrepassMeshProcessor)
2021-10-01 19:55:04 +02:00
struct DepthPrepassData
{
2023-02-13 14:56:13 +01:00
Array<MeshBatch> staticDrawList;
2023-08-28 21:23:13 +02:00
Gfx::PShaderBuffer sceneDataBuffer;
2021-10-01 19:55:04 +02:00
};
class DepthPrepass : public RenderPass<DepthPrepassData>
2021-05-06 17:02:10 +02:00
{
public:
2022-11-17 16:47:42 +01:00
DepthPrepass(Gfx::PGraphics graphics);
DepthPrepass(DepthPrepass&& other) = default;
2021-05-06 17:02:10 +02:00
~DepthPrepass();
2022-11-17 16:47:42 +01:00
DepthPrepass& operator=(DepthPrepass& other) = default;
virtual void beginFrame(const Component::Camera& cam) override;
2022-04-15 23:45:44 +02:00
virtual void render() override;
virtual void endFrame() override;
2021-05-06 17:02:10 +02:00
virtual void publishOutputs() override;
virtual void createRenderPass() override;
static void modifyRenderPassMacros(Map<const char*, const char*>& defines);
private:
Gfx::PRenderTargetAttachment depthAttachment;
Gfx::PTexture2D depthBuffer;
UPDepthPrepassMeshProcessor processor;
2021-09-23 10:10:39 +02:00
2021-05-06 17:02:10 +02:00
Array<Gfx::PDescriptorSet> descriptorSets;
Gfx::PPipelineLayout depthPrepassLayout;
// Set 0: viewParameter
static constexpr uint32 INDEX_VIEW_PARAMS = 0;
Gfx::PDescriptorLayout viewLayout;
Gfx::PUniformBuffer viewParamBuffer;
// Set 1: materials, generated
static constexpr uint32 INDEX_MATERIAL = 1;
// Set 2: primitive scene data
static constexpr uint32 INDEX_SCENE_DATA = 2;
Gfx::PDescriptorLayout primitiveLayout;
Gfx::PUniformBuffer primitiveUniformBuffer;
friend class DepthPrepassMeshProcessor;
};
DEFINE_REF(DepthPrepass)
} // namespace Seele