The Great SHRenaming #103
|
@ -13,7 +13,7 @@
|
||||||
#include "ECS_Base/SHECSMacros.h"
|
#include "ECS_Base/SHECSMacros.h"
|
||||||
#include "ECS_Base/System/SHSystem.h"
|
#include "ECS_Base/System/SHSystem.h"
|
||||||
#include "ECS_Base/System/SHSystemRoutine.h"
|
#include "ECS_Base/System/SHSystemRoutine.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "EditorWindow/SHEditorWindow.h"
|
#include "EditorWindow/SHEditorWindow.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/SHLogger.h"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "vk_mem_alloc.h"
|
#include "vk_mem_alloc.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Graphics/SHVulkanDefines.h"
|
#include "Graphics/SHVulkanDefines.h"
|
||||||
#include "SHCommandPoolResetMode.h"
|
#include "SHCommandPoolResetMode.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -36,7 +36,7 @@ namespace SHADE
|
||||||
class SHVkCommandBuffer
|
class SHVkCommandBuffer
|
||||||
{
|
{
|
||||||
friend class SHVkCommandPool;
|
friend class SHVkCommandPool;
|
||||||
friend class ResourceLibrary<SHVkCommandBuffer>;
|
friend class SHResourceLibrary<SHVkCommandBuffer>;
|
||||||
|
|
||||||
static constexpr uint16_t PUSH_CONSTANT_SIZE = 512;
|
static constexpr uint16_t PUSH_CONSTANT_SIZE = 512;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "SHVkCommandPool.h"
|
#include "SHVkCommandPool.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/SHLogger.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "Graphics/Queues/SHVkQueue.h"
|
#include "Graphics/Queues/SHVkQueue.h"
|
||||||
#include "SHCommandPoolResetMode.h"
|
#include "SHCommandPoolResetMode.h"
|
||||||
#include "SHVkCommandBuffer.h"
|
#include "SHVkCommandBuffer.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/Shaders/SHShaderReflected.h"
|
#include "Graphics/Shaders/SHShaderReflected.h"
|
||||||
#include "SHDescriptorSetUpdater.h"
|
#include "SHDescriptorSetUpdater.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
||||||
#include "Graphics/Queues/SHVkQueue.h"
|
#include "Graphics/Queues/SHVkQueue.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Graphics/Swapchain/SHSwapchainParams.h"
|
#include "Graphics/Swapchain/SHSwapchainParams.h"
|
||||||
#include "Graphics/Commands/SHCommandPoolResetMode.h"
|
#include "Graphics/Commands/SHCommandPoolResetMode.h"
|
||||||
#include "Graphics/Commands/SHVkCommandPool.h"
|
#include "Graphics/Commands/SHVkCommandPool.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_FRAMEBUFFER_H
|
#define SH_VK_FRAMEBUFFER_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "SHImageViewDetails.h"
|
#include "SHImageViewDetails.h"
|
||||||
#include "Graphics/SHVulkanDefines.h"
|
#include "Graphics/SHVulkanDefines.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "vk_mem_alloc.h"
|
#include "vk_mem_alloc.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_IMAGE_VIEW_H
|
#define SH_VK_IMAGE_VIEW_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "SHImageViewDetails.h"
|
#include "SHImageViewDetails.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include <vector>
|
#include <vector>
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace SHADE
|
||||||
bool SHVkInstance::validationLayersOn;
|
bool SHVkInstance::validationLayersOn;
|
||||||
vk::Instance SHVkInstance::vkInstance;
|
vk::Instance SHVkInstance::vkInstance;
|
||||||
SHVkDebugMessenger SHVkInstance::debugMessenger;
|
SHVkDebugMessenger SHVkInstance::debugMessenger;
|
||||||
ResourceManager SHVkInstance::resourceManager;
|
SHResourceHub SHVkInstance::resourceManager;
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
|
@ -258,7 +258,7 @@ namespace SHADE
|
||||||
return vkInstance;
|
return vkInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceManager& SHVkInstance::GetResourceManager(void) noexcept
|
SHResourceHub& SHVkInstance::GetResourceManager(void) noexcept
|
||||||
{
|
{
|
||||||
return resourceManager;
|
return resourceManager;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ written consent of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/Debugging/SHVkDebugMessenger.h"
|
#include "Graphics/Debugging/SHVkDebugMessenger.h"
|
||||||
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
#include "Graphics/Devices/SHVkPhysicalDevice.h"
|
||||||
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
#include "Graphics/Devices/SHVkLogicalDevice.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -61,7 +61,7 @@ namespace SHADE
|
||||||
static SHVkDebugMessenger debugMessenger;
|
static SHVkDebugMessenger debugMessenger;
|
||||||
|
|
||||||
//! Resource management for vulkan project
|
//! Resource management for vulkan project
|
||||||
static ResourceManager resourceManager;
|
static SHResourceHub resourceManager;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* PRIVATE MEMBER FUNCTIONS */
|
/* PRIVATE MEMBER FUNCTIONS */
|
||||||
|
@ -85,7 +85,7 @@ namespace SHADE
|
||||||
/* Getters and Setters */
|
/* Getters and Setters */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
static vk::Instance const& GetVkInstance (void) noexcept;
|
static vk::Instance const& GetVkInstance (void) noexcept;
|
||||||
static ResourceManager& GetResourceManager(void) noexcept;
|
static SHResourceHub& GetResourceManager(void) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterial.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterial.h"
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h"
|
#include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h"
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// STL Includes
|
// STL Includes
|
||||||
#include <vector>
|
#include <vector>
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "SHBatch.h"
|
#include "SHBatch.h"
|
||||||
#include "Graphics/Pipeline/SHVkPipeline.h"
|
#include "Graphics/Pipeline/SHVkPipeline.h"
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Graphics/MiddleEnd/PerFrame/SHRenderContext.h"
|
#include "Graphics/MiddleEnd/PerFrame/SHRenderContext.h"
|
||||||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||||
|
@ -313,7 +313,7 @@ namespace SHADE
|
||||||
SHWindow* window = nullptr;
|
SHWindow* window = nullptr;
|
||||||
|
|
||||||
// Middle End Resources
|
// Middle End Resources
|
||||||
ResourceManager resourceManager;
|
SHResourceHub resourceManager;
|
||||||
SHMeshLibrary meshLibrary;
|
SHMeshLibrary meshLibrary;
|
||||||
SHTextureLibrary texLibrary;
|
SHTextureLibrary texLibrary;
|
||||||
SHSamplerCache samplerCache;
|
SHSamplerCache samplerCache;
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// STL Includes
|
// STL Includes
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "SHCommonTypes.h"
|
#include "SHCommonTypes.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -13,7 +13,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// STL Includes
|
// STL Includes
|
||||||
#include <memory>
|
#include <memory>
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/Shaders/BlockInterface/SHShaderBlockInterface.h"
|
#include "Graphics/Shaders/BlockInterface/SHShaderBlockInterface.h"
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// STL Includes
|
// STL Includes
|
||||||
#include <vector>
|
#include <vector>
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Math/SHMath.h"
|
#include "Math/SHMath.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -167,7 +167,7 @@ namespace SHADE
|
||||||
std::vector<MeshAddJob> meshAddJobs;
|
std::vector<MeshAddJob> meshAddJobs;
|
||||||
std::vector<Handle<SHMesh>> meshRemoveJobs;
|
std::vector<Handle<SHMesh>> meshRemoveJobs;
|
||||||
// Tracking
|
// Tracking
|
||||||
ResourceLibrary<SHMesh> meshes{};
|
SHResourceLibrary<SHMesh> meshes{};
|
||||||
std::vector<Handle<SHMesh>> meshOrder;
|
std::vector<Handle<SHMesh>> meshOrder;
|
||||||
// CPU Storage
|
// CPU Storage
|
||||||
std::vector<SHMesh::VertexPosition> vertPosStorage;
|
std::vector<SHMesh::VertexPosition> vertPosStorage;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
//#include "SHTransform.h"
|
//#include "SHTransform.h"
|
||||||
#include "ECS_Base/Components/SHComponent.h"
|
#include "ECS_Base/Components/SHComponent.h"
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
|
|
|
@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "SHCamera.h"
|
#include "SHCamera.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||||
#include "Math/SHMath.h"
|
#include "Math/SHMath.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/Instance/SHVkInstance.h"
|
#include "Graphics/Instance/SHVkInstance.h"
|
||||||
#include "Tools/SHLogger.h"
|
#include "Tools/SHLogger.h"
|
||||||
#include "SHRenderer.h"
|
#include "SHRenderer.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -49,7 +49,7 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Renderer Registration Functions */
|
/* Renderer Registration Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
Handle<SHRenderer> SHViewport::AddRenderer(ResourceManager& resourceManager, uint32_t numFrames, std::vector<Handle<SHVkCommandPool>>& cmdPools, Handle<SHVkDescriptorPool> descriptorPool, Handle<SHVkDescriptorSetLayout> cameraDescLayout, Handle<SHRenderGraph> renderGraph)
|
Handle<SHRenderer> SHViewport::AddRenderer(SHResourceHub& resourceManager, uint32_t numFrames, std::vector<Handle<SHVkCommandPool>>& cmdPools, Handle<SHVkDescriptorPool> descriptorPool, Handle<SHVkDescriptorSetLayout> cameraDescLayout, Handle<SHRenderGraph> renderGraph)
|
||||||
{
|
{
|
||||||
// Create the renderer
|
// Create the renderer
|
||||||
auto renderer = resourceManager.Create<SHRenderer>(device, numFrames, cmdPools, descriptorPool, cameraDescLayout, GetHandle(), renderGraph);
|
auto renderer = resourceManager.Create<SHRenderer>(device, numFrames, cmdPools, descriptorPool, cameraDescLayout, GetHandle(), renderGraph);
|
||||||
|
|
|
@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ namespace SHADE
|
||||||
class SHVkCommandBuffer;
|
class SHVkCommandBuffer;
|
||||||
class SHVkLogicalDevice;
|
class SHVkLogicalDevice;
|
||||||
class SHVkImageView;
|
class SHVkImageView;
|
||||||
class ResourceManager;
|
class SHResourceHub;
|
||||||
class SHRenderGraph;
|
class SHRenderGraph;
|
||||||
class SHVkDescriptorPool;
|
class SHVkDescriptorPool;
|
||||||
class SHVkDescriptorSetLayout;
|
class SHVkDescriptorSetLayout;
|
||||||
|
@ -59,7 +59,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Renderers Registration Functions */
|
/* Renderers Registration Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
Handle<SHRenderer> AddRenderer(ResourceManager& resourceManager, uint32_t numFrames, std::vector<Handle<SHVkCommandPool>>& cmdPools, Handle<SHVkDescriptorPool> descriptorPool, Handle<SHVkDescriptorSetLayout> cameraDescLayout, Handle<SHRenderGraph> renderGraph);
|
Handle<SHRenderer> AddRenderer(SHResourceHub& resourceManager, uint32_t numFrames, std::vector<Handle<SHVkCommandPool>>& cmdPools, Handle<SHVkDescriptorPool> descriptorPool, Handle<SHVkDescriptorSetLayout> cameraDescLayout, Handle<SHRenderGraph> renderGraph);
|
||||||
void RemoveRenderer(Handle<SHRenderer> renderer);
|
void RemoveRenderer(Handle<SHRenderer> renderer);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -14,7 +14,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "SHMaterialInstanceCache.h"
|
#include "SHMaterialInstanceCache.h"
|
||||||
|
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -22,7 +22,7 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
SHADE::Handle<SHADE::SHMaterialInstance> SHMaterialInstanceCache::CreateOrGet(ResourceManager& manager, Handle<SHMaterial> material)
|
SHADE::Handle<SHADE::SHMaterialInstance> SHMaterialInstanceCache::CreateOrGet(SHResourceHub& manager, Handle<SHMaterial> material)
|
||||||
{
|
{
|
||||||
// Check if there is already an existing instance
|
// Check if there is already an existing instance
|
||||||
auto matInst = cache.find(material);
|
auto matInst = cache.find(material);
|
||||||
|
|
|
@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// STL Includes
|
// STL Includes
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
class SHMaterial;
|
class SHMaterial;
|
||||||
class SHMaterialInstance;
|
class SHMaterialInstance;
|
||||||
class ResourceManager;
|
class SHResourceHub;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions */
|
||||||
|
@ -56,7 +56,7 @@ namespace SHADE
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
Handle<SHMaterialInstance> CreateOrGet(ResourceManager& manager, Handle<SHMaterial> material);
|
Handle<SHMaterialInstance> CreateOrGet(SHResourceHub& manager, Handle<SHMaterial> material);
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include "tinyddsloader.h"
|
#include "tinyddsloader.h"
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Math/SHMath.h"
|
#include "Math/SHMath.h"
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ namespace SHADE
|
||||||
std::vector<AddJob> addJobs;
|
std::vector<AddJob> addJobs;
|
||||||
std::vector<Handle<SHTexture>> removeJobs;
|
std::vector<Handle<SHTexture>> removeJobs;
|
||||||
// Tracking
|
// Tracking
|
||||||
ResourceManager resourceManager;
|
SHResourceHub resourceManager;
|
||||||
std::vector<Handle<SHTexture>> texOrder;
|
std::vector<Handle<SHTexture>> texOrder;
|
||||||
// CPU Storage
|
// CPU Storage
|
||||||
std::vector<std::tuple<Handle<SHVkImageView>, Handle<SHVkSampler>, vk::ImageLayout>> combinedImageSamplers;
|
std::vector<std::tuple<Handle<SHVkImageView>, Handle<SHVkSampler>, vk::ImageLayout>> combinedImageSamplers;
|
||||||
|
|
|
@ -16,7 +16,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// External Dependencies
|
// External Dependencies
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_PIPELINE_LAYOUT_PARAMS_H
|
#define SH_PIPELINE_LAYOUT_PARAMS_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
#include "Graphics/Descriptors/SHVkDescriptorSetLayout.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "SHPipelineState.h"
|
#include "SHPipelineState.h"
|
||||||
#include "SHPipelineType.h"
|
#include "SHPipelineType.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
#include "Graphics/Pipeline/SHVkPipelineLayout.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Graphics/SHVulkanDefines.h"
|
#include "Graphics/SHVulkanDefines.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -367,7 +367,7 @@ namespace SHADE
|
||||||
, graphResources{}
|
, graphResources{}
|
||||||
, resourceManager{nullptr}
|
, resourceManager{nullptr}
|
||||||
{
|
{
|
||||||
resourceManager = std::make_shared<ResourceManager>();
|
resourceManager = std::make_shared<SHResourceHub>();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHRenderGraph::SHRenderGraph(SHRenderGraph&& rhs) noexcept
|
SHRenderGraph::SHRenderGraph(SHRenderGraph&& rhs) noexcept
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_RENDER_GRAPH_H
|
#define SH_RENDER_GRAPH_H
|
||||||
|
|
||||||
#include "Graphics/Renderpass/SHVkRenderpass.h"
|
#include "Graphics/Renderpass/SHVkRenderpass.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
#include "Graphics/MiddleEnd/Pipeline/SHPipelineLibrary.h"
|
#include "Graphics/MiddleEnd/Pipeline/SHPipelineLibrary.h"
|
||||||
#include "Graphics/MiddleEnd/Batching/SHSuperBatch.h"
|
#include "Graphics/MiddleEnd/Batching/SHSuperBatch.h"
|
||||||
|
@ -71,7 +71,7 @@ namespace SHADE
|
||||||
std::unordered_map<std::string, Handle<SHRenderGraphResource>> graphResources;
|
std::unordered_map<std::string, Handle<SHRenderGraphResource>> graphResources;
|
||||||
|
|
||||||
//! Resource library for graph handles
|
//! Resource library for graph handles
|
||||||
std::shared_ptr<ResourceManager> resourceManager;
|
std::shared_ptr<SHResourceHub> resourceManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace SHADE
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
SHRenderGraphNode::SHRenderGraphNode(std::shared_ptr<ResourceManager> rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
SHRenderGraphNode::SHRenderGraphNode(std::shared_ptr<SHResourceHub> rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept
|
||||||
: logicalDeviceHdl{ logicalDevice }
|
: logicalDeviceHdl{ logicalDevice }
|
||||||
, renderpass{}
|
, renderpass{}
|
||||||
, framebuffers{}
|
, framebuffers{}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
class ResourceManager;
|
class SHResourceHub;
|
||||||
class SHVkFramebuffer;
|
class SHVkFramebuffer;
|
||||||
class SHRenderGraphResource;
|
class SHRenderGraphResource;
|
||||||
class SHVkLogicalDevice;
|
class SHVkLogicalDevice;
|
||||||
|
@ -26,7 +26,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* PRIVATE MEMBER VARIABLES */
|
/* PRIVATE MEMBER VARIABLES */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
std::shared_ptr<ResourceManager> resourceManager;
|
std::shared_ptr<SHResourceHub> resourceManager;
|
||||||
|
|
||||||
//! For Vulkan object creation
|
//! For Vulkan object creation
|
||||||
Handle<SHVkLogicalDevice> logicalDeviceHdl;
|
Handle<SHVkLogicalDevice> logicalDeviceHdl;
|
||||||
|
@ -88,7 +88,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* CTORS AND DTORS */
|
/* CTORS AND DTORS */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
SHRenderGraphNode(std::shared_ptr<ResourceManager> rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept;
|
SHRenderGraphNode(std::shared_ptr<SHResourceHub> rm, Handle<SHVkLogicalDevice> const& logicalDevice, Handle<SHVkSwapchain> const& swapchain, std::vector<SHAttachmentDescInitParams> attDescInitParams, std::vector<Handle<SHRenderGraphNode>> predecessors, std::unordered_map<std::string, Handle<SHRenderGraphResource>> const* resources) noexcept;
|
||||||
SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept;
|
SHRenderGraphNode(SHRenderGraphNode&& rhs) noexcept;
|
||||||
SHRenderGraphNode& operator= (SHRenderGraphNode&& rhs) noexcept;
|
SHRenderGraphNode& operator= (SHRenderGraphNode&& rhs) noexcept;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "SHAttachmentDescriptionType.h"
|
#include "SHAttachmentDescriptionType.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace SHADE
|
||||||
exteriorDrawCalls.push_back(newDrawCall);
|
exteriorDrawCalls.push_back(newDrawCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHSubpass::Init(ResourceManager& resourceManager) noexcept
|
void SHSubpass::Init(SHResourceHub& resourceManager) noexcept
|
||||||
{
|
{
|
||||||
superBatch = resourceManager.Create<SHSuperBatch>(GetHandle());
|
superBatch = resourceManager.Create<SHSuperBatch>(GetHandle());
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "SHAttachmentDescriptionType.h"
|
#include "SHAttachmentDescriptionType.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ namespace SHADE
|
||||||
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
void Execute(Handle<SHVkCommandBuffer>& commandBuffer, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||||
void AddExteriorDrawCalls(std::function<void(Handle<SHVkCommandBuffer>&)> const& newDrawCall) noexcept;
|
void AddExteriorDrawCalls(std::function<void(Handle<SHVkCommandBuffer>&)> const& newDrawCall) noexcept;
|
||||||
|
|
||||||
void Init(ResourceManager& resourceManager) noexcept;
|
void Init(SHResourceHub& resourceManager) noexcept;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* GETTERS AND SETTERS */
|
/* GETTERS AND SETTERS */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Resource/Handle.h>
|
#include <Resource/SHHandle.h>
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_ATTACHMENT_DESC_GEN_H
|
#define SH_VK_ATTACHMENT_DESC_GEN_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "SHVkAttachDescGen.h"
|
#include "SHVkAttachDescGen.h"
|
||||||
#include "SHVkSubpassParams.h"
|
#include "SHVkSubpassParams.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_SUBPASS_PARAMS_H
|
#define SH_VK_SUBPASS_PARAMS_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "SHVulkanIncludes.h"
|
#include "SHVulkanIncludes.h"
|
||||||
|
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_SHADER_MODULE_H
|
#define SH_VK_SHADER_MODULE_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "SHShaderReflected.h"
|
#include "SHShaderReflected.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
#include "Graphics/Swapchain/SHSwapchainParams.h"
|
#include "Graphics/Swapchain/SHSwapchainParams.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_FENCE_H
|
#define SH_VK_FENCE_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SH_VK_SEMAPHORE_H
|
#define SH_VK_SEMAPHORE_H
|
||||||
|
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/Handle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "Graphics/SHVulkanIncludes.h"
|
#include "Graphics/SHVulkanIncludes.h"
|
||||||
#include "Resource/ResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace SHADE
|
||||||
/* Forward Declarations */
|
/* Forward Declarations */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ResourceLibrary;
|
class SHResourceLibrary;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions */
|
||||||
|
@ -140,12 +140,12 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
ResourceLibrary<T>* library = nullptr;
|
SHResourceLibrary<T>* library = nullptr;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Friend Declarations */
|
/* Friend Declarations */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
friend class ResourceLibrary<T>;
|
friend class SHResourceLibrary<T>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -183,7 +183,7 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rscLib">Required to lock usage to ResourceLibrary only.</param>
|
/// <param name="rscLib">Required to lock usage to ResourceLibrary only.</param>
|
||||||
/// <param name="hdl">Handle to set.</param>
|
/// <param name="hdl">Handle to set.</param>
|
||||||
void SetHandle(const ResourceLibrary<T>& rscLib, Handle<T> hdl);
|
void SetHandle(const SHResourceLibrary<T>& rscLib, Handle<T> hdl);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -220,4 +220,4 @@ namespace std
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "Handle.hpp"
|
#include "SHHandle.hpp"
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
// Primary Header
|
// Primary Header
|
||||||
#include "Handle.h"
|
#include "SHHandle.h"
|
||||||
#include "ResourceLibrary.h"
|
#include "SHResourceLibrary.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,7 @@ namespace SHADE
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void ISelfHandle<T>::SetHandle(const ResourceLibrary<T>&, Handle<T> hdl)
|
inline void ISelfHandle<T>::SetHandle(const SHResourceLibrary<T>&, Handle<T> hdl)
|
||||||
{
|
{
|
||||||
handle = hdl;
|
handle = hdl;
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
#include "SHPch.h"
|
#include "SHPch.h"
|
||||||
#include "ResourceLibrary.h"
|
#include "SHResourceLibrary.h"
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constructors/Destructors */
|
/* Constructors/Destructors */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
ResourceManager::~ResourceManager()
|
SHResourceHub::~SHResourceHub()
|
||||||
{
|
{
|
||||||
// Delete all resources libraries
|
// Delete all resources libraries
|
||||||
for (auto iter = deleters.rbegin(); iter != deleters.rend(); ++iter)
|
for (auto iter = deleters.rbegin(); iter != deleters.rend(); ++iter)
|
|
@ -6,7 +6,7 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "Handle.h"
|
#include "SHHandle.h"
|
||||||
#include "Resource/SparseSet.h"
|
#include "Resource/SparseSet.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -17,13 +17,13 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type of resources that this library stores.</typeparam>
|
/// <typeparam name="T">Type of resources that this library stores.</typeparam>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ResourceLibrary
|
class SHResourceLibrary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
ResourceLibrary();
|
SHResourceLibrary();
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
@ -75,13 +75,13 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages all resources in multiple ResourceLibraries.
|
/// Manages all resources in multiple ResourceLibraries.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ResourceManager final
|
class SHResourceHub final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constructors/Destructors */
|
/* Constructors/Destructors */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
~ResourceManager();
|
~SHResourceHub();
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
@ -136,10 +136,10 @@ namespace SHADE
|
||||||
/* Helper Functions */
|
/* Helper Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ResourceLibrary<T>& getLibrary();
|
SHResourceLibrary<T>& getLibrary();
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const ResourceLibrary<T>& getLibrary() const;
|
const SHResourceLibrary<T>& getLibrary() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "ResourceLibrary.hpp"
|
#include "SHResourceLibrary.hpp"
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
// Primary Header
|
// Primary Header
|
||||||
#include "ResourceLibrary.h"
|
#include "SHResourceLibrary.h"
|
||||||
// Standard Library
|
// Standard Library
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace SHADE
|
||||||
/* ResourceLibrary - Constructor */
|
/* ResourceLibrary - Constructor */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
ResourceLibrary<T>::ResourceLibrary()
|
SHResourceLibrary<T>::SHResourceLibrary()
|
||||||
{
|
{
|
||||||
// Type Checking
|
// Type Checking
|
||||||
//static_assert(std::is_copy_assignable_v<T>, "Resource Library's resources must be copy assignable.");
|
//static_assert(std::is_copy_assignable_v<T>, "Resource Library's resources must be copy assignable.");
|
||||||
|
@ -24,7 +24,7 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename ... Args>
|
template <typename ... Args>
|
||||||
Handle<T> ResourceLibrary<T>::Create(Args&&... args)
|
Handle<T> SHResourceLibrary<T>::Create(Args&&... args)
|
||||||
{
|
{
|
||||||
// Create the handle
|
// Create the handle
|
||||||
Handle<T> handle;
|
Handle<T> handle;
|
||||||
|
@ -55,7 +55,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ResourceLibrary<T>::Free(Handle<T> handle)
|
void SHResourceLibrary<T>::Free(Handle<T> handle)
|
||||||
{
|
{
|
||||||
assertHandleValid(handle);
|
assertHandleValid(handle);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& ResourceLibrary<T>::Get(Handle<T> handle)
|
T& SHResourceLibrary<T>::Get(Handle<T> handle)
|
||||||
{
|
{
|
||||||
assertHandleValid(handle);
|
assertHandleValid(handle);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T& ResourceLibrary<T>::Get(Handle<T> handle) const
|
const T& SHResourceLibrary<T>::Get(Handle<T> handle) const
|
||||||
{
|
{
|
||||||
assertHandleValid(handle);
|
assertHandleValid(handle);
|
||||||
|
|
||||||
|
@ -82,14 +82,14 @@ namespace SHADE
|
||||||
/* ResourceLibrary - Helper Functions */
|
/* ResourceLibrary - Helper Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ResourceLibrary<T>::assertHandleValid(Handle<T> handle) const
|
void SHResourceLibrary<T>::assertHandleValid(Handle<T> handle) const
|
||||||
{
|
{
|
||||||
if (!handle || handle.id.Data.Version != versionCounts[handle.id.Data.Index])
|
if (!handle || handle.id.Data.Version != versionCounts[handle.id.Data.Index])
|
||||||
throw std::invalid_argument("Invalid handle provided!");
|
throw std::invalid_argument("Invalid handle provided!");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline uint32_t ResourceLibrary<T>::getAvailableFreeIndex()
|
inline uint32_t SHResourceLibrary<T>::getAvailableFreeIndex()
|
||||||
{
|
{
|
||||||
// Get from the free list if present
|
// Get from the free list if present
|
||||||
if (!freeList.empty())
|
if (!freeList.empty())
|
||||||
|
@ -107,25 +107,25 @@ namespace SHADE
|
||||||
/* ResourceManager - Usage Functions */
|
/* ResourceManager - Usage Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template <typename T, typename ... Args>
|
template <typename T, typename ... Args>
|
||||||
Handle<T> ResourceManager::Create(Args&&... args)
|
Handle<T> SHResourceHub::Create(Args&&... args)
|
||||||
{
|
{
|
||||||
return getLibrary<T>().Create(std::forward<Args>(args) ...);
|
return getLibrary<T>().Create(std::forward<Args>(args) ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ResourceManager::Free(Handle<T> handle)
|
void SHResourceHub::Free(Handle<T> handle)
|
||||||
{
|
{
|
||||||
getLibrary<T>().Free(handle);
|
getLibrary<T>().Free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& ResourceManager::Get(Handle<T> handle)
|
T& SHResourceHub::Get(Handle<T> handle)
|
||||||
{
|
{
|
||||||
return getLibrary<T>().Get(handle);
|
return getLibrary<T>().Get(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T& ResourceManager::Get(Handle<T> handle) const
|
const T& SHResourceHub::Get(Handle<T> handle) const
|
||||||
{
|
{
|
||||||
return getLibrary<T>().Get(handle);
|
return getLibrary<T>().Get(handle);
|
||||||
}
|
}
|
||||||
|
@ -134,18 +134,18 @@ namespace SHADE
|
||||||
/* ResourceManager - Helper Functions */
|
/* ResourceManager - Helper Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
ResourceLibrary<T>& ResourceManager::getLibrary()
|
SHResourceLibrary<T>& SHResourceHub::getLibrary()
|
||||||
{
|
{
|
||||||
// Attempt to retrieve the library
|
// Attempt to retrieve the library
|
||||||
const std::type_index RSC_TYPE = typeid(T);
|
const std::type_index RSC_TYPE = typeid(T);
|
||||||
if (resourceLibs.contains(RSC_TYPE))
|
if (resourceLibs.contains(RSC_TYPE))
|
||||||
{
|
{
|
||||||
return *static_cast<ResourceLibrary<T>*>(resourceLibs.at(RSC_TYPE));
|
return *static_cast<SHResourceLibrary<T>*>(resourceLibs.at(RSC_TYPE));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Construct library if doesn't exist
|
// Construct library if doesn't exist
|
||||||
ResourceLibrary<T>* lib = new ResourceLibrary<T>();
|
SHResourceLibrary<T>* lib = new SHResourceLibrary<T>();
|
||||||
resourceLibs.emplace(RSC_TYPE, static_cast<void*>(lib));
|
resourceLibs.emplace(RSC_TYPE, static_cast<void*>(lib));
|
||||||
|
|
||||||
// Construct deleter to properly delete objects with void*
|
// Construct deleter to properly delete objects with void*
|
||||||
|
@ -156,8 +156,8 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const ResourceLibrary<T>& ResourceManager::getLibrary() const
|
const SHResourceLibrary<T>& SHResourceHub::getLibrary() const
|
||||||
{
|
{
|
||||||
return const_cast<ResourceManager*>(this).getLibrary<T>();
|
return const_cast<SHResourceHub*>(this).getLibrary<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue