Merge branch 'main' into SP3-4-editor_fix
This commit is contained in:
commit
bf0e7ab256
|
@ -37,7 +37,8 @@ project "SHADE_Application"
|
||||||
"%{IncludeDir.VULKAN}/include",
|
"%{IncludeDir.VULKAN}/include",
|
||||||
"%{IncludeDir.spdlog}/include",
|
"%{IncludeDir.spdlog}/include",
|
||||||
"%{IncludeDir.tinyddsloader}",
|
"%{IncludeDir.tinyddsloader}",
|
||||||
"%{IncludeDir.reactphysics3d}\\include"
|
"%{IncludeDir.reactphysics3d}\\include",
|
||||||
|
"%{IncludeDir.yamlcpp}"
|
||||||
}
|
}
|
||||||
|
|
||||||
externalwarnings "Off"
|
externalwarnings "Off"
|
||||||
|
@ -51,6 +52,7 @@ project "SHADE_Application"
|
||||||
{
|
{
|
||||||
"SHADE_Engine",
|
"SHADE_Engine",
|
||||||
"SHADE_Managed",
|
"SHADE_Managed",
|
||||||
|
"yaml-cpp",
|
||||||
"SDL2.lib",
|
"SDL2.lib",
|
||||||
"SDL2main.lib"
|
"SDL2main.lib"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHCameraComponent::SHCameraComponent()
|
SHCameraComponent::SHCameraComponent()
|
||||||
:yaw(0.0f), pitch(0.0f), roll(0.0f)
|
:yaw(0.0f), pitch(0.0f), roll(0.0f)
|
||||||
, width(1920.0f), height(1080.0f), zNear(0.01f), zFar(10000.0f), fov(90.0f), movementSpeed(1.0f), turnSpeed(1.0f)
|
, width(1920.0f), height(1080.0f), zNear(0.01f), zFar(10000.0f), fov(90.0f), movementSpeed(1.0f), turnSpeed(0.5f)
|
||||||
, perspProj(true), dirtyView(true), dirtyProj(true)
|
, perspProj(true), dirtyView(true), dirtyProj(true)
|
||||||
, viewMatrix(), projMatrix()
|
, viewMatrix(), projMatrix()
|
||||||
, position()
|
, position()
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "SHCameraSystem.h"
|
#include "SHCameraSystem.h"
|
||||||
#include "Math/SHMathHelpers.h"
|
#include "Math/SHMathHelpers.h"
|
||||||
#include "Input/SHInputManager.h"
|
#include "Input/SHInputManager.h"
|
||||||
|
#include "Math/Vector/SHVec2.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,56 +13,51 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHCameraSystem* system = static_cast<SHCameraSystem*>(GetSystem());
|
SHCameraSystem* system = static_cast<SHCameraSystem*>(GetSystem());
|
||||||
auto& camera = system->editorCamera;
|
auto& camera = system->editorCamera;
|
||||||
SHVec3 target{ 0.0f,0.0f,-1.0f };
|
SHVec3 view, right, UP;
|
||||||
SHVec3 up = { 0.0f,1.0f,0.0f };
|
system->GetCameraAxis(camera, view, right, UP);
|
||||||
|
|
||||||
|
|
||||||
SHVec3::RotateY(target, SHMath::DegreesToRadians(camera.yaw));
|
|
||||||
SHVec3::RotateX(target, SHMath::DegreesToRadians(camera.pitch));
|
|
||||||
target += camera.position;
|
|
||||||
////SHVec3::RotateZ(target, SHMath::DegreesToRadians(camera.roll));
|
|
||||||
|
|
||||||
//target = SHVec3::Normalise(target);
|
|
||||||
|
|
||||||
SHVec3::RotateZ(up, camera.roll);
|
|
||||||
up = SHVec3::Normalise(up);
|
|
||||||
|
|
||||||
|
|
||||||
SHVec3 view = target - camera.position; view = SHVec3::Normalise(view);
|
|
||||||
SHVec3 right = SHVec3::Cross(view, up); right = SHVec3::Normalise(right);
|
|
||||||
const SHVec3 UP = SHVec3::Cross(view, right);
|
|
||||||
|
|
||||||
|
|
||||||
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::A))
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::A))
|
||||||
{
|
{
|
||||||
system->editorCamera.position -= right * dt * camera.movementSpeed;
|
camera.position -= right * dt * camera.movementSpeed;
|
||||||
system->editorCamera.dirtyView = true;
|
camera.dirtyView = true;
|
||||||
}
|
}
|
||||||
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::D))
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::D))
|
||||||
{
|
{
|
||||||
system->editorCamera.position += right * dt * camera.movementSpeed;
|
camera.position += right * dt * camera.movementSpeed;
|
||||||
system->editorCamera.dirtyView = true;
|
camera.dirtyView = true;
|
||||||
}
|
}
|
||||||
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::W))
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::W))
|
||||||
{
|
{
|
||||||
system->editorCamera.position += view * dt * camera.movementSpeed;
|
camera.position += view * dt * camera.movementSpeed;
|
||||||
system->editorCamera.dirtyView = true;
|
camera.dirtyView = true;
|
||||||
}
|
}
|
||||||
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::S))
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::S))
|
||||||
{
|
{
|
||||||
system->editorCamera.position -= view * dt * camera.movementSpeed;
|
camera.position -= view * dt * camera.movementSpeed;
|
||||||
system->editorCamera.dirtyView = true;
|
camera.dirtyView = true;
|
||||||
}
|
}
|
||||||
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::Q))
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::Q))
|
||||||
{
|
{
|
||||||
system->editorCamera.position += UP * dt * camera.movementSpeed;
|
camera.position += UP * dt * camera.movementSpeed;
|
||||||
system->editorCamera.dirtyView = true;
|
camera.dirtyView = true;
|
||||||
}
|
}
|
||||||
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::E))
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::E))
|
||||||
{
|
{
|
||||||
system->editorCamera.position -= UP * dt * camera.movementSpeed;
|
camera.position -= UP * dt * camera.movementSpeed;
|
||||||
system->editorCamera.dirtyView = true;
|
camera.dirtyView = true;
|
||||||
}
|
}
|
||||||
|
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::RMB))
|
||||||
|
{
|
||||||
|
double mouseX, mouseY;
|
||||||
|
SHInputManager::GetMouseVelocity(&mouseX,&mouseY);
|
||||||
|
|
||||||
|
//std::cout << camera.yaw << std::endl;
|
||||||
|
|
||||||
|
camera.pitch -= mouseY * dt * camera.turnSpeed.x;
|
||||||
|
camera.yaw -= mouseX * dt * camera.turnSpeed.y;
|
||||||
|
camera.dirtyView = true;
|
||||||
|
}
|
||||||
|
|
||||||
system->UpdateCameraComponent(system->editorCamera);
|
system->UpdateCameraComponent(system->editorCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,24 +85,9 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (camera.dirtyView)
|
if (camera.dirtyView)
|
||||||
{
|
{
|
||||||
SHVec3 target{ 0.0f,0.0f,-1.0f };
|
|
||||||
SHVec3 up = { 0.0f,1.0f,0.0f };
|
|
||||||
|
|
||||||
|
SHVec3 view, right, UP;
|
||||||
SHVec3::RotateY(target, SHMath::DegreesToRadians(camera.yaw));
|
GetCameraAxis(camera, view, right, UP);
|
||||||
SHVec3::RotateX(target, SHMath::DegreesToRadians(camera.pitch));
|
|
||||||
target += camera.position;
|
|
||||||
////SHVec3::RotateZ(target, SHMath::DegreesToRadians(camera.roll));
|
|
||||||
|
|
||||||
//target = SHVec3::Normalise(target);
|
|
||||||
|
|
||||||
SHVec3::RotateZ(up, camera.roll);
|
|
||||||
up = SHVec3::Normalise(up);
|
|
||||||
|
|
||||||
|
|
||||||
SHVec3 view = target - camera.position; view = SHVec3::Normalise(view);
|
|
||||||
SHVec3 right = SHVec3::Cross(view, up); right = SHVec3::Normalise(right);
|
|
||||||
const SHVec3 UP = SHVec3::Cross(view, right);
|
|
||||||
|
|
||||||
camera.viewMatrix = SHMatrix::Identity;
|
camera.viewMatrix = SHMatrix::Identity;
|
||||||
camera.viewMatrix(0, 0) = right[0];
|
camera.viewMatrix(0, 0) = right[0];
|
||||||
|
@ -142,38 +123,51 @@ namespace SHADE
|
||||||
camera.projMatrix(3, 2) = 1.0f;
|
camera.projMatrix(3, 2) = 1.0f;
|
||||||
camera.projMatrix(2, 3) = -(camera.zFar * camera.zNear) / (camera.zFar - camera.zNear);
|
camera.projMatrix(2, 3) = -(camera.zFar * camera.zNear) / (camera.zFar - camera.zNear);
|
||||||
|
|
||||||
//const float fov_rad = SHMath::DegreesToRadians(camera.fov);
|
|
||||||
//const float focal_length = 1.0f / tan(fov_rad * 0.5f);
|
|
||||||
|
|
||||||
//camera.projMatrix(0,0) = focal_length / camera.GetAspectRatio();
|
|
||||||
//camera.projMatrix(1,1) = -focal_length;
|
|
||||||
//camera.projMatrix(2,2) = camera.zNear / (camera.zFar - camera.zNear);
|
|
||||||
//camera.projMatrix(2,3) = camera.zFar * (camera.zNear / (camera.zFar - camera.zNear));
|
|
||||||
//camera.projMatrix(3,2) = -1.0f;
|
|
||||||
//camera.projMatrix(3,3) = 0.0f;
|
|
||||||
|
|
||||||
//camera.projMatrix = SHMatrix::Inverse(camera.projMatrix);
|
|
||||||
|
|
||||||
camera.dirtyProj = false;
|
camera.dirtyProj = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const float R = camera.width * 0.5f;
|
//const float R = camera.width * 0.5f;
|
||||||
const float L = -R;
|
//const float L = -R;
|
||||||
const float T = camera.height * 0.5f;
|
//const float T = camera.height * 0.5f;
|
||||||
const float B = -T;
|
//const float B = -T;
|
||||||
|
|
||||||
camera.projMatrix = SHMatrix::Identity;
|
//camera.projMatrix = SHMatrix::Identity;
|
||||||
camera.projMatrix(0, 0) = 2.0f / (R - L);
|
//camera.projMatrix(0, 0) = 2.0f / (R - L);
|
||||||
camera.projMatrix(1, 1) = 2.0f / (B - T);
|
//camera.projMatrix(1, 1) = 2.0f / (B - T);
|
||||||
camera.projMatrix(2, 2) = 1.0f / (camera.zFar - camera.zNear);
|
//camera.projMatrix(2, 2) = 1.0f / (camera.zFar - camera.zNear);
|
||||||
camera.projMatrix(3, 0) = -(R + L) / (R - L);
|
//camera.projMatrix(3, 0) = -(R + L) / (R - L);
|
||||||
camera.projMatrix(3, 1) = -(B + T) / (B - T);
|
//camera.projMatrix(3, 1) = -(B + T) / (B - T);
|
||||||
camera.projMatrix(3, 2) = -camera.zNear / (camera.zFar - camera.zNear);
|
//camera.projMatrix(3, 2) = -camera.zNear / (camera.zFar - camera.zNear);
|
||||||
|
|
||||||
camera.dirtyProj = false;
|
camera.dirtyProj = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHCameraSystem::GetCameraAxis(SHCameraComponent const& camera, SHVec3& forward, SHVec3& right, SHVec3& upVec) const noexcept
|
||||||
|
{
|
||||||
|
SHVec3 target{ 0.0f,0.0f,-1.0f };
|
||||||
|
SHVec3 up = { 0.0f,1.0f,0.0f };
|
||||||
|
|
||||||
|
|
||||||
|
target = SHVec3::RotateY(target, SHMath::DegreesToRadians(camera.yaw));
|
||||||
|
target =SHVec3::RotateX(target, SHMath::DegreesToRadians(camera.pitch));
|
||||||
|
std::cout << "Target vec: " << target.x<<", "<<target.y<<", "<<target.z << std::endl;
|
||||||
|
target += camera.position;
|
||||||
|
////SHVec3::RotateZ(target, SHMath::DegreesToRadians(camera.roll));
|
||||||
|
|
||||||
|
//target = SHVec3::Normalise(target);
|
||||||
|
|
||||||
|
SHVec3::RotateZ(up, camera.roll);
|
||||||
|
up = SHVec3::Normalise(up);
|
||||||
|
|
||||||
|
|
||||||
|
forward = target - camera.position; forward = SHVec3::Normalise(forward);
|
||||||
|
right = SHVec3::Cross(forward, up); right = SHVec3::Normalise(right);
|
||||||
|
upVec = SHVec3::Cross(forward, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace SHADE
|
||||||
|
|
||||||
void UpdateCameraComponent(SHCameraComponent& camera) noexcept;
|
void UpdateCameraComponent(SHCameraComponent& camera) noexcept;
|
||||||
|
|
||||||
|
void GetCameraAxis(SHCameraComponent const& camera, SHVec3& forward, SHVec3& right, SHVec3& up) const noexcept;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//Whether or not this component is active.
|
//Whether or not this component is active.
|
||||||
//Systems using this component should are responsible for checking the active state of the component before running their functionality.
|
//Systems using this component should are responsible for checking the active state of the component before running their functionality.
|
||||||
|
@ -59,7 +62,7 @@ namespace SHADE
|
||||||
* \return uint32_t
|
* \return uint32_t
|
||||||
* The entityID that this component belongs to.
|
* The entityID that this component belongs to.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
uint32_t GetEID()const
|
uint32_t GetEID()const noexcept
|
||||||
{
|
{
|
||||||
return this->entityID;
|
return this->entityID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
#include "Gizmos/SHTransformGizmo.h"
|
#include "Gizmos/SHTransformGizmo.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>();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -115,34 +115,22 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Script Serialisation Functions */
|
/* Script Serialisation Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
std::string SHScriptEngine::SerialiseScripts(EntityID entity) const
|
bool SHScriptEngine::SerialiseScripts(EntityID entity, YAML::Node& scriptsNode) const
|
||||||
{
|
{
|
||||||
// Create buffer needed to store serialised script data
|
|
||||||
constexpr int BUFFER_SIZE = 10240;
|
|
||||||
std::unique_ptr<char> buffer { new char[BUFFER_SIZE] };
|
|
||||||
std::memset(buffer.get(), 0, BUFFER_SIZE);
|
|
||||||
|
|
||||||
// Attempt to serialise the script
|
// Attempt to serialise the script
|
||||||
std::string result;
|
if (csScriptsSerialiseYaml(entity, &scriptsNode))
|
||||||
if (csScriptsSerialise(entity, buffer.get(), BUFFER_SIZE))
|
return true;
|
||||||
{
|
|
||||||
result = std::string(buffer.get());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SHLOG_ERROR("[ScriptEngine] Failed to serialise scripts as string buffer is too small!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return an empty string since we failed to serialise
|
SHLOG_ERROR("[ScriptEngine] Failed to serialise scripts for entity #{}.", entity);
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Script Serialisation Functions */
|
/* Script Serialisation Functions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void SHScriptEngine::DeserialiseScript(EntityID entity, const std::string& yaml) const
|
bool SHScriptEngine::DeserialiseScripts(EntityID entity, const YAML::Node& scriptsNode) const
|
||||||
{
|
{
|
||||||
csScriptDeserialise(entity, yaml.c_str());
|
return csScriptsDeserialiseYaml(entity, &scriptsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -380,30 +368,18 @@ namespace SHADE
|
||||||
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
||||||
"RemoveAllScriptsImmediately"
|
"RemoveAllScriptsImmediately"
|
||||||
);
|
);
|
||||||
/*csScriptsSerialise = dotNet.GetFunctionPtr<CsScriptSerialiseFuncPtr>
|
csScriptsSerialiseYaml = dotNet.GetFunctionPtr<CsScriptSerialiseYamlFuncPtr>
|
||||||
(
|
(
|
||||||
DEFAULT_CSHARP_LIB_NAME,
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
||||||
"SerialiseScripts"
|
"SerialiseScripts"
|
||||||
);
|
);
|
||||||
csScriptsSerialiseYaml = dotNet.GetFunctionPtr<CsScriptSerialiseYamlFuncPtr>
|
csScriptsDeserialiseYaml = dotNet.GetFunctionPtr<CsScriptDeserialiseYamlFuncPtr>
|
||||||
(
|
(
|
||||||
DEFAULT_CSHARP_LIB_NAME,
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
||||||
"SerialiseScriptsYaml"
|
"DeserialiseScripts"
|
||||||
);
|
);
|
||||||
csScriptDeserialise = dotNet.GetFunctionPtr<CsScriptDeserialiseFuncPtr>
|
|
||||||
(
|
|
||||||
DEFAULT_CSHARP_LIB_NAME,
|
|
||||||
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
|
||||||
"DeserialiseScript"
|
|
||||||
);
|
|
||||||
csScriptDeserialiseYaml = dotNet.GetFunctionPtr<CsScriptSerialiseYamlFuncPtr>
|
|
||||||
(
|
|
||||||
DEFAULT_CSHARP_LIB_NAME,
|
|
||||||
DEFAULT_CSHARP_NAMESPACE + ".ScriptStore",
|
|
||||||
"SerialiseScriptsYaml"
|
|
||||||
);*/
|
|
||||||
csEditorRenderScripts = dotNet.GetFunctionPtr<CsScriptEditorFuncPtr>
|
csEditorRenderScripts = dotNet.GetFunctionPtr<CsScriptEditorFuncPtr>
|
||||||
(
|
(
|
||||||
DEFAULT_CSHARP_LIB_NAME,
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
|
|
|
@ -13,7 +13,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
// STL Includes
|
// STL Includes
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
// External Dependencies
|
||||||
|
#include <yaml-cpp/yaml.h>
|
||||||
// Project Headers
|
// Project Headers
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
#include "SHDotNetRuntime.h"
|
#include "SHDotNetRuntime.h"
|
||||||
|
@ -141,23 +142,26 @@ namespace SHADE
|
||||||
/* Script Serialisation Functions */
|
/* Script Serialisation Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a JSON string that represents the set of Scripts attached to the
|
/// Performs serialization of all scripts for the specified entity into the
|
||||||
/// specified Entity.
|
/// YAML::Node specified. This node will contain all serialised scripts after
|
||||||
|
/// calling this function.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity"> The Entity to Serialise.</param>
|
/// <param name="entity">The Entity to Serialise.</param>
|
||||||
/// <returns>
|
/// <param name="scriptsNode">
|
||||||
/// String that represents the set of scripts attached to the specified Entity.
|
/// YAML Node that will store the serialised scripts.
|
||||||
/// </returns>
|
/// </param>
|
||||||
std::string SerialiseScripts(EntityID entity) const;
|
/// <return>True if successfully serialised.</return>
|
||||||
|
bool SerialiseScripts(EntityID entity, YAML::Node& scriptsNode) const;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads the specified JSON string and creates a Script for the specified Entity
|
/// Creates scripts and sets fields for the specified Entity based on the specified
|
||||||
/// based on the specified JSON string.
|
/// YAML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity">The Entity to deserialise a Script on to.</param>
|
/// <param name="entity">The Entity to deserialise a Script on to.</param>
|
||||||
/// <param name="yaml">
|
/// <param name="scriptsNode">
|
||||||
/// The YAML string that represents the Script to load into the Entity.
|
/// YAML Node that contains the serialised script data.
|
||||||
/// </param>
|
/// </param>
|
||||||
void DeserialiseScript(EntityID entity, const std::string& yaml) const;
|
/// <return>True if successfully deserialised.</return>
|
||||||
|
bool DeserialiseScripts(EntityID entity, const YAML::Node& scriptsNode) const;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Script Editor Functions */
|
/* Script Editor Functions */
|
||||||
|
@ -211,9 +215,8 @@ namespace SHADE
|
||||||
using CsScriptManipFuncPtr = bool(*)(EntityID, const char*);
|
using CsScriptManipFuncPtr = bool(*)(EntityID, const char*);
|
||||||
using CsScriptBasicFuncPtr = void(*)(EntityID);
|
using CsScriptBasicFuncPtr = void(*)(EntityID);
|
||||||
using CsScriptOptionalFuncPtr = void(*)(EntityID, bool);
|
using CsScriptOptionalFuncPtr = void(*)(EntityID, bool);
|
||||||
using CsScriptSerialiseFuncPtr = bool(*)(EntityID, char*, int);
|
|
||||||
using CsScriptDeserialiseFuncPtr = bool(*)(EntityID, const char*);
|
|
||||||
using CsScriptSerialiseYamlFuncPtr = bool(*)(EntityID, void*);
|
using CsScriptSerialiseYamlFuncPtr = bool(*)(EntityID, void*);
|
||||||
|
using CsScriptDeserialiseYamlFuncPtr = bool(*)(EntityID, const void*);
|
||||||
using CsScriptEditorFuncPtr = void(*)(EntityID);
|
using CsScriptEditorFuncPtr = void(*)(EntityID);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -245,10 +248,8 @@ namespace SHADE
|
||||||
CsScriptManipFuncPtr csScriptsAdd = nullptr;
|
CsScriptManipFuncPtr csScriptsAdd = nullptr;
|
||||||
CsScriptBasicFuncPtr csScriptsRemoveAll = nullptr;
|
CsScriptBasicFuncPtr csScriptsRemoveAll = nullptr;
|
||||||
CsScriptOptionalFuncPtr csScriptsRemoveAllImmediately = nullptr;
|
CsScriptOptionalFuncPtr csScriptsRemoveAllImmediately = nullptr;
|
||||||
CsScriptSerialiseFuncPtr csScriptsSerialise = nullptr;
|
|
||||||
CsScriptDeserialiseFuncPtr csScriptDeserialise = nullptr;
|
|
||||||
CsScriptSerialiseYamlFuncPtr csScriptsSerialiseYaml = nullptr;
|
CsScriptSerialiseYamlFuncPtr csScriptsSerialiseYaml = nullptr;
|
||||||
CsScriptSerialiseYamlFuncPtr csScriptDeserialiseYaml = nullptr;
|
CsScriptDeserialiseYamlFuncPtr csScriptsDeserialiseYaml = nullptr;
|
||||||
// - Editor
|
// - Editor
|
||||||
CsScriptEditorFuncPtr csEditorRenderScripts = nullptr;
|
CsScriptEditorFuncPtr csEditorRenderScripts = nullptr;
|
||||||
CsFuncPtr csEditorUndo = nullptr;
|
CsFuncPtr csEditorUndo = nullptr;
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||||
#include "Math/Transform/SHTransformComponent.h"
|
#include "Math/Transform/SHTransformComponent.h"
|
||||||
#include "Physics/Components/SHRigidBodyComponent.h"
|
#include "Physics/Components/SHRigidBodyComponent.h"
|
||||||
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
|
#include "Scripting/SHScriptEngine.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -79,7 +81,10 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return eid;
|
|
||||||
|
// Deserialise scripts
|
||||||
|
if (node[ScriptsNode])
|
||||||
|
SHSystemManager::GetSystem<SHScriptEngine>()->DeserialiseScripts(eid, node[ScriptsNode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHSerialization::DeserializeSceneFromFile(std::filesystem::path const& path)
|
void SHSerialization::DeserializeSceneFromFile(std::filesystem::path const& path)
|
||||||
|
@ -188,6 +193,11 @@ namespace SHADE
|
||||||
components[rttr::type::get<SHRigidBodyComponent>().get_name().data()] = SHSerializationHelper::SerializeComponentToNode(rigidbody);
|
components[rttr::type::get<SHRigidBodyComponent>().get_name().data()] = SHSerializationHelper::SerializeComponentToNode(rigidbody);
|
||||||
}
|
}
|
||||||
node[ComponentsNode] = components;
|
node[ComponentsNode] = components;
|
||||||
|
|
||||||
|
YAML::Node scripts;
|
||||||
|
SHSystemManager::GetSystem<SHScriptEngine>()->SerialiseScripts(eid, scripts);
|
||||||
|
node[ScriptsNode] = scripts;
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace SHADE
|
||||||
constexpr const char* EIDNode = "EID";
|
constexpr const char* EIDNode = "EID";
|
||||||
constexpr const char* IsActiveNode = "IsActive";
|
constexpr const char* IsActiveNode = "IsActive";
|
||||||
constexpr const char* NumberOfChildrenNode = "NumberOfChildren";
|
constexpr const char* NumberOfChildrenNode = "NumberOfChildren";
|
||||||
|
constexpr const char* ScriptsNode = "Scripts";
|
||||||
|
|
||||||
struct SH_API SHSerialization
|
struct SH_API SHSerialization
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Utility/Convert.hxx"
|
#include "Utility/Convert.hxx"
|
||||||
#include "Script.hxx"
|
#include "Script.hxx"
|
||||||
#include "Engine/Entity.hxx"
|
#include "Engine/Entity.hxx"
|
||||||
|
#include "Serialisation/ReflectionUtilities.hxx"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -470,71 +471,89 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
SAFE_NATIVE_CALL_END_N("SHADE.ScriptStore")
|
SAFE_NATIVE_CALL_END_N("SHADE.ScriptStore")
|
||||||
}
|
}
|
||||||
bool ScriptStore::SerialiseScripts(Entity entity, System::Text::StringBuilder^ buffer, int bufferSize)
|
|
||||||
|
bool ScriptStore::SerialiseScripts(Entity entity, System::IntPtr yamlNodePtr)
|
||||||
{
|
{
|
||||||
SAFE_NATIVE_CALL_BEGIN
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
// Create a buffer that we can work with temporarily
|
// Convert to pointer
|
||||||
System::Text::StringBuilder^ jsonString = gcnew System::Text::StringBuilder();
|
YAML::Node* yamlNode = reinterpret_cast<YAML::Node*>(yamlNodePtr.ToPointer());
|
||||||
|
|
||||||
|
// Check if yamlNode is valid
|
||||||
|
if (yamlNode == nullptr)
|
||||||
|
{
|
||||||
|
Debug::LogWarning("[ScriptStore] Attempted to serialise scripts with an invalid YAML Node! Skipping.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if entity exists, otherwise nothing
|
// Check if entity exists, otherwise nothing
|
||||||
if (!EntityUtils::IsValid(entity))
|
if (!EntityUtils::IsValid(entity))
|
||||||
return true;
|
{
|
||||||
|
Debug::LogWarning("[ScriptStore] Attempted to serialise scripts for an invalid Entity! Skipping.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if entity exists in the script storage
|
// Check if entity exists in the script storage
|
||||||
if (!scripts.ContainsKey(entity))
|
if (!scripts.ContainsKey(entity))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Serialise each script
|
// Serialise each script
|
||||||
|
yamlNode->SetStyle(YAML::EmitterStyle::Block);
|
||||||
System::Collections::Generic::List<Script^>^ scriptList = scripts[entity];
|
System::Collections::Generic::List<Script^>^ scriptList = scripts[entity];
|
||||||
for (int i = 0; i < scriptList->Count; ++i)
|
for each (Script^ script in scriptList)
|
||||||
{
|
{
|
||||||
throw gcnew System::NotImplementedException;
|
ReflectionUtilities::Serialise(script, *yamlNode);
|
||||||
//jsonString->Append(ReflectionUtilities::Serialise(scriptList[i]));
|
|
||||||
|
|
||||||
// Only add separator if is not last script
|
|
||||||
if (i != scriptList->Count - 1)
|
|
||||||
{
|
|
||||||
jsonString->Append(",\r\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the size is too big
|
|
||||||
if (jsonString->Length > bufferSize)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Otherwise we copy it over
|
|
||||||
buffer->Clear();
|
|
||||||
buffer->Append(jsonString->ToString());
|
|
||||||
return true;
|
return true;
|
||||||
SAFE_NATIVE_CALL_END_N("SHADE.ScriptStore")
|
SAFE_NATIVE_CALL_END_N("SHADE.ScriptStore")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptStore::DeserialiseScript(Entity entity, System::String^ yaml)
|
bool ScriptStore::DeserialiseScripts(Entity entity, System::IntPtr yamlNodePtr)
|
||||||
{
|
{
|
||||||
SAFE_NATIVE_CALL_BEGIN
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
|
// Convert to pointer
|
||||||
|
YAML::Node* yamlNode = reinterpret_cast<YAML::Node*>(yamlNodePtr.ToPointer());
|
||||||
|
|
||||||
|
// Check if yamlNode is valid
|
||||||
|
if (yamlNode == nullptr)
|
||||||
|
{
|
||||||
|
Debug::LogWarning("[ScriptStore] Attempted to deserialise scripts with an invalid YAML Node! Skipping.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if entity exists, otherwise nothing
|
// Check if entity exists, otherwise nothing
|
||||||
if (!EntityUtils::IsValid(entity))
|
if (!EntityUtils::IsValid(entity))
|
||||||
|
{
|
||||||
|
Debug::LogWarning("[ScriptStore] Attempted to deserialise scripts for an invalid Entity! Skipping.");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go through all elements in the node
|
||||||
|
for (YAML::Node& node : *yamlNode)
|
||||||
|
{
|
||||||
// Get the name of the script
|
// Get the name of the script
|
||||||
const int FIRST_QUOTE = yaml->IndexOf('\"');
|
if (!node["Type"])
|
||||||
const int FIRST_COLON = yaml->IndexOf(':');
|
{
|
||||||
if (FIRST_QUOTE < 0 || FIRST_COLON < 0) // No script name, it's invalid
|
Debug::LogWarning("[ScriptStore] Script with no type detected, skipping.");
|
||||||
return false;
|
continue;
|
||||||
const int SCRIPT_NAME_START = FIRST_QUOTE + 1;
|
}
|
||||||
const int SCRIPT_NAME_END = FIRST_COLON - 1;
|
|
||||||
System::String^ typeName = yaml->Substring(SCRIPT_NAME_START, SCRIPT_NAME_END - SCRIPT_NAME_START);
|
|
||||||
|
|
||||||
// Create the script
|
System::String^ typeName = Convert::ToCLI(node["Type"].as<std::string>());
|
||||||
|
|
||||||
|
// Create
|
||||||
Script^ script;
|
Script^ script;
|
||||||
if (AddScriptViaNameWithRef(entity, typeName, script))
|
if (AddScriptViaNameWithRef(entity, typeName, script))
|
||||||
{
|
{
|
||||||
// Copy the data in
|
// Copy the data in
|
||||||
throw gcnew System::NotImplementedException;
|
ReflectionUtilities::Deserialise(script, node);
|
||||||
//ReflectionUtilities::Deserialise(json, script);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug::LogWarning("[ScriptStore] Script with unloaded type detected, skipping.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
SAFE_NATIVE_CALL_END_N("SHADE.ScriptStore")
|
SAFE_NATIVE_CALL_END_N("SHADE.ScriptStore")
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "Engine/Entity.hxx"
|
#include "Engine/Entity.hxx"
|
||||||
#include "Script.hxx"
|
#include "Script.hxx"
|
||||||
|
#include "Serialization/SHSerialization.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -237,27 +238,23 @@ namespace SHADE
|
||||||
/* Serialisation Functions */
|
/* Serialisation Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates a JSON string that represents the set of Scripts attached
|
/// Populates a YAML node with the scripts for a specified Entity.
|
||||||
/// to the specified Entity.
|
|
||||||
/// <br/> <br/>
|
/// <br/> <br/>
|
||||||
/// This function should only be called from native unmanaged code.
|
/// This function should only be called from native unmanaged code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity">The Entity to Serialise.</param>
|
/// <param name="entity">The Entity to Serialise.</param>
|
||||||
/// <param name="buffer">
|
/// <param name="yamlNode">
|
||||||
/// StringBuilder handle that maps to a native char array that will contain the
|
/// Pointer to a YAML::Node that will be populated with all of the serialised
|
||||||
/// serialised string.
|
/// scripts and their associated fields.
|
||||||
/// </param>
|
|
||||||
/// <param name="bufferSize">
|
|
||||||
/// The size of the char array.
|
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// True if serialisation is successful. False if the buffer is too small for
|
/// True if serialisation is successful. False if the buffer is too small for
|
||||||
/// the serialised output.
|
/// the serialised output.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
static bool SerialiseScripts(Entity entity, System::Text::StringBuilder^ buffer, int bufferSize);
|
static bool SerialiseScripts(Entity entity, System::IntPtr yamlNode);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes a JSON string that represents a single Script and attaches
|
/// Processes a YAML node that contains a list of multiple scripts to be loaded
|
||||||
/// it onto the specified Entity.
|
/// into the specified Entity.
|
||||||
/// <br/> <br/>
|
/// <br/> <br/>
|
||||||
/// This function should only be called from native unmanaged code.
|
/// This function should only be called from native unmanaged code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -265,10 +262,10 @@ namespace SHADE
|
||||||
/// The Entity to attach the deserialised Scripts to.
|
/// The Entity to attach the deserialised Scripts to.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="yaml">
|
/// <param name="yaml">
|
||||||
/// JSON string that describes the Script to serialise.
|
/// Pointer to the YAML::Node that contains serialized script data.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
static bool DeserialiseScript(Entity entity, System::String^ yaml);
|
static bool DeserialiseScripts(Entity entity, System::IntPtr yamlNode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -38,6 +38,11 @@ if (iter != jsonValue.MemberEnd()) \
|
||||||
vec.MEMBER = iter->value.GetDouble(); \
|
vec.MEMBER = iter->value.GetDouble(); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------------------------*/
|
||||||
|
/* File-Level Constants */
|
||||||
|
/*-------------------------------------------------------------------------------------*/
|
||||||
|
static const std::string_view SCRIPT_TYPE_YAMLTAG = "Type";
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
/* Function Definitions */
|
/* Function Definitions */
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
|
@ -61,13 +66,14 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Serialisation Functions */
|
/* Serialisation Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
void ReflectionUtilities::Serialise(System::Object^ object, YAML::Emitter& yaml)
|
void ReflectionUtilities::Serialise(System::Object^ object, YAML::Node& scriptListNode)
|
||||||
{
|
{
|
||||||
using namespace System::Reflection;
|
using namespace System::Reflection;
|
||||||
|
|
||||||
// Create YAML object
|
// Create YAML object
|
||||||
yaml << YAML::Key << Convert::ToNative(object->GetType()->FullName);
|
YAML::Node scriptNode;
|
||||||
yaml << YAML::BeginMap;
|
scriptNode.SetStyle(YAML::EmitterStyle::Block);
|
||||||
|
scriptNode[SCRIPT_TYPE_YAMLTAG.data()] = Convert::ToNative(object->GetType()->FullName);
|
||||||
|
|
||||||
// Get all fields
|
// Get all fields
|
||||||
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = GetInstanceFields(object);
|
System::Collections::Generic::IEnumerable<FieldInfo^>^ fields = GetInstanceFields(object);
|
||||||
|
@ -78,12 +84,12 @@ namespace SHADE
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Serialise
|
// Serialise
|
||||||
writeFieldIntoYaml(field, object, yaml);
|
writeFieldIntoYaml(field, object, scriptNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
yaml << YAML::EndMap;
|
scriptListNode.push_back(scriptNode);
|
||||||
}
|
}
|
||||||
void ReflectionUtilities::Deserialise(YAML::Node& yamlNode, Object^ object)
|
void ReflectionUtilities::Deserialise(Object^ object, YAML::Node& yamlNode)
|
||||||
{
|
{
|
||||||
using namespace System::Reflection;
|
using namespace System::Reflection;
|
||||||
|
|
||||||
|
@ -117,44 +123,49 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Serialization Helper Functions */
|
/* Serialization Helper Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
void ReflectionUtilities::writeFieldIntoYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Emitter& yaml)
|
void ReflectionUtilities::writeFieldIntoYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& yamlNode)
|
||||||
{
|
{
|
||||||
// Field Name
|
// Field YAML Node
|
||||||
yaml << YAML::Key << Convert::ToNative(fieldInfo->Name);
|
YAML::Node fieldNode;
|
||||||
|
|
||||||
// Field Value
|
// Retrieve string for the YAML
|
||||||
yaml << YAML::Value;
|
const bool PRIMITIVE_SERIALIZED = fieldInsertYaml<System::Int16>(fieldInfo, object, fieldNode) ||
|
||||||
if (fieldInsertYaml<System::Int16> (fieldInfo, object, yaml) ||
|
fieldInsertYaml<System::Int32>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<System::Int32> (fieldInfo, object, yaml) ||
|
fieldInsertYaml<System::Int64>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<System::Int64> (fieldInfo, object, yaml) ||
|
fieldInsertYaml<System::UInt16>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<System::UInt16>(fieldInfo, object, yaml) ||
|
fieldInsertYaml<System::UInt32>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<System::UInt32>(fieldInfo, object, yaml) ||
|
fieldInsertYaml<System::UInt64>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<System::UInt64>(fieldInfo, object, yaml) ||
|
fieldInsertYaml<System::Byte>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<System::Byte> (fieldInfo, object, yaml) ||
|
fieldInsertYaml<bool>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<bool> (fieldInfo, object, yaml) ||
|
fieldInsertYaml<float>(fieldInfo, object, fieldNode) ||
|
||||||
fieldInsertYaml<float> (fieldInfo, object, yaml) ||
|
fieldInsertYaml<double>(fieldInfo, object, fieldNode);
|
||||||
fieldInsertYaml<double> (fieldInfo, object, yaml))
|
|
||||||
|
// Serialization of more complex types
|
||||||
|
if (!PRIMITIVE_SERIALIZED)
|
||||||
{
|
{
|
||||||
return;
|
if (fieldInfo->FieldType->IsSubclassOf(System::Enum::typeid))
|
||||||
}
|
|
||||||
else if (fieldInfo->FieldType->IsSubclassOf(System::Enum::typeid))
|
|
||||||
{
|
{
|
||||||
yaml << safe_cast<int>(fieldInfo->GetValue(object));
|
fieldNode = std::to_string(safe_cast<int>(fieldInfo->GetValue(object)));
|
||||||
}
|
}
|
||||||
else if (fieldInfo->FieldType == System::String::typeid)
|
else if (fieldInfo->FieldType == System::String::typeid)
|
||||||
{
|
{
|
||||||
System::String^ str = safe_cast<System::String^>(fieldInfo->GetValue(object));
|
System::String^ str = safe_cast<System::String^>(fieldInfo->GetValue(object));
|
||||||
yaml << Convert::ToNative(str);
|
fieldNode = Convert::ToNative(str);
|
||||||
}
|
}
|
||||||
else if (fieldInfo->FieldType == Vector2::typeid)
|
else if (fieldInfo->FieldType == Vector2::typeid)
|
||||||
{
|
{
|
||||||
Vector2 vec = safe_cast<Vector2>(fieldInfo->GetValue(object));
|
Vector2 vec = safe_cast<Vector2>(fieldInfo->GetValue(object));
|
||||||
yaml << YAML::BeginSeq << YAML::Flow << vec.x << vec.y << YAML::EndSeq;
|
fieldNode.SetStyle(YAML::EmitterStyle::Flow);
|
||||||
|
fieldNode.push_back(vec.x);
|
||||||
|
fieldNode.push_back(vec.y);
|
||||||
}
|
}
|
||||||
else if (fieldInfo->FieldType == Vector3::typeid)
|
else if (fieldInfo->FieldType == Vector3::typeid)
|
||||||
{
|
{
|
||||||
Vector3 vec = safe_cast<Vector3>(fieldInfo->GetValue(object));
|
Vector3 vec = safe_cast<Vector3>(fieldInfo->GetValue(object));
|
||||||
yaml << YAML::BeginSeq << YAML::Flow << vec.x << vec.y << vec.z << YAML::EndSeq;
|
fieldNode.SetStyle(YAML::EmitterStyle::Flow);
|
||||||
|
fieldNode.push_back(vec.x);
|
||||||
|
fieldNode.push_back(vec.y);
|
||||||
|
fieldNode.push_back(vec.z);
|
||||||
}
|
}
|
||||||
else // Not any of the supported types
|
else // Not any of the supported types
|
||||||
{
|
{
|
||||||
|
@ -163,9 +174,14 @@ namespace SHADE
|
||||||
"[ReflectionUtilities] Failed to parse \"{0}\" of \"{1}\" type for serialization.",
|
"[ReflectionUtilities] Failed to parse \"{0}\" of \"{1}\" type for serialization.",
|
||||||
fieldInfo->Name, fieldInfo->FieldType)
|
fieldInfo->Name, fieldInfo->FieldType)
|
||||||
));
|
));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the field into YAML
|
||||||
|
yamlNode[Convert::ToNative(fieldInfo->Name)] = fieldNode;
|
||||||
|
}
|
||||||
|
|
||||||
void ReflectionUtilities::writeYamlIntoField(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node)
|
void ReflectionUtilities::writeYamlIntoField(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node)
|
||||||
{
|
{
|
||||||
if (fieldInfo->FieldType == System::Int16::typeid)
|
if (fieldInfo->FieldType == System::Int16::typeid)
|
||||||
|
|
|
@ -23,11 +23,12 @@ namespace SHADE
|
||||||
/* Serialization Helper Functions */
|
/* Serialization Helper Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template<typename FieldType>
|
template<typename FieldType>
|
||||||
bool ReflectionUtilities::fieldInsertYaml(System::Reflection::FieldInfo^ fieldInfo, System::Object^ object, YAML::Emitter& emitter)
|
bool ReflectionUtilities::fieldInsertYaml(System::Reflection::FieldInfo^ fieldInfo, System::Object^ object, YAML::Node& fieldNode)
|
||||||
{
|
{
|
||||||
if (fieldInfo->FieldType == FieldType::typeid)
|
if (fieldInfo->FieldType == FieldType::typeid)
|
||||||
{
|
{
|
||||||
emitter << safe_cast<FieldType>(fieldInfo->GetValue(object));
|
const FieldType VALUE = safe_cast<FieldType>(fieldInfo->GetValue(object));
|
||||||
|
fieldNode = static_cast<FieldType>(VALUE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ namespace SHADE
|
||||||
template<typename FieldType>
|
template<typename FieldType>
|
||||||
bool ReflectionUtilities::fieldAssignYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node)
|
bool ReflectionUtilities::fieldAssignYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node)
|
||||||
{
|
{
|
||||||
return fieldAssignYaml<FieldType, FieldType>(fieldInfo, object, node);
|
return fieldAssignYaml<FieldType, ToNativeType_T<FieldType>>(fieldInfo, object, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FieldType, typename CastType>
|
template<typename FieldType, typename CastType>
|
||||||
|
|
|
@ -52,24 +52,24 @@ namespace SHADE
|
||||||
/// attribute will be serialised.
|
/// attribute will be serialised.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="object">The object to serialise.</param>
|
/// <param name="object">The object to serialise.</param>
|
||||||
static void Serialise(System::Object^ object, YAML::Emitter& yaml);
|
static void Serialise(System::Object^ object, YAML::Node& yamlNode);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deserialises a YAML node that contains a map of Scripts and copies the
|
/// Deserialises a YAML node that contains a map of Scripts and copies the
|
||||||
/// deserialised data into the specified object if there are matching fields.
|
/// deserialised data into the specified object if there are matching fields.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="yamlNode">
|
/// <param name="yamlNode">
|
||||||
/// The JSON string that contains the data to copy into this PlushieScript
|
/// The JSON string that contains the data to copy into this Script object.
|
||||||
/// object.
|
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="object">The object to copy deserialised data into.</param>
|
/// <param name="object">The object to copy deserialised data into.</param>
|
||||||
static void Deserialise(YAML::Node& yamlNode, Object^ object);
|
static void Deserialise(System::Object^ object, YAML::Node& yamlNode);
|
||||||
|
|
||||||
|
private:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Serialization Helper Functions */
|
/* Serialization Helper Functions */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
static void writeFieldIntoYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Emitter& yaml);
|
static void writeFieldIntoYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& yamlNode);
|
||||||
template<typename FieldType>
|
template<typename FieldType>
|
||||||
static bool fieldInsertYaml(System::Reflection::FieldInfo^ fieldInfo, System::Object^ object, YAML::Emitter& emitter);
|
static bool fieldInsertYaml(System::Reflection::FieldInfo^ fieldInfo, System::Object^ object, YAML::Node& fieldNode);
|
||||||
static void writeYamlIntoField(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node);
|
static void writeYamlIntoField(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node);
|
||||||
template<typename FieldType>
|
template<typename FieldType>
|
||||||
static bool fieldAssignYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node);
|
static bool fieldAssignYaml(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node);
|
||||||
|
|
|
@ -91,4 +91,68 @@ namespace SHADE
|
||||||
/// <returns>Managed copy of a native std::string.</returns>
|
/// <returns>Managed copy of a native std::string.</returns>
|
||||||
static System::String^ ToCLI(const std::string& str);
|
static System::String^ ToCLI(const std::string& str);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Type Transformer for managed types to native types.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="ManagedType">
|
||||||
|
/// Managed type to get the native type for.
|
||||||
|
/// </typeparam>
|
||||||
|
template<typename ManagedType>
|
||||||
|
struct ToNativeType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using Value = void;
|
||||||
|
};
|
||||||
|
template<> struct ToNativeType<System::Int16> { using Value = int16_t; };
|
||||||
|
template<> struct ToNativeType<System::Int32> { using Value = int32_t; };
|
||||||
|
template<> struct ToNativeType<System::Int64> { using Value = int64_t; };
|
||||||
|
template<> struct ToNativeType<System::UInt16> { using Value = uint16_t; };
|
||||||
|
template<> struct ToNativeType<System::UInt32> { using Value = uint32_t; };
|
||||||
|
template<> struct ToNativeType<System::UInt64> { using Value = uint64_t; };
|
||||||
|
template<> struct ToNativeType<System::Byte> { using Value = int8_t; };
|
||||||
|
template<> struct ToNativeType<bool> { using Value = bool; };
|
||||||
|
template<> struct ToNativeType<double> { using Value = double; };
|
||||||
|
template<> struct ToNativeType<float> { using Value = float; };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Alias for ToNativeType::Value
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="ManagedType">
|
||||||
|
/// Managed type to get the native type for.
|
||||||
|
/// </typeparam>
|
||||||
|
template<typename ManagedType>
|
||||||
|
using ToNativeType_T = typename ToNativeType<ManagedType>::Value;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Type Transformer for native types to managed types.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="ManagedType">
|
||||||
|
/// Managed type to get the native type for.
|
||||||
|
/// </typeparam>
|
||||||
|
template<typename NativeType>
|
||||||
|
struct ToManagedType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using Value = void;
|
||||||
|
};
|
||||||
|
template<> struct ToManagedType<int8_t> { using Value = System::Byte; };
|
||||||
|
template<> struct ToManagedType<int16_t> { using Value = System::Int16; };
|
||||||
|
template<> struct ToManagedType<int32_t> { using Value = System::Int32; };
|
||||||
|
template<> struct ToManagedType<int64_t> { using Value = System::Int64; };
|
||||||
|
template<> struct ToManagedType<uint16_t> { using Value = System::UInt16; };
|
||||||
|
template<> struct ToManagedType<uint32_t> { using Value = System::UInt32; };
|
||||||
|
template<> struct ToManagedType<uint64_t> { using Value = System::UInt64; };
|
||||||
|
template<> struct ToManagedType<bool> { using Value = bool; };
|
||||||
|
template<> struct ToManagedType<double> { using Value = double; };
|
||||||
|
template<> struct ToManagedType<float> { using Value = float; };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Alias for ToManagedType::Value
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="ManagedType">
|
||||||
|
/// Managed type to get the native type for.
|
||||||
|
/// </typeparam>
|
||||||
|
template<typename NativeType>
|
||||||
|
using ToManagedType_T = typename ToManagedType<NativeType>::Value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue