Merge branch 'SP3-1-Rendering' into SP3-4-editor
This commit is contained in:
commit
b164ecbd16
|
@ -59,8 +59,8 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;$(VULKAN_SDK)\include;..\Dependencies\VMA\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
|
@ -79,8 +79,8 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>SBpch.h</PrecompiledHeaderFile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PreprocessorDefinitions>_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\Dependencies\spdlog\include;$(VULKAN_SDK)\include;..\Dependencies\VMA\include;$(VULKAN_SDK)\Source\SPIRV-Reflect;..\SHADE_Engine\src;src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
|
|
@ -14,6 +14,7 @@ project "SHADE_Application"
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
"%{prj.location}/src/**.h",
|
"%{prj.location}/src/**.h",
|
||||||
|
"%{prj.location}/src/**.hpp",
|
||||||
"%{prj.location}/src/**.c",
|
"%{prj.location}/src/**.c",
|
||||||
"%{prj.location}/src/**.cpp",
|
"%{prj.location}/src/**.cpp",
|
||||||
"%{prj.location}/src/**.glsl",
|
"%{prj.location}/src/**.glsl",
|
||||||
|
@ -22,6 +23,9 @@ project "SHADE_Application"
|
||||||
includedirs
|
includedirs
|
||||||
{
|
{
|
||||||
"%{IncludeDir.spdlog}/include",
|
"%{IncludeDir.spdlog}/include",
|
||||||
|
"%{IncludeDir.VULKAN}/include",
|
||||||
|
"%{IncludeDir.VMA}/include",
|
||||||
|
"%{IncludeDir.VULKAN}/Source/SPIRV-Reflect",
|
||||||
"../SHADE_Engine/src",
|
"../SHADE_Engine/src",
|
||||||
"src"
|
"src"
|
||||||
}
|
}
|
||||||
|
@ -40,6 +44,11 @@ project "SHADE_Application"
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defines
|
||||||
|
{
|
||||||
|
"NOMINMAX"
|
||||||
|
}
|
||||||
|
|
||||||
warnings 'Extra'
|
warnings 'Extra'
|
||||||
|
|
||||||
filter "configurations:Debug"
|
filter "configurations:Debug"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "SBpch.h"
|
#include "SBpch.h"
|
||||||
#include "SBApplication.h"
|
#include "SBApplication.h"
|
||||||
|
#include "Engine/ECS_Base/System/SHSystemManager.h"
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#include "Editor/SHEditor.h"
|
#include "Editor/SHEditor.h"
|
||||||
|
@ -23,6 +24,11 @@ namespace Sandbox
|
||||||
{
|
{
|
||||||
|
|
||||||
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
||||||
|
SHADE::SHSystemManager::CreateSystem<SHADE::SHGraphicsSystem>("Graphics System");
|
||||||
|
SHADE::SHGraphicsSystem* graphicsSystem = static_cast<SHADE::SHGraphicsSystem*>(SHADE::SHSystemManager::GetSystem("Graphics System"));
|
||||||
|
graphicsSystem->SetWindow(&window);
|
||||||
|
|
||||||
|
SHADE::SHSystemManager::Init();
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#else
|
#else
|
||||||
|
@ -32,18 +38,24 @@ namespace Sandbox
|
||||||
|
|
||||||
void SBApplication::Update(void)
|
void SBApplication::Update(void)
|
||||||
{
|
{
|
||||||
|
SHADE::SHGraphicsSystem* graphicsSystem = static_cast<SHADE::SHGraphicsSystem*>(SHADE::SHSystemManager::GetSystem("Graphics System"));
|
||||||
|
|
||||||
//TODO: Change true to window is open
|
//TODO: Change true to window is open
|
||||||
while (!window.WindowShouldClose())
|
while (!window.WindowShouldClose())
|
||||||
{
|
{
|
||||||
|
graphicsSystem->BeginRender();
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
graphicsSystem->EndRender();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SBApplication::Exit(void)
|
void SBApplication::Exit(void)
|
||||||
{
|
{
|
||||||
|
SHADE::SHSystemManager::Exit();
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef SB_APPLICATION_H
|
#ifndef SB_APPLICATION_H
|
||||||
#define SB_APPLICATION_H
|
#define SB_APPLICATION_H
|
||||||
#include <Graphics/Windowing/SHWindow.h>
|
#include <Graphics/Windowing/SHWindow.h>
|
||||||
|
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||||
//using namespace SHADE;
|
//using namespace SHADE;
|
||||||
|
|
||||||
namespace Sandbox
|
namespace Sandbox
|
||||||
|
|
|
@ -173,8 +173,11 @@
|
||||||
<ClInclude Include="src\Graphics\Windowing\Surface\SHVkSurface.h" />
|
<ClInclude Include="src\Graphics\Windowing\Surface\SHVkSurface.h" />
|
||||||
<ClInclude Include="src\Meta\SHIsDetected.h" />
|
<ClInclude Include="src\Meta\SHIsDetected.h" />
|
||||||
<ClInclude Include="src\Resource\Handle.h" />
|
<ClInclude Include="src\Resource\Handle.h" />
|
||||||
|
<ClInclude Include="src\Resource\Handle.hpp" />
|
||||||
<ClInclude Include="src\Resource\ResourceLibrary.h" />
|
<ClInclude Include="src\Resource\ResourceLibrary.h" />
|
||||||
|
<ClInclude Include="src\Resource\ResourceLibrary.hpp" />
|
||||||
<ClInclude Include="src\Resource\SparseSet.h" />
|
<ClInclude Include="src\Resource\SparseSet.h" />
|
||||||
|
<ClInclude Include="src\Resource\SparseSet.hpp" />
|
||||||
<ClInclude Include="src\SHpch.h" />
|
<ClInclude Include="src\SHpch.h" />
|
||||||
<ClInclude Include="src\Scene\SHScene.h" />
|
<ClInclude Include="src\Scene\SHScene.h" />
|
||||||
<ClInclude Include="src\Scene\SHSceneManager.h" />
|
<ClInclude Include="src\Scene\SHSceneManager.h" />
|
||||||
|
|
|
@ -321,12 +321,21 @@
|
||||||
<ClInclude Include="src\Resource\Handle.h">
|
<ClInclude Include="src\Resource\Handle.h">
|
||||||
<Filter>Resource</Filter>
|
<Filter>Resource</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\Resource\Handle.hpp">
|
||||||
|
<Filter>Resource</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\Resource\ResourceLibrary.h">
|
<ClInclude Include="src\Resource\ResourceLibrary.h">
|
||||||
<Filter>Resource</Filter>
|
<Filter>Resource</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\Resource\ResourceLibrary.hpp">
|
||||||
|
<Filter>Resource</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\Resource\SparseSet.h">
|
<ClInclude Include="src\Resource\SparseSet.h">
|
||||||
<Filter>Resource</Filter>
|
<Filter>Resource</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\Resource\SparseSet.hpp">
|
||||||
|
<Filter>Resource</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\SHpch.h" />
|
<ClInclude Include="src\SHpch.h" />
|
||||||
<ClInclude Include="src\Scene\SHScene.h">
|
<ClInclude Include="src\Scene\SHScene.h">
|
||||||
<Filter>Scene</Filter>
|
<Filter>Scene</Filter>
|
||||||
|
|
|
@ -12,10 +12,10 @@ project "SHADE_Engine"
|
||||||
files
|
files
|
||||||
{
|
{
|
||||||
"%{prj.location}/src/**.h",
|
"%{prj.location}/src/**.h",
|
||||||
|
"%{prj.location}/src/**.hpp",
|
||||||
"%{prj.location}/src/**.c",
|
"%{prj.location}/src/**.c",
|
||||||
"%{prj.location}/src/**.cpp",
|
"%{prj.location}/src/**.cpp",
|
||||||
"%{prj.location}/src/**.glsl",
|
"%{prj.location}/src/**.glsl"
|
||||||
"%{wks.location}/Dependencies/stb_image/**.cpp"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
includedirs
|
includedirs
|
||||||
|
|
|
@ -180,10 +180,10 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHLOG_ERROR("Successfully queried Physical Devices:");
|
SHLOG_TRACE("Successfully queried Physical Devices:");
|
||||||
for (auto const& device : physicalDevices)
|
for (auto const& device : physicalDevices)
|
||||||
{
|
{
|
||||||
SHLOG_ERROR(std::string_view (std::string("\t-") + GetDeviceTypeName(device.getProperties().deviceType) + device.getProperties().deviceName.operator std::string()));
|
SHLOG_TRACE(std::string_view (std::string("\t-") + GetDeviceTypeName(device.getProperties().deviceType) + device.getProperties().deviceName.operator std::string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,8 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
SHGraphicsSystem::SHGraphicsSystem(SHWindow& window)
|
void SHGraphicsSystem::Init(void)
|
||||||
{
|
{
|
||||||
// Save the SHWindow
|
|
||||||
this->window = &window;
|
|
||||||
|
|
||||||
// Set Up Instance
|
// Set Up Instance
|
||||||
SHVkInstance::Init(true, true, true);
|
SHVkInstance::Init(true, true, true);
|
||||||
|
|
||||||
|
@ -39,10 +36,10 @@ namespace SHADE
|
||||||
device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice);
|
device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice);
|
||||||
|
|
||||||
// Construct surface
|
// Construct surface
|
||||||
surface = device->CreateSurface(window.GetHWND());
|
surface = device->CreateSurface(window->GetHWND());
|
||||||
|
|
||||||
// Construct Swapchain
|
// Construct Swapchain
|
||||||
auto windowDims = window.GetWindowSize();
|
auto windowDims = window->GetWindowSize();
|
||||||
swapchain = device->CreateSwapchain(surface, windowDims.first, windowDims.second, SHSwapchainParams
|
swapchain = device->CreateSwapchain(surface, windowDims.first, windowDims.second, SHSwapchainParams
|
||||||
{
|
{
|
||||||
.surfaceImageFormats {vk::Format::eB8G8R8A8Unorm, vk::Format::eR8G8B8A8Unorm, vk::Format::eB8G8R8Unorm, vk::Format::eR8G8B8Unorm},
|
.surfaceImageFormats {vk::Format::eB8G8R8A8Unorm, vk::Format::eR8G8B8A8Unorm, vk::Format::eB8G8R8Unorm, vk::Format::eR8G8B8Unorm},
|
||||||
|
@ -51,7 +48,7 @@ namespace SHADE
|
||||||
.vsyncOn = false, // TODO: Set to true when shipping game
|
.vsyncOn = false, // TODO: Set to true when shipping game
|
||||||
});
|
});
|
||||||
|
|
||||||
window.RegisterWindowSizeCallback([&]([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height)
|
window->RegisterWindowSizeCallback([&]([[maybe_unused]] uint32_t width, [[maybe_unused]] uint32_t height)
|
||||||
{
|
{
|
||||||
renderContext.SetIsResized(true);
|
renderContext.SetIsResized(true);
|
||||||
});
|
});
|
||||||
|
@ -127,7 +124,13 @@ namespace SHADE
|
||||||
/* RENDERGRAPH END TESTING */
|
/* RENDERGRAPH END TESTING */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
}
|
}
|
||||||
SHGraphicsSystem::~SHGraphicsSystem()
|
|
||||||
|
void SHGraphicsSystem::Run(float dt)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHGraphicsSystem::Exit(void)
|
||||||
{
|
{
|
||||||
//renderPass.Free();
|
//renderPass.Free();
|
||||||
renderContext.Destroy();
|
renderContext.Destroy();
|
||||||
|
@ -235,4 +238,10 @@ namespace SHADE
|
||||||
void SHGraphicsSystem::RemoveSegment(Handle<SHScreenSegment> segment)
|
void SHGraphicsSystem::RemoveSegment(Handle<SHScreenSegment> segment)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHGraphicsSystem::SetWindow(SHWindow* wind) noexcept
|
||||||
|
{
|
||||||
|
window = wind;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#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"
|
||||||
|
#include "Engine/ECS_Base/System/SHSystem.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ namespace SHADE
|
||||||
portions of the screen.
|
portions of the screen.
|
||||||
*/
|
*/
|
||||||
/***********************************************************************************/
|
/***********************************************************************************/
|
||||||
class SHGraphicsSystem
|
class SHGraphicsSystem : public SHSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -72,8 +73,15 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constructor/Destructors */
|
/* Constructor/Destructors */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
SHGraphicsSystem(SHWindow& window);
|
SHGraphicsSystem (void) = default;
|
||||||
~SHGraphicsSystem();
|
~SHGraphicsSystem(void) noexcept = default;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* SHSystem overrides */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
virtual void Init(void) override;
|
||||||
|
virtual void Run (float dt) override;
|
||||||
|
virtual void Exit(void) override;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Lifecycle Functions */
|
/* Lifecycle Functions */
|
||||||
|
@ -93,6 +101,11 @@ namespace SHADE
|
||||||
Handle<SHScreenSegment> AddSegment(const VkViewport& viewport, Handle<SHVkImage> imageToUse);
|
Handle<SHScreenSegment> AddSegment(const VkViewport& viewport, Handle<SHVkImage> imageToUse);
|
||||||
void RemoveSegment(Handle<SHScreenSegment> segment);
|
void RemoveSegment(Handle<SHScreenSegment> segment);
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Setters */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
void SetWindow (SHWindow* wind) noexcept;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Getters (Temporary) */
|
/* Getters (Temporary) */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -19,11 +19,15 @@ namespace SHADE
|
||||||
vkPresentModes = physicalDeviceHdl->GetVkPhysicalDevice().getSurfacePresentModesKHR(surfaceHdl->GetVkSurface());
|
vkPresentModes = physicalDeviceHdl->GetVkPhysicalDevice().getSurfacePresentModesKHR(surfaceHdl->GetVkSurface());
|
||||||
|
|
||||||
if (vkSurfaceFormats.size() == 0)
|
if (vkSurfaceFormats.size() == 0)
|
||||||
|
{
|
||||||
SHLOG_ERROR("Failed to get surface formats from the physical device. ");
|
SHLOG_ERROR("Failed to get surface formats from the physical device. ");
|
||||||
|
}
|
||||||
|
|
||||||
if (vkPresentModes.size() == 0)
|
if (vkPresentModes.size() == 0)
|
||||||
|
{
|
||||||
SHLOG_ERROR("Failed to get present modes from the physical device. ");
|
SHLOG_ERROR("Failed to get present modes from the physical device. ");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vk::SurfaceFormatKHR SHVkSwapchain::ChooseSwapSurfaceFormat(std::vector<vk::SurfaceFormatKHR> const& surfaceFormats) const noexcept
|
vk::SurfaceFormatKHR SHVkSwapchain::ChooseSwapSurfaceFormat(std::vector<vk::SurfaceFormatKHR> const& surfaceFormats) const noexcept
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
ResourceLibrary<T>* library;
|
ResourceLibrary<T>* library = nullptr;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Friend Declarations */
|
/* Friend Declarations */
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace SHADE
|
||||||
/* Helper Functions */
|
/* Helper Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
void assertHandleValid(Handle<T> handle) const;
|
void assertHandleValid(Handle<T> handle) const;
|
||||||
int getAvailableFreeIndex();
|
uint32_t getAvailableFreeIndex();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -35,13 +35,13 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
handle.id.Data.Version = 0;
|
handle.id.Data.Version = 0U;
|
||||||
versionCounts.insert(handle.id.Data.Index, handle.id.Data.Version);
|
versionCounts.insert(static_cast<uint32_t>(handle.id.Data.Index), handle.id.Data.Version);
|
||||||
}
|
}
|
||||||
handle.library = this;
|
handle.library = this;
|
||||||
|
|
||||||
// Create the resource
|
// Create the resource
|
||||||
[[maybe_unused]] T& obj = objects.insert(handle.id.Data.Index, std::forward<Args>(args) ...);
|
[[maybe_unused]] T& obj = objects.insert(static_cast<uint32_t>(handle.id.Data.Index), std::forward<Args>(args) ...);
|
||||||
|
|
||||||
// Handling SelfHandle assignment
|
// Handling SelfHandle assignment
|
||||||
if constexpr (std::is_base_of_v<ISelfHandle<T>, T>)
|
if constexpr (std::is_base_of_v<ISelfHandle<T>, T>)
|
||||||
|
@ -89,7 +89,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline int ResourceLibrary<T>::getAvailableFreeIndex()
|
inline uint32_t ResourceLibrary<T>::getAvailableFreeIndex()
|
||||||
{
|
{
|
||||||
// Get from the free list if present
|
// Get from the free list if present
|
||||||
if (!freeList.empty())
|
if (!freeList.empty())
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace SHADE
|
||||||
throw std::invalid_argument("An element at this index does not exist!");
|
throw std::invalid_argument("An element at this index does not exist!");
|
||||||
|
|
||||||
// Swap with the last element
|
// Swap with the last element
|
||||||
const int BACK_IDX = denseArray.size() - 1;
|
const auto BACK_IDX = denseArray.size() - 1;
|
||||||
std::swap(denseArray[sparseArray[idx]], denseArray.back());
|
std::swap(denseArray[sparseArray[idx]], denseArray.back());
|
||||||
denseArray.pop_back();
|
denseArray.pop_back();
|
||||||
// Update the sparse set by swapping the indices
|
// Update the sparse set by swapping the indices
|
||||||
|
@ -110,7 +110,7 @@ namespace SHADE
|
||||||
// We need to resize the array
|
// We need to resize the array
|
||||||
if (idx >= sparseArray.size())
|
if (idx >= sparseArray.size())
|
||||||
{
|
{
|
||||||
const int NEW_SIZE = idx + 1;
|
const auto NEW_SIZE = idx + 1;
|
||||||
sparseArray.resize(NEW_SIZE, INVALID);
|
sparseArray.resize(NEW_SIZE, INVALID);
|
||||||
inverseSparseArray.resize(NEW_SIZE, INVALID);
|
inverseSparseArray.resize(NEW_SIZE, INVALID);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace SHADE
|
||||||
auto& insertedElem = denseArray.emplace_back(std::forward<Args>(args) ...);
|
auto& insertedElem = denseArray.emplace_back(std::forward<Args>(args) ...);
|
||||||
|
|
||||||
// Update sparse and inverse sparse arrays
|
// Update sparse and inverse sparse arrays
|
||||||
const index_type DENSE_IDX = denseArray.size() - 1;
|
const auto DENSE_IDX = static_cast<index_type>(denseArray.size()) - 1;
|
||||||
sparseArray[idx] = DENSE_IDX;
|
sparseArray[idx] = DENSE_IDX;
|
||||||
inverseSparseArray[DENSE_IDX] = idx;
|
inverseSparseArray[DENSE_IDX] = idx;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue