Fix broken shadows
This commit is contained in:
parent
23f84a0906
commit
b793c1750d
1 changed files with 13 additions and 11 deletions
|
@ -29,6 +29,19 @@ ShadowPass::~ShadowPass() {
|
|||
}
|
||||
|
||||
void ShadowPass::render(VkCommandBuffer commandBuffer, World& world) {
|
||||
VkViewport viewport = {};
|
||||
viewport.width = renderer_.getConfig().shadowResolution;
|
||||
viewport.height = renderer_.getConfig().shadowResolution;
|
||||
viewport.maxDepth = 1.0f;
|
||||
|
||||
vkCmdSetViewport(commandBuffer, 0, 1, &viewport);
|
||||
|
||||
VkRect2D scissor = {};
|
||||
scissor.extent.width = renderer_.getConfig().shadowResolution;
|
||||
scissor.extent.height = renderer_.getConfig().shadowResolution;
|
||||
|
||||
vkCmdSetScissor(commandBuffer, 0, 1, &scissor);
|
||||
|
||||
VkClearValue clearColor = {};
|
||||
clearColor.depthStencil.depth = 1.0f;
|
||||
|
||||
|
@ -183,22 +196,11 @@ void ShadowPass::createPipeline() {
|
|||
VkPipelineInputAssemblyStateCreateInfo inputAssembly = {};
|
||||
inputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
||||
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
|
||||
VkViewport viewport = {};
|
||||
viewport.width = renderer_.getConfig().shadowResolution;
|
||||
viewport.height = renderer_.getConfig().shadowResolution;
|
||||
viewport.maxDepth = 1.0f;
|
||||
|
||||
VkRect2D scissor = {};
|
||||
scissor.extent.width = renderer_.getConfig().shadowResolution;
|
||||
scissor.extent.height = renderer_.getConfig().shadowResolution;
|
||||
|
||||
VkPipelineViewportStateCreateInfo viewportState = {};
|
||||
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
||||
viewportState.viewportCount = 1;
|
||||
viewportState.pViewports = &viewport;
|
||||
viewportState.scissorCount = 1;
|
||||
viewportState.pScissors = &scissor;
|
||||
|
||||
VkPipelineRasterizationStateCreateInfo rasterizer = {};
|
||||
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||
|
|
Reference in a new issue