SHViewport now takes in a RenderGraph instead of creating one
This commit is contained in:
parent
a3aa708b34
commit
7a126bf1fc
|
@ -109,13 +109,13 @@ namespace SHADE
|
||||||
defaultViewport = AddViewport(vk::Viewport(0.0f, 0.0f, window->GetWindowSize().first, window->GetWindowSize().second, 0.0f, 1.0f));
|
defaultViewport = AddViewport(vk::Viewport(0.0f, 0.0f, window->GetWindowSize().first, window->GetWindowSize().second, 0.0f, 1.0f));
|
||||||
|
|
||||||
// Create Debug Renderers
|
// Create Debug Renderers
|
||||||
debugScreenRenderer = defaultViewport->AddRenderer(resourceManager);
|
debugScreenRenderer = defaultViewport->AddRenderer(resourceManager,);
|
||||||
debugScreenRenderer->SetCamera(screenCamera);
|
debugScreenRenderer->SetCamera(screenCamera);
|
||||||
debugWorldRenderer = defaultViewport->AddRenderer(resourceManager);
|
debugWorldRenderer = defaultViewport->AddRenderer(resourceManager, );
|
||||||
debugWorldRenderer->SetCamera(worldCamera);
|
debugWorldRenderer->SetCamera(worldCamera);
|
||||||
|
|
||||||
// Add world renderer to default viewport
|
// Add world renderer to default viewport
|
||||||
worldRenderer = defaultViewport->AddRenderer(resourceManager);
|
worldRenderer = defaultViewport->AddRenderer(resourceManager, );
|
||||||
worldRenderer->SetCamera(worldCamera);
|
worldRenderer->SetCamera(worldCamera);
|
||||||
|
|
||||||
// Get render graph from default viewport world renderer
|
// Get render graph from default viewport world renderer
|
||||||
|
|
|
@ -21,35 +21,33 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
SHRenderer::SHRenderer(Handle<SHViewport> viewport, ResourceManager& resourceManager)
|
SHRenderer::SHRenderer(Handle<SHViewport> viewport, Handle<SHRenderGraph> renderGraph)
|
||||||
: viewport { viewport }
|
: viewport { viewport }
|
||||||
, renderGraph { resourceManager.Create<SHRenderGraph> ()}
|
, renderGraph { renderGraph }
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Camera Registration */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
void SHRenderer::SetCamera(Handle<SHCamera> _camera)
|
||||||
|
{
|
||||||
|
camera = _camera;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Camera Registration */
|
/* Drawing Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void SHRenderer::SetCamera(Handle<SHCamera> _camera)
|
void SHRenderer::Draw(uint32_t frameIndex) noexcept
|
||||||
{
|
{
|
||||||
camera = _camera;
|
renderGraph->Execute(frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
Handle<SHRenderGraph> SHRenderer::GetRenderGraph(void) const noexcept
|
||||||
/* Drawing Functions */
|
{
|
||||||
/*---------------------------------------------------------------------------------*/
|
return renderGraph;
|
||||||
void SHRenderer::Draw(uint32_t frameIndex) noexcept
|
}
|
||||||
{
|
|
||||||
renderGraph->Execute(frameIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle<SHRenderGraph> SHRenderer::GetRenderGraph(void) const noexcept
|
|
||||||
{
|
|
||||||
return renderGraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
SHRenderer(Handle<SHViewport> viewport, ResourceManager& resourceManager);
|
SHRenderer(Handle<SHViewport> viewport, Handle<SHRenderGraph> renderGraph);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Camera Registration */
|
/* Camera Registration */
|
||||||
|
|
|
@ -48,10 +48,10 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Renderer Registration Functions */
|
/* Renderer Registration Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
Handle<SHRenderer> SHViewport::AddRenderer(ResourceManager& resourceManager)
|
Handle<SHRenderer> SHViewport::AddRenderer(ResourceManager& resourceManager, Handle<SHRenderGraph> renderGraph)
|
||||||
{
|
{
|
||||||
// Create the renderer
|
// Create the renderer
|
||||||
auto renderer = SHVkInstance::GetResourceManager().Create<SHRenderer>(GetHandle(), resourceManager);
|
auto renderer = SHVkInstance::GetResourceManager().Create<SHRenderer>(GetHandle(), renderGraph);
|
||||||
|
|
||||||
// Store
|
// Store
|
||||||
renderers.emplace_back(renderer);
|
renderers.emplace_back(renderer);
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Renderers Registration Functions */
|
/* Renderers Registration Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
Handle<SHRenderer> AddRenderer(ResourceManager& resourceManager);
|
Handle<SHRenderer> AddRenderer(ResourceManager& resourceManager, Handle<SHRenderGraph> renderGraph);
|
||||||
void RemoveRenderer(Handle<SHRenderer> renderer);
|
void RemoveRenderer(Handle<SHRenderer> renderer);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue