Shadows do at least something
This commit is contained in:
@@ -71,6 +71,7 @@ void DepthCullingPass::beginFrame(const Component::Camera& cam, const Component:
|
||||
|
||||
void DepthCullingPass::render() {
|
||||
graphics->beginDebugRegion("DepthCullingPass");
|
||||
Gfx::PDescriptorSet set = depthAttachmentLayout->allocateDescriptorSet();
|
||||
{
|
||||
graphics->beginDebugRegion("MipGeneration");
|
||||
query->beginQuery();
|
||||
@@ -79,7 +80,6 @@ void DepthCullingPass::render() {
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
|
||||
depthMipBuffer->rotateBuffer(depthMipBuffer->getNumElements() * sizeof(uint32));
|
||||
Gfx::PDescriptorSet set = depthAttachmentLayout->allocateDescriptorSet();
|
||||
set->updateTexture(DEPTHTEXTURE_NAME, 0, depthAttachment.getTexture());
|
||||
set->updateBuffer(DEPTHMIP_NAME, 0, depthMipBuffer);
|
||||
set->writeChanges();
|
||||
@@ -127,10 +127,6 @@ void DepthCullingPass::render() {
|
||||
graphics->beginDebugRegion("DepthCulling");
|
||||
graphics->beginRenderPass(renderPass);
|
||||
Array<Gfx::ORenderCommand> commands;
|
||||
Gfx::PDescriptorSet set = depthAttachmentLayout->allocateDescriptorSet();
|
||||
set->updateTexture(DEPTHTEXTURE_NAME, 0, depthAttachment.getTexture());
|
||||
set->updateBuffer(DEPTHMIP_NAME, 0, depthMipBuffer);
|
||||
set->writeChanges();
|
||||
Gfx::ShaderPermutation permutation = graphics->getShaderCompiler()->getTemplate("DepthPass");
|
||||
permutation.setPositionOnly(true);
|
||||
permutation.setDepthCulling(getGlobals().useDepthCulling);
|
||||
|
||||
@@ -79,15 +79,13 @@ void ShadowPass::render() {
|
||||
.offset = {0, 0},
|
||||
},
|
||||
"Shadow");
|
||||
graphics->beginRenderPass(renderPass);
|
||||
auto light = scene->getLightEnvironment()->getDirectionalLight(shadowIndex);
|
||||
|
||||
|
||||
Component::Camera lightCamera = Component::Camera{
|
||||
.nearPlane = 0.f,
|
||||
.farPlane = 1000.0f,
|
||||
.nearPlane = -20.f,
|
||||
.farPlane = 10.0f,
|
||||
};
|
||||
Gfx::PDescriptorSet viewParamsSet = createViewParamsSet(lightCamera, scene->getLightEnvironment()->getDirectionalTransform(shadowIndex));
|
||||
graphics->beginRenderPass(renderPass);
|
||||
for (VertexData* vertexData : VertexData::getList()) {
|
||||
permutation.setVertexData(vertexData->getTypeName());
|
||||
Gfx::PermutationId id(permutation);
|
||||
@@ -105,7 +103,7 @@ void ShadowPass::render() {
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.rasterizationState =
|
||||
{
|
||||
.cullMode = Gfx::SE_CULL_MODE_FRONT_BIT,
|
||||
.cullMode = Gfx::SE_CULL_MODE_NONE,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
@@ -122,7 +120,7 @@ void ShadowPass::render() {
|
||||
.pipelineLayout = collection->pipelineLayout,
|
||||
.rasterizationState =
|
||||
{
|
||||
.cullMode = Gfx::SE_CULL_MODE_FRONT_BIT,
|
||||
.cullMode = Gfx::SE_CULL_MODE_NONE,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
@@ -161,6 +159,7 @@ void ShadowPass::render() {
|
||||
}
|
||||
graphics->executeCommands(std::move(commands));
|
||||
graphics->endRenderPass();
|
||||
graphics->waitDeviceIdle();
|
||||
}
|
||||
graphics->endDebugRegion();
|
||||
}
|
||||
@@ -174,10 +173,10 @@ void ShadowPass::publishOutputs() {
|
||||
.offset = {0, 0},
|
||||
},
|
||||
.fieldOfView = 0,
|
||||
.left = -10,
|
||||
.right = 10,
|
||||
.top = -10,
|
||||
.bottom = 10});
|
||||
.left = -20,
|
||||
.right = 20,
|
||||
.top = -20,
|
||||
.bottom = 20});
|
||||
viewport = shadowViewport;
|
||||
}
|
||||
|
||||
|
||||
@@ -313,5 +313,5 @@ void Viewport::move(uint32 newOffsetX, uint32 newOffsetY) {
|
||||
offsetX = newOffsetX;
|
||||
offsetY = newOffsetY;
|
||||
handle.x = static_cast<float>(offsetX);
|
||||
handle.y = static_cast<float>(offsetY + sizeY);
|
||||
handle.y = static_cast<float>(offsetY);
|
||||
}
|
||||
|
||||
@@ -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, orthoTop, orthoBottom, farPlane, nearPlane);
|
||||
return correctionMatrix * glm::ortho(orthoLeft, orthoRight, orthoBottom, orthoTop, farPlane, nearPlane);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user