Depth rendering of terrain works

This commit is contained in:
Dynamitos
2023-11-10 19:18:09 +01:00
parent effb0c6214
commit c30619d07d
28 changed files with 298 additions and 502 deletions
@@ -30,6 +30,7 @@ private:
PCameraActor source;
Gfx::OPipelineLayout basePassLayout;
// Set 0: viewParameter, provided by renderpass
static constexpr uint32 INDEX_VIEW_PARAMS = 0;
// Set 1: light environment, provided by lightenv
static constexpr uint32 INDEX_LIGHT_ENV = 1;
// Set 2: light culling data
@@ -49,9 +49,10 @@ void DepthPrepass::render()
permutation.setVertexFile("LegacyBasePass");
}
graphics->beginRenderPass(renderPass);
Array<Gfx::PRenderCommand> commands;
for (VertexData* vertexData : VertexData::getList())
{
std::strncpy(permutation.vertexDataName, vertexData->getTypeName().c_str(), sizeof(permutation.vertexDataName));
permutation.setVertexData(vertexData->getTypeName());
const auto& materials = vertexData->getMaterialData();
for (const auto& [_, materialData] : materials)
{
@@ -64,6 +65,7 @@ void DepthPrepass::render()
Gfx::PermutationId id(permutation);
Gfx::PRenderCommand command = graphics->createRenderCommand("DepthRender");
command->setViewport(viewport);
Gfx::OPipelineLayout layout = graphics->createPipelineLayout(depthPrepassLayout);
//layout->addDescriptorLayout(INDEX_MATERIAL, materialData.material->getDescriptorLayout());
layout->addDescriptorLayout(INDEX_VERTEX_DATA, vertexData->getVertexDataLayout());
@@ -122,11 +124,14 @@ void DepthPrepass::render()
{
command->draw(vertexData->getMeshVertexCount(mesh.id), 1, vertexOffset, instanceOffset);
}
instanceOffset+=mesh.meshes;
}
}
}
commands.add(command);
}
}
graphics->executeCommands(commands);
graphics->endRenderPass();
}
@@ -25,7 +25,8 @@ private:
Gfx::OPipelineLayout depthPrepassLayout;
// Set 0: viewParameter
// Set 1: vertices, from VertexData
static constexpr uint32 INDEX_VIEW_PARAMS = 0;
// Set 0: vertices, from VertexData
constexpr static uint32 INDEX_VERTEX_DATA = 1;
// Set 2: mesh data, either index buffer or meshlet data
constexpr static uint32 INDEX_SCENE_DATA = 2;
@@ -36,7 +36,6 @@ protected:
Vector2 pad0;
} viewParams;
PRenderGraphResources resources;
static constexpr uint32 INDEX_VIEW_PARAMS = 0;
Gfx::ODescriptorLayout viewParamsLayout;
Gfx::OUniformBuffer viewParamsBuffer;
Gfx::PDescriptorSet viewParamsSet;