Viewport #94
|
@ -71,7 +71,7 @@ namespace SHADE
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
renderContext.SetIsResized(true);
|
PrepareResize(resizeWidth, resizeHeight);
|
||||||
});
|
});
|
||||||
|
|
||||||
window->RegisterWindowCloseCallback([&](void)
|
window->RegisterWindowCloseCallback([&](void)
|
||||||
|
@ -545,6 +545,14 @@ namespace SHADE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHGraphicsSystem::PrepareResize(uint32_t newWidth, uint32_t newHeight) noexcept
|
||||||
|
{
|
||||||
|
resizeWidth = newWidth;
|
||||||
|
resizeHeight = newHeight;
|
||||||
|
|
||||||
|
renderContext.SetIsResized(true);
|
||||||
|
}
|
||||||
|
|
||||||
void SHGraphicsSystem::HandleResize(void) noexcept
|
void SHGraphicsSystem::HandleResize(void) noexcept
|
||||||
{
|
{
|
||||||
if (window->IsMinimized() || renderContext.GetWindowIsDead())
|
if (window->IsMinimized() || renderContext.GetWindowIsDead())
|
||||||
|
@ -557,15 +565,15 @@ namespace SHADE
|
||||||
|
|
||||||
renderContext.HandleResize();
|
renderContext.HandleResize();
|
||||||
|
|
||||||
worldRenderGraph->HandleResize(windowDims.first, windowDims.second);
|
worldRenderGraph->HandleResize(resizeWidth, resizeHeight);
|
||||||
|
|
||||||
mousePickSystem->HandleResize();
|
mousePickSystem->HandleResize();
|
||||||
//postOffscreenRender->HandleResize();
|
postOffscreenRender->HandleResize();
|
||||||
|
|
||||||
defaultViewport->SetWidth(static_cast<float>(windowDims.first));
|
defaultViewport->SetWidth(static_cast<float>(resizeWidth));
|
||||||
defaultViewport->SetHeight(static_cast<float>(windowDims.second));
|
defaultViewport->SetHeight(static_cast<float>(resizeHeight));
|
||||||
|
|
||||||
worldCamera->SetPerspective(90.0f, static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.0f, 100.0f);
|
worldCamera->SetPerspective(90.0f, static_cast<float>(resizeWidth), static_cast<float>(resizeHeight), 0.0f, 100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHGraphicsSystem::AwaitGraphicsExecution()
|
void SHGraphicsSystem::AwaitGraphicsExecution()
|
||||||
|
|
|
@ -252,6 +252,7 @@ namespace SHADE
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
void BuildTextures();
|
void BuildTextures();
|
||||||
|
|
||||||
|
void PrepareResize(uint32_t newWidth, uint32_t newHeight) noexcept;
|
||||||
void HandleResize(void) noexcept;
|
void HandleResize(void) noexcept;
|
||||||
void AwaitGraphicsExecution();
|
void AwaitGraphicsExecution();
|
||||||
|
|
||||||
|
@ -331,5 +332,7 @@ namespace SHADE
|
||||||
Handle<SHMousePickSystem> mousePickSystem;
|
Handle<SHMousePickSystem> mousePickSystem;
|
||||||
Handle<SHPostOffscreenRenderSystem> postOffscreenRender;
|
Handle<SHPostOffscreenRenderSystem> postOffscreenRender;
|
||||||
|
|
||||||
|
uint32_t resizeWidth;
|
||||||
|
uint32_t resizeHeight;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -56,14 +56,19 @@ namespace SHADE
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create descriptor set layout
|
// Create descriptor set layout
|
||||||
offscreenRenderDescSetLayout = logicalDevice->CreateDescriptorSetLayout(0, { imageBinding }, true);
|
offscreenRenderDescSetLayout = logicalDevice->CreateDescriptorSetLayout(0, { imageBinding }, false);
|
||||||
|
|
||||||
// Create descriptor set
|
// Create descriptor set
|
||||||
offscreenRenderDescSet = descriptorPool->Allocate({ offscreenRenderDescSetLayout }, { 1 });
|
offscreenRenderDescSet = descriptorPool->Allocate({ offscreenRenderDescSetLayout }, { 1 });
|
||||||
|
|
||||||
|
HandleResize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHPostOffscreenRenderSystem::HandleResize(void) noexcept
|
||||||
|
{
|
||||||
std::vector combinedImageSampler
|
std::vector combinedImageSampler
|
||||||
{
|
{
|
||||||
std::make_tuple(renderGraphResource->GetImageView(), Handle<SHVkSampler>{}, vk::ImageLayout::eShaderReadOnlyOptimal),
|
std::make_tuple(offscreenRender->GetImageView(), offscreenRenderSampler, vk::ImageLayout::eShaderReadOnlyOptimal),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Register the image view and sampler with the descriptor set. Now whenever rendering to the offscreen image is done, the descriptor set will see the change
|
// Register the image view and sampler with the descriptor set. Now whenever rendering to the offscreen image is done, the descriptor set will see the change
|
||||||
|
|
|
@ -24,6 +24,8 @@ namespace SHADE
|
||||||
void Init (Handle<SHVkLogicalDevice> logicalDevice, Handle<SHRenderGraphResource> renderGraphResource, Handle<SHVkDescriptorPool> descriptorPool) noexcept;
|
void Init (Handle<SHVkLogicalDevice> logicalDevice, Handle<SHRenderGraphResource> renderGraphResource, Handle<SHVkDescriptorPool> descriptorPool) noexcept;
|
||||||
//void Run ()
|
//void Run ()
|
||||||
|
|
||||||
|
void HandleResize (void) noexcept;
|
||||||
|
|
||||||
Handle<SHVkDescriptorSetGroup> GetDescriptorSetGroup (void) const noexcept;
|
Handle<SHVkDescriptorSetGroup> GetDescriptorSetGroup (void) const noexcept;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue