Added CaughtRaccoon state to AI FSM #449
|
@ -216,13 +216,13 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Get render graph from default viewport world renderer
|
||||
renderGraph = resourceManager->Create<SHRenderGraph>();
|
||||
renderGraph = resourceManager.Create<SHRenderGraph>();
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* WORLD RENDER GRAPH RESOURCES */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
// Initialize world render graph
|
||||
renderGraph->Init("World Render Graph", device, swapchain, resourceManager, renderContextCmdPools);
|
||||
renderGraph->Init("World Render Graph", device, swapchain, &resourceManager, renderContextCmdPools);
|
||||
renderGraph->AddResource("Position", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||
renderGraph->AddResource("Position World Space", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||
renderGraph->AddResource("Object VFX", { SH_RENDER_GRAPH_RESOURCE_FLAGS::COLOR, SH_RENDER_GRAPH_RESOURCE_FLAGS::INPUT, SH_RENDER_GRAPH_RESOURCE_FLAGS::STORAGE }, true, windowDims.first, windowDims.second, vk::Format::eR32G32B32A32Sfloat);
|
||||
|
@ -292,7 +292,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------*/
|
||||
/* SSAO PASS AND DATA INIT */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
ssaoStorage = resourceManager->Create<SHSSAO>();
|
||||
ssaoStorage = resourceManager.Create<SHSSAO>();
|
||||
|
||||
// command buffer operation to transfer data for ssao
|
||||
ssaoTransferCmdBuffer = graphicsCmdPool->RequestCommandBuffer(SH_CMD_BUFFER_TYPE::PRIMARY);
|
||||
|
@ -475,7 +475,7 @@ namespace SHADE
|
|||
void SHGraphicsSystem::InitSubsystems(void) noexcept
|
||||
{
|
||||
|
||||
mousePickSubSystem = resourceManager->Create<SHMousePickSystem>();
|
||||
mousePickSubSystem = resourceManager.Create<SHMousePickSystem>();
|
||||
|
||||
std::vector<Handle<SHVkCommandPool>> cmdPools;
|
||||
cmdPools.reserve(swapchain->GetNumImages());
|
||||
|
@ -486,28 +486,28 @@ namespace SHADE
|
|||
mousePickSubSystem->Init(device, cmdPools, renderGraph->GetRenderGraphResource("Entity ID"));
|
||||
|
||||
// Register the post offscreen render to the system
|
||||
postOffscreenRenderSubSystem = resourceManager->Create<SHPostOffscreenRenderSystem>();
|
||||
postOffscreenRenderSubSystem = resourceManager.Create<SHPostOffscreenRenderSystem>();
|
||||
postOffscreenRenderSubSystem->Init(device, renderGraph->GetRenderGraphResource("Scene"), descPool);
|
||||
|
||||
lightingSubSystem = resourceManager->Create<SHLightingSubSystem>();
|
||||
lightingSubSystem->Init(device, descPool, resourceManager, samplerCache.GetSampler (device, SHVkSamplerParams
|
||||
lightingSubSystem = resourceManager.Create<SHLightingSubSystem>();
|
||||
lightingSubSystem->Init(device, descPool, &resourceManager, samplerCache.GetSampler (device, SHVkSamplerParams
|
||||
{
|
||||
.addressMode = vk::SamplerAddressMode::eClampToBorder,
|
||||
})
|
||||
);
|
||||
|
||||
textRenderingSubSystem = resourceManager->Create<SHTextRenderingSubSystem>();
|
||||
textRenderingSubSystem = resourceManager.Create<SHTextRenderingSubSystem>();
|
||||
|
||||
// initialize the text renderer
|
||||
auto uiNode = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::SCREEN_SPACE_PASS.data());
|
||||
textRenderingSubSystem->Init(device, uiNode->GetRenderpass(), uiNode->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::UI_TRANSLUCENT_SUBPASS), descPool, textVS, textFS);
|
||||
|
||||
trajectoryRenderingSubSystem = resourceManager->Create<SHTrajectoryRenderingSubSystem>();
|
||||
trajectoryRenderingSubSystem = resourceManager.Create<SHTrajectoryRenderingSubSystem>();
|
||||
|
||||
auto vfxPass = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::VFX_PASS.data());
|
||||
|
||||
// particle sub system initialization
|
||||
particleSubSystem = resourceManager->Create<SHParticleSubSystem>();
|
||||
particleSubSystem = resourceManager.Create<SHParticleSubSystem>();
|
||||
particleSubSystem->Init(device, descPool, vfxPass->GetRenderpass(), vfxPass->GetSubpass(SHGraphicsConstants::RenderGraphEntityNames::VFX_SUBPASS), particleVS, particleFS, particleEmitCS, particleUpdateCS);
|
||||
|
||||
auto vfxNode = renderGraph->GetNode(SHGraphicsConstants::RenderGraphEntityNames::VFX_PASS.data());
|
||||
|
@ -608,9 +608,6 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
void SHGraphicsSystem::Init(void)
|
||||
{
|
||||
// Create resource manager
|
||||
resourceManager = new SHResourceHub();
|
||||
|
||||
InitBoilerplate();
|
||||
InitMiddleEnd();
|
||||
InitSubsystems();
|
||||
|
@ -870,7 +867,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Create the renderer
|
||||
auto renderer = resourceManager->Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, projectionType);
|
||||
auto renderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, projectionType);
|
||||
|
||||
// Store
|
||||
renderers.emplace_back(renderer);
|
||||
|
@ -914,7 +911,7 @@ namespace SHADE
|
|||
|
||||
|
||||
// Create new renderer for the light component and give it to the light component
|
||||
Handle<SHRenderer> newRenderer = resourceManager->Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, SHRenderer::PROJECTION_TYPE::ORTHOGRAPHIC);
|
||||
Handle<SHRenderer> newRenderer = resourceManager.Create<SHRenderer>(device, swapchain->GetNumImages(), descPool, SHRenderer::PROJECTION_TYPE::ORTHOGRAPHIC);
|
||||
lightComp->SetRenderer(newRenderer);
|
||||
|
||||
// Add the shadow map resource to the graph
|
||||
|
@ -1061,7 +1058,7 @@ namespace SHADE
|
|||
auto shaderPair = std::make_pair(vertShader, fragShader);
|
||||
|
||||
// Create material
|
||||
auto mat = resourceManager->Create<SHMaterial>();
|
||||
auto mat = resourceManager.Create<SHMaterial>();
|
||||
|
||||
auto renderGraphNode = subpass->GetParentNode();
|
||||
auto pipeline = renderGraphNode->GetOrCreatePipeline(std::make_pair(vertShader, fragShader), subpass);
|
||||
|
@ -1075,12 +1072,12 @@ namespace SHADE
|
|||
|
||||
void SHGraphicsSystem::RemoveMaterial(Handle<SHMaterial> material)
|
||||
{
|
||||
resourceManager->Free(material);
|
||||
resourceManager.Free(material);
|
||||
}
|
||||
|
||||
Handle<SHMaterialInstance> SHGraphicsSystem::AddOrGetBaseMaterialInstance(Handle<SHMaterial> material)
|
||||
{
|
||||
return materialInstanceCache.CreateOrGet(*resourceManager, material);
|
||||
return materialInstanceCache.CreateOrGet(resourceManager, material);
|
||||
}
|
||||
|
||||
SHADE::Handle<SHADE::SHMaterialInstance> SHGraphicsSystem::AddOrGetBaseMaterialInstance()
|
||||
|
@ -1090,17 +1087,17 @@ namespace SHADE
|
|||
|
||||
SHADE::Handle<SHADE::SHMaterialInstance> SHGraphicsSystem::AddMaterialInstanceCopy(Handle<SHMaterialInstance> materialInst)
|
||||
{
|
||||
return resourceManager->Create<SHMaterialInstance>(materialInst->GetBaseMaterial());
|
||||
return resourceManager.Create<SHMaterialInstance>(materialInst->GetBaseMaterial());
|
||||
}
|
||||
|
||||
std::pair<typename SHResourceHub::dense_iterator<SHMaterialInstance>, typename SHResourceHub::dense_iterator<SHMaterialInstance>> SHGraphicsSystem::GetAllMaterialInstances()
|
||||
{
|
||||
return resourceManager->GetDenseAccess<SHMaterialInstance>();
|
||||
return resourceManager.GetDenseAccess<SHMaterialInstance>();
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::RemoveMaterialInstance(Handle<SHMaterialInstance> materialInstance)
|
||||
{
|
||||
resourceManager->Free(materialInstance);
|
||||
resourceManager.Free(materialInstance);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -1192,12 +1189,12 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
Handle<SHFont> SHGraphicsSystem::AddFont(SHFontAsset const& fontAsset) noexcept
|
||||
{
|
||||
return fontLibrary.AddFont(device, *resourceManager, fontAsset);
|
||||
return fontLibrary.AddFont(device, resourceManager, fontAsset);
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::BuildFonts(void) noexcept
|
||||
{
|
||||
fontLibrary.BuildFonts(device, graphicsQueue, graphicsCmdPool, descPool, SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes::FONT)[0], *resourceManager);
|
||||
fontLibrary.BuildFonts(device, graphicsQueue, graphicsCmdPool, descPool, SHGraphicsPredefinedData::GetPredefinedDescSetLayouts(SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes::FONT)[0], resourceManager);
|
||||
}
|
||||
|
||||
#pragma endregion ADD_REMOVE
|
||||
|
@ -1241,7 +1238,7 @@ namespace SHADE
|
|||
|
||||
// Reset all material isDirty
|
||||
auto gfxSystem = reinterpret_cast<SHGraphicsSystem*>(system);
|
||||
auto [matBegin, matEnd] = gfxSystem->resourceManager->GetDenseAccess<SHMaterial>();
|
||||
auto [matBegin, matEnd] = gfxSystem->resourceManager.GetDenseAccess<SHMaterial>();
|
||||
for (auto iter = matBegin; iter != matEnd; ++iter)
|
||||
{
|
||||
iter->ClearChangeFlag();
|
||||
|
@ -1259,7 +1256,7 @@ namespace SHADE
|
|||
|
||||
// Clean up and update all materials
|
||||
auto gfxSystem = reinterpret_cast<SHGraphicsSystem*>(system);
|
||||
auto [matInstBegin, matInstEnd] = gfxSystem->resourceManager->GetDenseAccess<SHMaterialInstance>();
|
||||
auto [matInstBegin, matInstEnd] = gfxSystem->resourceManager.GetDenseAccess<SHMaterialInstance>();
|
||||
for (auto iter = matInstBegin; iter != matInstEnd; ++iter)
|
||||
{
|
||||
auto baseMat = iter->GetBaseMaterial();
|
||||
|
@ -1312,7 +1309,7 @@ namespace SHADE
|
|||
|
||||
// Unset all material old pipeline since we would have finished processing
|
||||
auto gfxSystem = reinterpret_cast<SHGraphicsSystem*>(system);
|
||||
auto [matBegin, matEnd] = gfxSystem->resourceManager->GetDenseAccess<SHMaterial>();
|
||||
auto [matBegin, matEnd] = gfxSystem->resourceManager.GetDenseAccess<SHMaterial>();
|
||||
for (auto iter = matBegin; iter != matEnd; ++iter)
|
||||
{
|
||||
iter->ForgetOldPipeline();
|
||||
|
@ -1452,7 +1449,7 @@ namespace SHADE
|
|||
|
||||
Handle<SHVkPipeline> SHGraphicsSystem::createDebugDrawPipeline(Handle<SHVkRenderpass> renderPass, Handle<SHSubpass> subpass, bool filled, bool triMesh, bool instanced)
|
||||
{
|
||||
auto pipelineLayout = resourceManager->Create<SHVkPipelineLayout>
|
||||
auto pipelineLayout = resourceManager.Create<SHVkPipelineLayout>
|
||||
(
|
||||
device, SHPipelineLayoutParams
|
||||
{
|
||||
|
@ -1460,7 +1457,7 @@ namespace SHADE
|
|||
.predefinedDescSetLayouts = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING).descSetLayouts
|
||||
}
|
||||
);
|
||||
auto pipeline = resourceManager->Create<SHVkPipeline>(device, pipelineLayout, nullptr, renderPass, subpass);
|
||||
auto pipeline = resourceManager.Create<SHVkPipeline>(device, pipelineLayout, nullptr, renderPass, subpass);
|
||||
pipeline->GetPipelineState().SetRasterizationState(SHRasterizationState
|
||||
{
|
||||
.polygonMode = filled ? vk::PolygonMode::eFill : vk::PolygonMode::eLine,
|
||||
|
|
|
@ -440,7 +440,7 @@ namespace SHADE
|
|||
SHWindow* window = nullptr;
|
||||
|
||||
// Middle End Resources
|
||||
SHResourceHub* resourceManager;
|
||||
SHResourceHub resourceManager;
|
||||
SHMeshLibrary meshLibrary;
|
||||
SHTextureLibrary texLibrary;
|
||||
SHGraphicsGenericData graphicsGenericData;
|
||||
|
|
Loading…
Reference in New Issue