Kindof works a little bit

This commit is contained in:
Dynamitos
2025-05-09 23:05:47 +02:00
parent 174ff23164
commit 980414e38b
6 changed files with 25 additions and 20 deletions
+12 -7
View File
@@ -147,13 +147,13 @@ void BasePass::render() {
query->beginQuery();
timestamps->write(Gfx::SE_PIPELINE_STAGE_TOP_OF_PIPE_BIT, "BaseBegin");
graphics->beginRenderPass(renderPass);
Array<Gfx::ORenderCommand> commands;
Gfx::ShaderPermutation permutation = graphics->getShaderCompiler()->getTemplate("BasePass");
permutation.setDepthCulling(true); // always use the culling info
permutation.setPositionOnly(false);
Array<VertexData::TransparentDraw> transparentData;
{
graphics->beginDebugRegion("Opaque");
Array<Gfx::ORenderCommand> commands;
Gfx::ShaderPermutation permutation = graphics->getShaderCompiler()->getTemplate("BasePass");
permutation.setDepthCulling(true); // always use the culling info
permutation.setPositionOnly(false);
// Base Rendering
for (VertexData* vertexData : VertexData::getList()) {
transparentData.addAll(vertexData->getTransparentData());
@@ -243,6 +243,7 @@ void BasePass::render() {
commands.add(std::move(command));
}
}
graphics->executeCommands(std::move(commands));
graphics->endDebugRegion();
}
@@ -264,6 +265,8 @@ void BasePass::render() {
// Transparent rendering
{
graphics->beginDebugRegion("Transparent");
Gfx::ShaderPermutation permutation = graphics->getShaderCompiler()->getTemplate("BasePass");
permutation.setPositionOnly(false);
permutation.setDepthCulling(false); // ignore visibility infos for transparency
Map<float, VertexData::TransparentDraw> sortedDraws;
for (const auto& t : transparentData) {
@@ -360,23 +363,25 @@ void BasePass::render() {
// }
}
}
commands.add(std::move(transparentCommand));
graphics->executeCommands(std::move(transparentCommand));
graphics->endDebugRegion();
}
// Debug vertices
if (gDebugVertices.size() > 0) {
graphics->beginDebugRegion("Debug");
Gfx::ShaderPermutation permutation = graphics->getShaderCompiler()->getTemplate("BasePass");
permutation.setDepthCulling(true); // always use the culling info
permutation.setPositionOnly(false);
Gfx::ORenderCommand debugCommand = graphics->createRenderCommand("DebugRender");
debugCommand->setViewport(viewport);
debugCommand->bindPipeline(debugPipeline);
debugCommand->bindDescriptor(viewParamsSet);
debugCommand->bindVertexBuffer({debugVertices});
debugCommand->draw((uint32)gDebugVertices.size(), 1, 0, 0);
commands.add(std::move(debugCommand));
graphics->executeCommands(std::move(debugCommand));
graphics->endDebugRegion();
}
graphics->executeCommands(std::move(commands));
graphics->endRenderPass();
query->endQuery();
timestamps->write(Gfx::SE_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, "BaseEnd");
@@ -81,8 +81,8 @@ void ShadowPass::render() {
"Shadow");
auto light = scene->getLightEnvironment()->getDirectionalLight(shadowIndex);
Component::Camera lightCamera = Component::Camera{
.nearPlane = -20.f,
.farPlane = 10.0f,
.nearPlane = -100.f,
.farPlane = 100.0f,
};
Gfx::PDescriptorSet viewParamsSet = createViewParamsSet(lightCamera, scene->getLightEnvironment()->getDirectionalTransform(shadowIndex));
graphics->beginRenderPass(renderPass);
@@ -173,10 +173,10 @@ void ShadowPass::publishOutputs() {
.offset = {0, 0},
},
.fieldOfView = 0,
.left = -20,
.right = 20,
.top = -20,
.bottom = 20});
.left = -100,
.right = 100,
.top = 100,
.bottom = -100});
viewport = shadowViewport;
}
+1 -1
View File
@@ -26,6 +26,6 @@ Matrix4 Viewport::getProjectionMatrix(float nearPlane, float farPlane) const {
Matrix4 projectionMatrix = glm::perspective(fieldOfView, sizeX / static_cast<float>(sizeY), nearPlane, farPlane);
return correctionMatrix * projectionMatrix;
} else {
return correctionMatrix * glm::ortho(orthoLeft, orthoRight, orthoBottom, orthoTop, farPlane, nearPlane);
return correctionMatrix * glm::ortho(orthoLeft, orthoRight, orthoBottom, orthoTop, nearPlane, farPlane);
}
}