From 901c007cb25875204724b219ec3dc6da538f2ef7 Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Thu, 10 Nov 2022 14:55:28 +0800 Subject: [PATCH 01/14] Added Transform Matrix method to SHMatrix --- SHADE_Engine/src/Math/SHMatrix.cpp | 10 ++++++ SHADE_Engine/src/Math/SHMatrix.h | 51 ++++++++++++++++-------------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/SHADE_Engine/src/Math/SHMatrix.cpp b/SHADE_Engine/src/Math/SHMatrix.cpp index 5f082ae5..3d450a88 100644 --- a/SHADE_Engine/src/Math/SHMatrix.cpp +++ b/SHADE_Engine/src/Math/SHMatrix.cpp @@ -483,6 +483,16 @@ namespace SHADE return result; } + SHMatrix SHMatrix::Transform(const SHVec3& pos, const SHVec3& eulerAngles, const SHVec3& scale) noexcept + { + return Scale(scale) * Rotate(eulerAngles) * Translate(pos); + } + + SHMatrix SHMatrix::Transform(const SHVec3& pos, const SHQuaternion& rot, const SHVec3& scale) noexcept + { + return Scale(scale) * Rotate(rot) * Translate(pos); + } + SHMatrix SHMatrix::LookAtRH(const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept { SHMatrix result; diff --git a/SHADE_Engine/src/Math/SHMatrix.h b/SHADE_Engine/src/Math/SHMatrix.h index 4d8f1bfe..6af8fdc9 100644 --- a/SHADE_Engine/src/Math/SHMatrix.h +++ b/SHADE_Engine/src/Math/SHMatrix.h @@ -131,34 +131,37 @@ namespace SHADE /* Static Function Members */ /*---------------------------------------------------------------------------------*/ - [[nodiscard]] static SHMatrix Transpose (const SHMatrix& matrix) noexcept; - [[nodiscard]] static SHMatrix Inverse (const SHMatrix& matrix) noexcept; + [[nodiscard]] static SHMatrix Transpose (const SHMatrix& matrix) noexcept; + [[nodiscard]] static SHMatrix Inverse (const SHMatrix& matrix) noexcept; - [[nodiscard]] static SHMatrix Translate (float x, float y, float z) noexcept; - [[nodiscard]] static SHMatrix Translate (const SHVec3& pos) noexcept; + [[nodiscard]] static SHMatrix Translate (float x, float y, float z) noexcept; + [[nodiscard]] static SHMatrix Translate (const SHVec3& pos) noexcept; - [[nodiscard]] static SHMatrix Rotate (const SHVec3& axis, float angleInRad) noexcept; - [[nodiscard]] static SHMatrix Rotate (float yaw, float pitch, float roll) noexcept; - [[nodiscard]] static SHMatrix Rotate (const SHVec3& eulerAngles) noexcept; - [[nodiscard]] static SHMatrix Rotate (const SHQuaternion& q) noexcept; - [[nodiscard]] static SHMatrix RotateX (float angleInRad) noexcept; - [[nodiscard]] static SHMatrix RotateY (float angleInRad) noexcept; - [[nodiscard]] static SHMatrix RotateZ (float angleInRad) noexcept; + [[nodiscard]] static SHMatrix Rotate (const SHVec3& axis, float angleInRad) noexcept; + [[nodiscard]] static SHMatrix Rotate (float yaw, float pitch, float roll) noexcept; + [[nodiscard]] static SHMatrix Rotate (const SHVec3& eulerAngles) noexcept; + [[nodiscard]] static SHMatrix Rotate (const SHQuaternion& q) noexcept; + [[nodiscard]] static SHMatrix RotateX (float angleInRad) noexcept; + [[nodiscard]] static SHMatrix RotateY (float angleInRad) noexcept; + [[nodiscard]] static SHMatrix RotateZ (float angleInRad) noexcept; - [[nodiscard]] static SHMatrix Scale (float uniformScaleFactor) noexcept; - [[nodiscard]] static SHMatrix Scale (float x, float y, float z) noexcept; - [[nodiscard]] static SHMatrix Scale (const SHVec3& scale) noexcept; + [[nodiscard]] static SHMatrix Scale (float uniformScaleFactor) noexcept; + [[nodiscard]] static SHMatrix Scale (float x, float y, float z) noexcept; + [[nodiscard]] static SHMatrix Scale (const SHVec3& scale) noexcept; - [[nodiscard]] static SHMatrix LookAtRH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept; - [[nodiscard]] static SHMatrix LookAtLH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept; - [[nodiscard]] static SHMatrix CamToWorldRH (const SHVec3& pos, const SHVec3& forward, const SHVec3& up) noexcept; - [[nodiscard]] static SHMatrix CamToWorldLH (const SHVec3& pos, const SHVec3& forward, const SHVec3& up) noexcept; - [[nodiscard]] static SHMatrix PerspectiveFovRH (float fov, float aspectRatio, float nearPlane, float farPlane) noexcept; - [[nodiscard]] static SHMatrix PerspectiveFovLH (float fov, float aspectRatio, float nearPlane, float farPlane) noexcept; - [[nodiscard]] static SHMatrix PerspectiveRH (float width, float height, float nearPlane, float farPlane) noexcept; - [[nodiscard]] static SHMatrix PerspectiveLH (float width, float height, float nearPlane, float farPlane) noexcept; - [[nodiscard]] static SHMatrix OrthographicRH (float width, float height, float nearPlane, float farPlane) noexcept; - [[nodiscard]] static SHMatrix OrthographicLH (float width, float height, float nearPlane, float farPlane) noexcept; + [[nodiscard]] static SHMatrix Transform (const SHVec3& pos, const SHVec3& eulerAngles, const SHVec3& scale) noexcept; + [[nodiscard]] static SHMatrix Transform (const SHVec3& pos, const SHQuaternion& rot, const SHVec3& scale) noexcept; + + [[nodiscard]] static SHMatrix LookAtRH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept; + [[nodiscard]] static SHMatrix LookAtLH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept; + [[nodiscard]] static SHMatrix CamToWorldRH (const SHVec3& pos, const SHVec3& forward, const SHVec3& up) noexcept; + [[nodiscard]] static SHMatrix CamToWorldLH (const SHVec3& pos, const SHVec3& forward, const SHVec3& up) noexcept; + [[nodiscard]] static SHMatrix PerspectiveFovRH (float fov, float aspectRatio, float nearPlane, float farPlane) noexcept; + [[nodiscard]] static SHMatrix PerspectiveFovLH (float fov, float aspectRatio, float nearPlane, float farPlane) noexcept; + [[nodiscard]] static SHMatrix PerspectiveRH (float width, float height, float nearPlane, float farPlane) noexcept; + [[nodiscard]] static SHMatrix PerspectiveLH (float width, float height, float nearPlane, float farPlane) noexcept; + [[nodiscard]] static SHMatrix OrthographicRH (float width, float height, float nearPlane, float farPlane) noexcept; + [[nodiscard]] static SHMatrix OrthographicLH (float width, float height, float nearPlane, float farPlane) noexcept; // TODO(Diren): Billboard, Shadow, Projection & Reflection }; From 36ed195a694af0aec0c1fe0865b3ba4a57baec79 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Mon, 14 Nov 2022 20:40:52 +0800 Subject: [PATCH 02/14] [FIX] Scene saving when you press play from pause [FIX] WER for transform gizmo can now be pressed regardless of whether editor viewport is focused --- .../Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp | 13 ++++++++++--- .../ViewportWindow/SHEditorViewport.cpp | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp index 223f9b83..2912a0bc 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MenuBar/SHEditorMenuBar.cpp @@ -35,7 +35,7 @@ namespace SHADE constexpr ImGuiWindowFlags dockspaceFlags = ImGuiDockNodeFlags_PassthruCentralNode; - //#==============================================================# + //#==============================================================# //|| Public Member Functions || //#==============================================================# SHEditorMenuBar::SHEditorMenuBar() @@ -221,13 +221,20 @@ namespace SHADE ImGui::BeginDisabled(editor->editorState == SHEditor::State::PLAY); if(ImGui::SmallButton(ICON_MD_PLAY_ARROW)) { - if(editor->SaveScene()) + if(editor->editorState == SHEditor::State::STOP) + { + if (editor->SaveScene()) + { + editor->Play(); + } + } + else { editor->Play(); } } ImGui::EndDisabled(); - ImGui::BeginDisabled(editor->editorState == SHEditor::State::PAUSE); + ImGui::BeginDisabled(editor->editorState == SHEditor::State::STOP || editor->editorState == SHEditor::State::PAUSE); if(ImGui::SmallButton(ICON_MD_PAUSE)) { editor->Pause(); diff --git a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp index d0b32ff5..efd04162 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp @@ -85,7 +85,7 @@ namespace SHADE shouldUpdateCamArm = ImGui::IsWindowHovered() && ImGui::IsKeyDown(ImGuiKey_LeftAlt) && ImGui::IsMouseDown(ImGuiMouseButton_Left); - if (editor->editorState != SHEditor::State::PLAY && ImGui::IsWindowFocused() && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) + if (editor->editorState != SHEditor::State::PLAY && !ImGui::IsAnyItemActive() && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) { if (ImGui::IsKeyReleased(ImGuiKey_W)) { From e93eea63815b9151d291dc8ffa1028a4d317484e Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Tue, 15 Nov 2022 03:03:37 +0800 Subject: [PATCH 03/14] Cleaned up tools folder. Added debug only logging macros with _D suffix --- .../src/Application/SBApplication.cpp | 8 +++-- SHADE_Application/src/WinMain.cpp | 2 +- SHADE_Engine/src/Camera/SHCameraDirector.cpp | 2 +- .../ECS_Base/UnitTesting/SHECSUnitTest.cpp | 2 +- .../HierarchyPanel/SHHierarchyPanel.cpp | 2 +- .../EditorWindow/SHEditorWindowManager.h | 2 +- SHADE_Engine/src/Editor/SHEditor.cpp | 2 +- SHADE_Engine/src/Editor/SHEditor.h | 2 +- .../src/FRC/SHFramerateController.cpp | 4 +-- .../Graphics/Commands/SHVkCommandBuffer.cpp | 2 +- .../src/Graphics/Commands/SHVkCommandPool.cpp | 2 +- .../Debugging/SHValidationLayersQuery.cpp | 2 +- .../Graphics/Debugging/SHVkDebugMessenger.cpp | 4 +-- .../Graphics/Debugging/SHVulkanDebugUtil.cpp | 2 +- .../Descriptors/SHVkDescriptorSetGroup.cpp | 2 +- .../Graphics/Devices/SHVkLogicalDevice.cpp | 2 +- .../Graphics/Devices/SHVkPhysicalDevice.cpp | 2 +- .../Devices/SHVkPhysicalDeviceLibrary.cpp | 2 +- .../Graphics/Framebuffer/SHVkFramebuffer.cpp | 2 +- .../src/Graphics/Images/SHVkImage.cpp | 2 +- .../src/Graphics/Images/SHVkImageView.cpp | 2 +- .../src/Graphics/Instance/SHVkInstance.cpp | 2 +- .../Graphics/MiddleEnd/Batching/SHBatcher.cpp | 2 +- .../GlobalData/SHGraphicsGlobalData.cpp | 2 +- .../Interface/SHMaterialInstance.cpp | 2 +- .../MiddleEnd/Interface/SHViewport.cpp | 2 +- .../MiddleEnd/Lights/SHLightingSubSystem.cpp | 2 +- .../MiddleEnd/PerFrame/SHRenderContext.cpp | 2 +- .../MiddleEnd/Textures/SHTextureLibrary.cpp | 2 +- .../Graphics/Pipeline/SHVkPipelineLayout.cpp | 2 +- .../src/Graphics/Queues/SHVkQueue.cpp | 2 +- .../Graphics/RenderGraph/SHRenderGraph.cpp | 2 +- .../BlockInterface/SHShaderBlockInterface.cpp | 2 +- .../Graphics/Shaders/SHShaderReflected.cpp | 2 +- .../src/Graphics/Shaders/SHVkShaderModule.cpp | 2 +- .../src/Graphics/Swapchain/SHVkSwapchain.cpp | 2 +- .../Windowing/Surface/SHVkSurface.cpp | 2 +- SHADE_Engine/src/Math/SHQuaternion.cpp | 2 +- SHADE_Engine/src/Math/Vector/SHVec2.cpp | 2 +- SHADE_Engine/src/Math/Vector/SHVec3.cpp | 2 +- SHADE_Engine/src/Math/Vector/SHVec4.cpp | 2 +- .../PhysicsObject/SHPhysicsObjectManager.cpp | 2 +- .../Physics/System/SHPhysicsDebugDrawSystem.h | 2 +- .../src/Resource/SHResourceManager.hpp | 2 +- SHADE_Engine/src/SHpch.h | 2 +- .../src/Scripting/SHDotNetRuntime.cpp | 2 +- SHADE_Engine/src/Scripting/SHScriptEngine.cpp | 10 +++---- .../Serialization/SHSerializationHelper.hpp | 2 +- SHADE_Engine/src/Tools/{ => Logger}/SHLog.cpp | 0 SHADE_Engine/src/Tools/{ => Logger}/SHLog.h | 0 .../src/Tools/{ => Logger}/SHLogger.cpp | 0 .../src/Tools/{ => Logger}/SHLogger.h | 30 +++++++++++++++++-- SHADE_Engine/src/Tools/SHException.h | 2 +- SHADE_Engine/src/Tools/SHExceptionHandler.cpp | 2 -- .../{ => Utilities}/SHClipboardUtilities.cpp | 0 .../{ => Utilities}/SHClipboardUtilities.h | 0 .../Tools/{ => Utilities}/SHFileUtilties.cpp | 0 .../Tools/{ => Utilities}/SHFileUtilties.h | 0 .../SHStringUtilities.cpp} | 14 ++++----- .../SHStringUtilities.h} | 8 ++--- .../SHStringUtilities.hpp} | 6 ++-- .../src/Tools/{ => Utilities}/SHUtilities.h | 0 .../src/Tools/{ => Utilities}/SHUtilities.hpp | 0 SHADE_Managed/src/Engine/ECS.cxx | 2 +- SHADE_Managed/src/Scripts/ScriptStore.cxx | 2 +- SHADE_Managed/src/Utility/Debug.cxx | 2 +- 66 files changed, 104 insertions(+), 78 deletions(-) rename SHADE_Engine/src/Tools/{ => Logger}/SHLog.cpp (100%) rename SHADE_Engine/src/Tools/{ => Logger}/SHLog.h (100%) rename SHADE_Engine/src/Tools/{ => Logger}/SHLogger.cpp (100%) rename SHADE_Engine/src/Tools/{ => Logger}/SHLogger.h (88%) rename SHADE_Engine/src/Tools/{ => Utilities}/SHClipboardUtilities.cpp (100%) rename SHADE_Engine/src/Tools/{ => Utilities}/SHClipboardUtilities.h (100%) rename SHADE_Engine/src/Tools/{ => Utilities}/SHFileUtilties.cpp (100%) rename SHADE_Engine/src/Tools/{ => Utilities}/SHFileUtilties.h (100%) rename SHADE_Engine/src/Tools/{SHStringUtils.cpp => Utilities/SHStringUtilities.cpp} (79%) rename SHADE_Engine/src/Tools/{SHStringUtils.h => Utilities/SHStringUtilities.h} (96%) rename SHADE_Engine/src/Tools/{SHStringUtils.hpp => Utilities/SHStringUtilities.hpp} (89%) rename SHADE_Engine/src/Tools/{ => Utilities}/SHUtilities.h (100%) rename SHADE_Engine/src/Tools/{ => Utilities}/SHUtilities.hpp (100%) diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index bf5b8d49..1095f965 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -8,8 +8,8 @@ //#include "Scenes/SBEditorScene.h" #endif // SHEDITOR -#include "Tools/SHLogger.h" -#include "Tools/SHFileUtilties.h" +#include "Tools/Logger/SHLogger.h" +#include "Tools/Utilities/SHFileUtilties.h" #include #include @@ -44,7 +44,7 @@ #include "Scenes/SBMainScene.h" #include "Serialization/Configurations/SHConfigurationManager.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Tools/SHDebugDraw.h" using namespace SHADE; @@ -60,6 +60,8 @@ namespace Sandbox _In_ INT nCmdShow ) { + SHLOG_INFO_D("Initialising SHADE engine") + // Set working directory SHFileUtilities::SetWorkDirToExecDir(); WindowData wndData{}; diff --git a/SHADE_Application/src/WinMain.cpp b/SHADE_Application/src/WinMain.cpp index f672cead..9dcab1ab 100644 --- a/SHADE_Application/src/WinMain.cpp +++ b/SHADE_Application/src/WinMain.cpp @@ -1,6 +1,6 @@ #include "SBpch.h" #include -#include +#include #include #include "Application/SBApplication.h" diff --git a/SHADE_Engine/src/Camera/SHCameraDirector.cpp b/SHADE_Engine/src/Camera/SHCameraDirector.cpp index 98341098..9e9ddb5c 100644 --- a/SHADE_Engine/src/Camera/SHCameraDirector.cpp +++ b/SHADE_Engine/src/Camera/SHCameraDirector.cpp @@ -5,7 +5,7 @@ #include "ECS_Base/Managers/SHComponentManager.h" #include "ECS_Base/SHECSMacros.h" #include "ECS_Base/Managers/SHEntityManager.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" namespace SHADE { diff --git a/SHADE_Engine/src/ECS_Base/UnitTesting/SHECSUnitTest.cpp b/SHADE_Engine/src/ECS_Base/UnitTesting/SHECSUnitTest.cpp index 050d0c2e..db41d848 100644 --- a/SHADE_Engine/src/ECS_Base/UnitTesting/SHECSUnitTest.cpp +++ b/SHADE_Engine/src/ECS_Base/UnitTesting/SHECSUnitTest.cpp @@ -5,7 +5,7 @@ #include "../Managers/SHSystemManager.h" #include "SHTestComponents.h" #include "SHTestSystems.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp index 6be89a8b..2a24ad0e 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp @@ -23,7 +23,7 @@ #include #include "Serialization/SHSerialization.h" -#include "Tools/SHClipboardUtilities.h" +#include "Tools/Utilities/SHClipboardUtilities.h" namespace SHADE diff --git a/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindowManager.h b/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindowManager.h index 9e6dd3f4..60730f0e 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindowManager.h +++ b/SHADE_Engine/src/Editor/EditorWindow/SHEditorWindowManager.h @@ -3,7 +3,7 @@ #include #include #include "SHEditorWindow.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" namespace SHADE { diff --git a/SHADE_Engine/src/Editor/SHEditor.cpp b/SHADE_Engine/src/Editor/SHEditor.cpp index 077c7025..7372f227 100644 --- a/SHADE_Engine/src/Editor/SHEditor.cpp +++ b/SHADE_Engine/src/Editor/SHEditor.cpp @@ -10,7 +10,7 @@ //#==============================================================# //|| SHADE Includes || //#==============================================================# -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Tools/SHException.h" #include "ECS_Base/Managers/SHSystemManager.h" diff --git a/SHADE_Engine/src/Editor/SHEditor.h b/SHADE_Engine/src/Editor/SHEditor.h index 5897c8b7..0a485109 100644 --- a/SHADE_Engine/src/Editor/SHEditor.h +++ b/SHADE_Engine/src/Editor/SHEditor.h @@ -15,7 +15,7 @@ #include "ECS_Base/System/SHSystemRoutine.h" #include "Resource/SHHandle.h" #include "EditorWindow/SHEditorWindow.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" #include "Gizmos/SHTransformGizmo.h" #include "Events/SHEventDefines.h" #include "Events/SHEvent.h" diff --git a/SHADE_Engine/src/FRC/SHFramerateController.cpp b/SHADE_Engine/src/FRC/SHFramerateController.cpp index 0791d628..02e0f430 100644 --- a/SHADE_Engine/src/FRC/SHFramerateController.cpp +++ b/SHADE_Engine/src/FRC/SHFramerateController.cpp @@ -12,11 +12,11 @@ //TODO Legacy code. Delete soon +#include + #include #include -#include #include "SHFramerateController.h" -#include "../Tools/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp index cc35303b..05fd4288 100644 --- a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp +++ b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp @@ -3,7 +3,7 @@ #include "SHVkCommandPool.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "SHVkCommandPool.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Renderpass/SHVkRenderpass.h" #include "Graphics/Framebuffer/SHVkFramebuffer.h" #include "Graphics/Pipeline/SHVkPipeline.h" diff --git a/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp b/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp index 375ece4d..fc9769d9 100644 --- a/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp +++ b/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp @@ -3,7 +3,7 @@ #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Instance/SHVkInstance.h" #include "Resource/SHResourceLibrary.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Debugging/SHValidationLayersQuery.cpp b/SHADE_Engine/src/Graphics/Debugging/SHValidationLayersQuery.cpp index 420fa9e5..0dba5c5b 100644 --- a/SHADE_Engine/src/Graphics/Debugging/SHValidationLayersQuery.cpp +++ b/SHADE_Engine/src/Graphics/Debugging/SHValidationLayersQuery.cpp @@ -1,6 +1,6 @@ #include "SHPch.h" #include "SHValidationLayersQuery.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Debugging/SHVkDebugMessenger.cpp b/SHADE_Engine/src/Graphics/Debugging/SHVkDebugMessenger.cpp index 3ca5c94d..fd7d55e9 100644 --- a/SHADE_Engine/src/Graphics/Debugging/SHVkDebugMessenger.cpp +++ b/SHADE_Engine/src/Graphics/Debugging/SHVkDebugMessenger.cpp @@ -3,8 +3,8 @@ #include "SHVkDebugMessenger.h" #include "SHVulkanDebugUtil.h" #include "Graphics/Instance/SHVkInstance.h" -#include "Tools/SHLogger.h" -//#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" +//#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Debugging/SHVulkanDebugUtil.cpp b/SHADE_Engine/src/Graphics/Debugging/SHVulkanDebugUtil.cpp index fd39da24..eea07ed6 100644 --- a/SHADE_Engine/src/Graphics/Debugging/SHVulkanDebugUtil.cpp +++ b/SHADE_Engine/src/Graphics/Debugging/SHVulkanDebugUtil.cpp @@ -1,6 +1,6 @@ #include "SHPch.h" #include "SHVulkanDebugUtil.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Descriptors/SHVkDescriptorSetGroup.cpp b/SHADE_Engine/src/Graphics/Descriptors/SHVkDescriptorSetGroup.cpp index de68c583..adb51586 100644 --- a/SHADE_Engine/src/Graphics/Descriptors/SHVkDescriptorSetGroup.cpp +++ b/SHADE_Engine/src/Graphics/Descriptors/SHVkDescriptorSetGroup.cpp @@ -6,7 +6,7 @@ #include "SHVkDescriptorPool.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Descriptors/SHVkDescriptorSetLayout.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Images/SHVkImage.h" #include "Graphics/Images/SHVkImageView.h" #include "Graphics/Images/SHVkSampler.h" diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp index 808ce750..272a838d 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp +++ b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp @@ -2,7 +2,7 @@ #include "SHVkLogicalDevice.h" #include "SHVkPhysicalDevice.h" #include "Graphics/Instance/SHVkInstance.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Windowing/Surface/SHVkSurface.h" #include "Graphics/Swapchain/SHVkSwapchain.h" #include "Graphics/Commands/SHVkCommandPool.h" diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDevice.cpp b/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDevice.cpp index 53b352b7..1f40a533 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDevice.cpp +++ b/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDevice.cpp @@ -3,7 +3,7 @@ #include #include #include -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDeviceLibrary.cpp b/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDeviceLibrary.cpp index 3cf0a8e6..050ca769 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDeviceLibrary.cpp +++ b/SHADE_Engine/src/Graphics/Devices/SHVkPhysicalDeviceLibrary.cpp @@ -3,7 +3,7 @@ #include #include "SHVkPhysicalDeviceLibrary.h" #include "Graphics/Instance/SHVkInstance.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Framebuffer/SHVkFramebuffer.cpp b/SHADE_Engine/src/Graphics/Framebuffer/SHVkFramebuffer.cpp index 76e627d3..7a46c473 100644 --- a/SHADE_Engine/src/Graphics/Framebuffer/SHVkFramebuffer.cpp +++ b/SHADE_Engine/src/Graphics/Framebuffer/SHVkFramebuffer.cpp @@ -3,7 +3,7 @@ #include "Graphics/Images/SHVkImageView.h" #include "Graphics/Images/SHVkImage.h" #include "Graphics/Renderpass/SHVkRenderpass.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Devices/SHVkLogicalDevice.h" namespace SHADE diff --git a/SHADE_Engine/src/Graphics/Images/SHVkImage.cpp b/SHADE_Engine/src/Graphics/Images/SHVkImage.cpp index 33bed1b5..fa43cd53 100644 --- a/SHADE_Engine/src/Graphics/Images/SHVkImage.cpp +++ b/SHADE_Engine/src/Graphics/Images/SHVkImage.cpp @@ -2,7 +2,7 @@ #include "SHVkImage.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Debugging/SHVulkanDebugUtil.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "SHVkImageView.h" #include "Graphics/Instance/SHVkInstance.h" #include "Graphics/Buffers/SHVkBuffer.h" diff --git a/SHADE_Engine/src/Graphics/Images/SHVkImageView.cpp b/SHADE_Engine/src/Graphics/Images/SHVkImageView.cpp index 44b5718c..d07c66b7 100644 --- a/SHADE_Engine/src/Graphics/Images/SHVkImageView.cpp +++ b/SHADE_Engine/src/Graphics/Images/SHVkImageView.cpp @@ -2,7 +2,7 @@ #include "SHVkImageView.h" #include "SHVkImage.h" #include "Graphics/Devices/SHVkLogicalDevice.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Instance/SHVkInstance.cpp b/SHADE_Engine/src/Graphics/Instance/SHVkInstance.cpp index edfe4b46..237c6fee 100644 --- a/SHADE_Engine/src/Graphics/Instance/SHVkInstance.cpp +++ b/SHADE_Engine/src/Graphics/Instance/SHVkInstance.cpp @@ -3,7 +3,7 @@ #include "Graphics/Debugging/SHValidationLayersQuery.h" #include "Graphics/Debugging/SHVkDebugMessenger.h" #include "Graphics/Devices/SHVkPhysicalDeviceLibrary.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Devices/SHVkPhysicalDeviceLibrary.h" //#include diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatcher.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatcher.cpp index dc44e7f9..41aebeb6 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatcher.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Batching/SHBatcher.cpp @@ -22,7 +22,7 @@ of DigiPen Institute of Technology is prohibited. #include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h" #include "Graphics/Pipeline/SHVkPipeline.h" #include "ECS_Base/Managers/SHComponentManager.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp index de42d9a3..28333820 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp @@ -5,7 +5,7 @@ #include "Graphics/Pipeline/SHVkPipelineLayout.h" #include "Graphics/Descriptors/SHVkDescriptorSetLayout.h" #include "Graphics/MiddleEnd/Lights/SHLightData.h" -#include "Tools/SHUtilities.h" +#include "Tools/Utilities/SHUtilities.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.cpp index 350580bf..ff7084c2 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.cpp @@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited. #include "SHGraphicsConstants.h" #include "SHMaterial.h" #include "Graphics/Pipeline/SHVkPipeline.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHViewport.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHViewport.cpp index df9e244e..7bd0049f 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHViewport.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHViewport.cpp @@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited. #include "Graphics/Commands/SHVkCommandBuffer.h" #include "Graphics/Instance/SHVkInstance.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "SHRenderer.h" #include "Resource/SHResourceLibrary.h" #include "Graphics/RenderGraph/SHRenderGraph.h" diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp index 51eaf5f1..2949ad43 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp @@ -1,7 +1,7 @@ #include "SHpch.h" #include "SHLightingSubSystem.h" #include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h" -#include "Tools/SHUtilities.h" +#include "Tools/Utilities/SHUtilities.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Buffers/SHVkBuffer.h" #include "Graphics/Descriptors/SHVkDescriptorSetGroup.h" diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/PerFrame/SHRenderContext.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/PerFrame/SHRenderContext.cpp index 1d24d6f7..b12ac75d 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/PerFrame/SHRenderContext.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/PerFrame/SHRenderContext.cpp @@ -1,6 +1,6 @@ #include "SHPch.h" #include "SHRenderContext.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Swapchain/SHVkSwapchain.h" diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp index b92ccddf..dfb3f3b9 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Textures/SHTextureLibrary.cpp @@ -19,7 +19,7 @@ of DigiPen Institute of Technology is prohibited. #include "Graphics/Buffers/SHVkBuffer.h" #include "Graphics/Commands/SHVkCommandBuffer.h" #include "Graphics/SHVkUtil.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/MiddleEnd/Interface/SHGraphicsConstants.h" #include "Graphics/Descriptors/SHVkDescriptorSetGroup.h" #include "Graphics/Images/SHVkImage.h" diff --git a/SHADE_Engine/src/Graphics/Pipeline/SHVkPipelineLayout.cpp b/SHADE_Engine/src/Graphics/Pipeline/SHVkPipelineLayout.cpp index 47b2e010..589e66d2 100644 --- a/SHADE_Engine/src/Graphics/Pipeline/SHVkPipelineLayout.cpp +++ b/SHADE_Engine/src/Graphics/Pipeline/SHVkPipelineLayout.cpp @@ -2,7 +2,7 @@ #include "SHVkPipelineLayout.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Shaders/SHVkShaderModule.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Instance/SHVkInstance.h" namespace SHADE diff --git a/SHADE_Engine/src/Graphics/Queues/SHVkQueue.cpp b/SHADE_Engine/src/Graphics/Queues/SHVkQueue.cpp index dcb3ff6a..4d8b0d76 100644 --- a/SHADE_Engine/src/Graphics/Queues/SHVkQueue.cpp +++ b/SHADE_Engine/src/Graphics/Queues/SHVkQueue.cpp @@ -1,6 +1,6 @@ #include "SHPch.h" #include "SHVkQueue.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Synchronization/SHVkSemaphore.h" #include "Graphics/Synchronization/SHVkFence.h" diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp index 500bcf04..d9c7f17a 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHRenderGraph.cpp @@ -7,7 +7,7 @@ #include "Graphics/Images/SHVkImageView.h" #include "Graphics/Framebuffer/SHVkFramebuffer.h" #include "Graphics/Buffers/SHVkBuffer.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "SHAttachmentDescInitParams.h" #include "SHRenderGraphStorage.h" #include "Graphics/RenderGraph/SHRenderGraphNodeCompute.h" diff --git a/SHADE_Engine/src/Graphics/Shaders/BlockInterface/SHShaderBlockInterface.cpp b/SHADE_Engine/src/Graphics/Shaders/BlockInterface/SHShaderBlockInterface.cpp index 67c83266..dfb91193 100644 --- a/SHADE_Engine/src/Graphics/Shaders/BlockInterface/SHShaderBlockInterface.cpp +++ b/SHADE_Engine/src/Graphics/Shaders/BlockInterface/SHShaderBlockInterface.cpp @@ -1,6 +1,6 @@ #include "SHPch.h" #include "SHShaderBlockInterface.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Shaders/SHShaderReflected.cpp b/SHADE_Engine/src/Graphics/Shaders/SHShaderReflected.cpp index 96fa77ab..96de87bb 100644 --- a/SHADE_Engine/src/Graphics/Shaders/SHShaderReflected.cpp +++ b/SHADE_Engine/src/Graphics/Shaders/SHShaderReflected.cpp @@ -1,6 +1,6 @@ #include "SHPch.h" #include "SHShaderReflected.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Instance/SHVkInstance.h" diff --git a/SHADE_Engine/src/Graphics/Shaders/SHVkShaderModule.cpp b/SHADE_Engine/src/Graphics/Shaders/SHVkShaderModule.cpp index c1fac76c..fa6b3182 100644 --- a/SHADE_Engine/src/Graphics/Shaders/SHVkShaderModule.cpp +++ b/SHADE_Engine/src/Graphics/Shaders/SHVkShaderModule.cpp @@ -2,7 +2,7 @@ #include "SHVkShaderModule.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Debugging/SHVulkanDebugUtil.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Graphics/Swapchain/SHVkSwapchain.cpp b/SHADE_Engine/src/Graphics/Swapchain/SHVkSwapchain.cpp index f46d5d17..40f917a0 100644 --- a/SHADE_Engine/src/Graphics/Swapchain/SHVkSwapchain.cpp +++ b/SHADE_Engine/src/Graphics/Swapchain/SHVkSwapchain.cpp @@ -3,7 +3,7 @@ #include "Graphics/Devices/SHVkPhysicalDevice.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Windowing/Surface/SHVkSurface.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Graphics/Images/SHVkImage.h" #include "Graphics/Instance/SHVkInstance.h" diff --git a/SHADE_Engine/src/Graphics/Windowing/Surface/SHVkSurface.cpp b/SHADE_Engine/src/Graphics/Windowing/Surface/SHVkSurface.cpp index f9cb16c6..7d55ab72 100644 --- a/SHADE_Engine/src/Graphics/Windowing/Surface/SHVkSurface.cpp +++ b/SHADE_Engine/src/Graphics/Windowing/Surface/SHVkSurface.cpp @@ -4,7 +4,7 @@ #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/Instance/SHVkInstance.h" #include "Graphics/Debugging/SHVulkanDebugUtil.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Math/SHQuaternion.cpp b/SHADE_Engine/src/Math/SHQuaternion.cpp index 3564916a..8904cb05 100644 --- a/SHADE_Engine/src/Math/SHQuaternion.cpp +++ b/SHADE_Engine/src/Math/SHQuaternion.cpp @@ -16,7 +16,7 @@ #include "Vector/SHVec3.h" #include "SHMatrix.h" #include "SHMathHelpers.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" using namespace DirectX; diff --git a/SHADE_Engine/src/Math/Vector/SHVec2.cpp b/SHADE_Engine/src/Math/Vector/SHVec2.cpp index 195a8b14..9573be01 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec2.cpp +++ b/SHADE_Engine/src/Math/Vector/SHVec2.cpp @@ -14,7 +14,7 @@ #include "SHVec2.h" // Project Headers #include "Math/SHMatrix.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" using namespace DirectX; diff --git a/SHADE_Engine/src/Math/Vector/SHVec3.cpp b/SHADE_Engine/src/Math/Vector/SHVec3.cpp index cbd8ca32..a696f341 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec3.cpp +++ b/SHADE_Engine/src/Math/Vector/SHVec3.cpp @@ -15,7 +15,7 @@ // Project Headers #include "Math/SHMatrix.h" #include "Math/SHQuaternion.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" using namespace DirectX; diff --git a/SHADE_Engine/src/Math/Vector/SHVec4.cpp b/SHADE_Engine/src/Math/Vector/SHVec4.cpp index 943d540e..c6f01d9e 100644 --- a/SHADE_Engine/src/Math/Vector/SHVec4.cpp +++ b/SHADE_Engine/src/Math/Vector/SHVec4.cpp @@ -15,7 +15,7 @@ // Project Headers #include "Math/SHMatrix.h" #include "Math/SHColour.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" using namespace DirectX; diff --git a/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp b/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp index f8a4040f..ffd10e0c 100644 --- a/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp +++ b/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp @@ -15,7 +15,7 @@ // Project Headers #include "ECS_Base/Managers/SHEntityManager.h" -#include "Tools/SHUtilities.h" +#include "Tools/Utilities/SHUtilities.h" namespace SHADE { diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsDebugDrawSystem.h b/SHADE_Engine/src/Physics/System/SHPhysicsDebugDrawSystem.h index 53037ab2..390e3d69 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsDebugDrawSystem.h +++ b/SHADE_Engine/src/Physics/System/SHPhysicsDebugDrawSystem.h @@ -16,7 +16,7 @@ #include "ECS_Base/System/SHSystemRoutine.h" #include "Math/SHColour.h" #include "SHPhysicsSystem.h" -#include "Tools/SHUtilities.h" +#include "Tools/Utilities/SHUtilities.h" namespace SHADE { diff --git a/SHADE_Engine/src/Resource/SHResourceManager.hpp b/SHADE_Engine/src/Resource/SHResourceManager.hpp index 01d82a7b..1e3b958d 100644 --- a/SHADE_Engine/src/Resource/SHResourceManager.hpp +++ b/SHADE_Engine/src/Resource/SHResourceManager.hpp @@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited. #include "Assets/Asset Types/SHAssetIncludes.h" #include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h" #include "ECS_Base/Managers/SHSystemManager.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" #include "Graphics/Shaders/SHVkShaderModule.h" #include "Graphics/Devices/SHVkLogicalDevice.h" #include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h" diff --git a/SHADE_Engine/src/SHpch.h b/SHADE_Engine/src/SHpch.h index 7e308829..31553611 100644 --- a/SHADE_Engine/src/SHpch.h +++ b/SHADE_Engine/src/SHpch.h @@ -37,5 +37,5 @@ #include #include "Common/SHCommonTypes.h" -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" #include "Tools/SHException.h" diff --git a/SHADE_Engine/src/Scripting/SHDotNetRuntime.cpp b/SHADE_Engine/src/Scripting/SHDotNetRuntime.cpp index 6226949e..955a8474 100644 --- a/SHADE_Engine/src/Scripting/SHDotNetRuntime.cpp +++ b/SHADE_Engine/src/Scripting/SHDotNetRuntime.cpp @@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited. #include // External Dependencies #include // PathRemoveFileSpecA -#include "Tools/SHLogger.h" +#include "Tools/Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp index 05a144e3..0db11c7a 100644 --- a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp +++ b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp @@ -19,8 +19,8 @@ of DigiPen Institute of Technology is prohibited. #include // std::shared_ptr #include // std::this_thread::sleep_for // Project Headers -#include "Tools/SHLogger.h" -#include "Tools/SHStringUtils.h" +#include "Tools/Logger/SHLogger.h" +#include "Tools/Utilities/SHStringUtilities.h" #include "ECS_Base/Events/SHEntityDestroyedEvent.h" #include "Events/SHEvent.h" #include "Events/SHEventReceiver.h" @@ -616,7 +616,7 @@ namespace SHADE auto err = GetLastError(); std::ostringstream oss; oss << "[ScriptEngine] Failed to launch process. Error code: " << std::hex << err - << " (" << SHStringUtils::GetWin32ErrorMessage(err) << ")"; + << " (" << SHStringUtilities::GetWin32ErrorMessage(err) << ")"; throw std::runtime_error(oss.str()); } @@ -630,7 +630,7 @@ namespace SHADE auto err = GetLastError(); std::ostringstream oss; oss << "[ScriptEngine] Failed to query process. Error code: " << std::hex << err - << " (" << SHStringUtils::GetWin32ErrorMessage(err) << ")"; + << " (" << SHStringUtilities::GetWin32ErrorMessage(err) << ")"; throw std::runtime_error(oss.str()); } @@ -647,7 +647,7 @@ namespace SHADE std::wstring SHScriptEngine::generateBuildCommand(bool debug) { std::wostringstream oss; - oss << "dotnet build \"" << SHStringUtils::StrToWstr(CSPROJ_PATH) << "\" -c "; + oss << "dotnet build \"" << SHStringUtilities::StrToWstr(CSPROJ_PATH) << "\" -c "; oss << debug ? "Debug" : "Release"; oss << " -o \"./tmp/\" -fl -flp:LogFile=build.log;Verbosity=quiet -r \"win-x64\""; return oss.str(); diff --git a/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp b/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp index b062b348..84e99345 100644 --- a/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp +++ b/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp @@ -9,7 +9,7 @@ #include "ECS_Base/Managers/SHComponentManager.h" #include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" namespace SHADE diff --git a/SHADE_Engine/src/Tools/SHLog.cpp b/SHADE_Engine/src/Tools/Logger/SHLog.cpp similarity index 100% rename from SHADE_Engine/src/Tools/SHLog.cpp rename to SHADE_Engine/src/Tools/Logger/SHLog.cpp diff --git a/SHADE_Engine/src/Tools/SHLog.h b/SHADE_Engine/src/Tools/Logger/SHLog.h similarity index 100% rename from SHADE_Engine/src/Tools/SHLog.h rename to SHADE_Engine/src/Tools/Logger/SHLog.h diff --git a/SHADE_Engine/src/Tools/SHLogger.cpp b/SHADE_Engine/src/Tools/Logger/SHLogger.cpp similarity index 100% rename from SHADE_Engine/src/Tools/SHLogger.cpp rename to SHADE_Engine/src/Tools/Logger/SHLogger.cpp diff --git a/SHADE_Engine/src/Tools/SHLogger.h b/SHADE_Engine/src/Tools/Logger/SHLogger.h similarity index 88% rename from SHADE_Engine/src/Tools/SHLogger.h rename to SHADE_Engine/src/Tools/Logger/SHLogger.h index e4a4928c..1a14df9c 100644 --- a/SHADE_Engine/src/Tools/SHLogger.h +++ b/SHADE_Engine/src/Tools/Logger/SHLogger.h @@ -177,8 +177,34 @@ namespace SHADE /*-------------------------------------------------------------------------------------*/ #ifdef _DEBUG - #define SHLOG_TRACE(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_TRACE(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); - #define SHLOGV_TRACE(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_TRACE(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + + #define SHLOG_INFO_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + #define SHLOGV_INFO_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + + #define SHLOG_WARNING_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_WARN(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + #define SHLOGV_WARNING_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_WARN(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + + #define SHLOG_ERROR_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_ERROR(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + #define SHLOGV_ERROR_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_ERROR(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + + #define SHLOG_CRITICAL_D(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_CRITICAL(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + #define SHLOGV_CRITICAL_D(format, ...) SHADE::SHLogger::UseVerbosePattern(); SPDLOG_LOGGER_CRITICAL(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); + +#else + + #define SHLOG_INFO_D(format, ...) + #define SHLOGV_INFO_D(format, ...) + + #define SHLOG_WARNING_D(format, ...) + #define SHLOGV_WARNING_D(format, ...) + + #define SHLOG_ERROR_D(format, ...) + #define SHLOGV_ERROR_D(format, ...) + + #define SHLOG_CRITICAL_D(format, ...) + #define SHLOGV_CRITICAL_D(format, ...) + + #endif #define SHLOG_INFO(format, ...) SHADE::SHLogger::UseTrivialPattern(); SPDLOG_LOGGER_INFO(spdlog::get(SHLOGGER_NAME), format, ## __VA_ARGS__); diff --git a/SHADE_Engine/src/Tools/SHException.h b/SHADE_Engine/src/Tools/SHException.h index 2e0b82a9..ac6a11b7 100644 --- a/SHADE_Engine/src/Tools/SHException.h +++ b/SHADE_Engine/src/Tools/SHException.h @@ -18,7 +18,7 @@ #include // Project Headers -#include "SHLogger.h" +#include "Logger/SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Tools/SHExceptionHandler.cpp b/SHADE_Engine/src/Tools/SHExceptionHandler.cpp index ff6df05c..a4892321 100644 --- a/SHADE_Engine/src/Tools/SHExceptionHandler.cpp +++ b/SHADE_Engine/src/Tools/SHExceptionHandler.cpp @@ -12,10 +12,8 @@ // Primary Header #include "SHExceptionHandler.h" - // Project Headers #include "SHException.h" -#include "SHLogger.h" namespace SHADE { diff --git a/SHADE_Engine/src/Tools/SHClipboardUtilities.cpp b/SHADE_Engine/src/Tools/Utilities/SHClipboardUtilities.cpp similarity index 100% rename from SHADE_Engine/src/Tools/SHClipboardUtilities.cpp rename to SHADE_Engine/src/Tools/Utilities/SHClipboardUtilities.cpp diff --git a/SHADE_Engine/src/Tools/SHClipboardUtilities.h b/SHADE_Engine/src/Tools/Utilities/SHClipboardUtilities.h similarity index 100% rename from SHADE_Engine/src/Tools/SHClipboardUtilities.h rename to SHADE_Engine/src/Tools/Utilities/SHClipboardUtilities.h diff --git a/SHADE_Engine/src/Tools/SHFileUtilties.cpp b/SHADE_Engine/src/Tools/Utilities/SHFileUtilties.cpp similarity index 100% rename from SHADE_Engine/src/Tools/SHFileUtilties.cpp rename to SHADE_Engine/src/Tools/Utilities/SHFileUtilties.cpp diff --git a/SHADE_Engine/src/Tools/SHFileUtilties.h b/SHADE_Engine/src/Tools/Utilities/SHFileUtilties.h similarity index 100% rename from SHADE_Engine/src/Tools/SHFileUtilties.h rename to SHADE_Engine/src/Tools/Utilities/SHFileUtilties.h diff --git a/SHADE_Engine/src/Tools/SHStringUtils.cpp b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp similarity index 79% rename from SHADE_Engine/src/Tools/SHStringUtils.cpp rename to SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp index a2594888..b1e4aa92 100644 --- a/SHADE_Engine/src/Tools/SHStringUtils.cpp +++ b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.cpp @@ -1,5 +1,5 @@ /************************************************************************************//*! -\file StringUtilities.cpp +\file SHStringUtilities.cpp \author Tng Kah Wei, kahwei.tng, 390009620 \par email: kahwei.tng\@digipen.edu \date Nov 29, 2021 @@ -12,22 +12,22 @@ of DigiPen Institute of Technology is prohibited. // Precompiled Header #include // Primary Header -#include "SHStringUtils.h" +#include "SHStringUtilities.h" namespace SHADE { /*---------------------------------------------------------------------------------*/ /* Utility Functions */ /*---------------------------------------------------------------------------------*/ - std::vector SHStringUtils::Split(const std::string& str, const char& delim) + std::vector SHStringUtilities::Split(const std::string& str, const char& delim) { return Split(str, delim); } - std::vector SHStringUtils::Split(const std::wstring& str, const wchar_t& delim) + std::vector SHStringUtilities::Split(const std::wstring& str, const wchar_t& delim) { return Split(str, delim); } - std::string SHStringUtils::WstrToStr(const std::wstring& wstr) + std::string SHStringUtilities::WstrToStr(const std::wstring& wstr) { static std::vector buffer; const int STR_SIZE = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast(wstr.size()), nullptr, 0, nullptr, nullptr) + 1 /* Null Terminator */; @@ -35,7 +35,7 @@ namespace SHADE WideCharToMultiByte(CP_UTF8, 0, wstr.data(), static_cast(wstr.size()), buffer.data(), MAX_PATH, nullptr, nullptr); return std::string(buffer.data()); } - std::wstring SHStringUtils::StrToWstr(const std::string& str) + std::wstring SHStringUtilities::StrToWstr(const std::string& str) { static std::vector buffer; const int WSTR_SIZE = MultiByteToWideChar(CP_UTF8, 0, str.data(), static_cast(str.size()), nullptr, 0) + 1 /* Null Terminator */; @@ -44,7 +44,7 @@ namespace SHADE return std::wstring(buffer.data()); } - std::string SHStringUtils::GetWin32ErrorMessage(unsigned long errorCode) + std::string SHStringUtilities::GetWin32ErrorMessage(unsigned long errorCode) { return std::system_category().message(errorCode); } diff --git a/SHADE_Engine/src/Tools/SHStringUtils.h b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h similarity index 96% rename from SHADE_Engine/src/Tools/SHStringUtils.h rename to SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h index 1c895b99..bac83b07 100644 --- a/SHADE_Engine/src/Tools/SHStringUtils.h +++ b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.h @@ -1,5 +1,5 @@ /************************************************************************************//*! -\file StringUtilities.h +\file SHStringUtilities.h \author Tng Kah Wei, kahwei.tng, 390009620 \par email: kahwei.tng\@digipen.edu \date Nov 29, 2021 @@ -19,7 +19,7 @@ namespace SHADE /// /// Contains useful functions for operating on strings. /// - class SHStringUtils + class SHStringUtilities { public: /*-----------------------------------------------------------------------------*/ @@ -74,8 +74,8 @@ namespace SHADE /*-------------------------------------------------------------------------------*/ /* Constructors/Destructors */ /*-------------------------------------------------------------------------------*/ - SHStringUtils() = delete; + SHStringUtilities() = delete; }; } -#include "SHStringUtils.hpp" +#include "SHStringUtilities.hpp" diff --git a/SHADE_Engine/src/Tools/SHStringUtils.hpp b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.hpp similarity index 89% rename from SHADE_Engine/src/Tools/SHStringUtils.hpp rename to SHADE_Engine/src/Tools/Utilities/SHStringUtilities.hpp index 8b83187a..2e29c684 100644 --- a/SHADE_Engine/src/Tools/SHStringUtils.hpp +++ b/SHADE_Engine/src/Tools/Utilities/SHStringUtilities.hpp @@ -1,5 +1,5 @@ /************************************************************************************//*! -\file StringUtilities.hpp +\file SHStringUtilities.hpp \author Tng Kah Wei, kahwei.tng, 390009620 \par email: kahwei.tng\@digipen.edu \date Nov 29, 2021 @@ -12,7 +12,7 @@ of DigiPen Institute of Technology is prohibited. *//*************************************************************************************/ #pragma once // Primary Header -#include "SHStringUtils.h" +#include "SHStringUtilities.h" namespace SHADE { @@ -20,7 +20,7 @@ namespace SHADE /* Template Function Definitions */ /*-------------------------------------------------------------------------------*/ template - inline std::vector> SHStringUtils::Split(const std::basic_string& str, const T& delim) + inline std::vector> SHStringUtilities::Split(const std::basic_string& str, const T& delim) { std::vector> results; std::basic_string remaining = str; diff --git a/SHADE_Engine/src/Tools/SHUtilities.h b/SHADE_Engine/src/Tools/Utilities/SHUtilities.h similarity index 100% rename from SHADE_Engine/src/Tools/SHUtilities.h rename to SHADE_Engine/src/Tools/Utilities/SHUtilities.h diff --git a/SHADE_Engine/src/Tools/SHUtilities.hpp b/SHADE_Engine/src/Tools/Utilities/SHUtilities.hpp similarity index 100% rename from SHADE_Engine/src/Tools/SHUtilities.hpp rename to SHADE_Engine/src/Tools/Utilities/SHUtilities.hpp diff --git a/SHADE_Managed/src/Engine/ECS.cxx b/SHADE_Managed/src/Engine/ECS.cxx index 76a6a5e2..ffdffd12 100644 --- a/SHADE_Managed/src/Engine/ECS.cxx +++ b/SHADE_Managed/src/Engine/ECS.cxx @@ -26,7 +26,7 @@ of DigiPen Institute of Technology is prohibited. #include "Physics/Interface/SHRigidBodyComponent.h" #include "Scene/SHSceneManager.h" #include "Scene/SHSceneGraph.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" #include "Graphics\MiddleEnd\Interface\SHRenderable.h" // Project Headers #include "Utility/Convert.hxx" diff --git a/SHADE_Managed/src/Scripts/ScriptStore.cxx b/SHADE_Managed/src/Scripts/ScriptStore.cxx index 2b1540b6..d57122ee 100644 --- a/SHADE_Managed/src/Scripts/ScriptStore.cxx +++ b/SHADE_Managed/src/Scripts/ScriptStore.cxx @@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited. #include // External Dependencies #include "ECS_Base/Managers/SHEntityManager.h" -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" // Project Headers #include "Utility/Debug.hxx" #include "Utility/Convert.hxx" diff --git a/SHADE_Managed/src/Utility/Debug.cxx b/SHADE_Managed/src/Utility/Debug.cxx index 8a107ab3..cdc19df0 100644 --- a/SHADE_Managed/src/Utility/Debug.cxx +++ b/SHADE_Managed/src/Utility/Debug.cxx @@ -19,7 +19,7 @@ of DigiPen Institute of Technology is prohibited. // Standard Libraries #include // External Libraries -#include "Tools/SHLog.h" +#include "Tools/Logger/SHLog.h" // Project Headers #include "Convert.hxx" From d3103598f379c6c2fc8b6948ecf7e5cd1d61adac Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Tue, 15 Nov 2022 16:22:16 +0800 Subject: [PATCH 04/14] Removed old SHLog trace methods --- SHADE_Engine/src/Tools/Logger/SHLog.cpp | 7 ------ SHADE_Engine/src/Tools/Logger/SHLogger.cpp | 28 ---------------------- 2 files changed, 35 deletions(-) diff --git a/SHADE_Engine/src/Tools/Logger/SHLog.cpp b/SHADE_Engine/src/Tools/Logger/SHLog.cpp index 30a79338..139a731e 100644 --- a/SHADE_Engine/src/Tools/Logger/SHLog.cpp +++ b/SHADE_Engine/src/Tools/Logger/SHLog.cpp @@ -44,13 +44,6 @@ namespace SHADE SHLOG_FLOOR() } -#ifdef _DEBUG - void SHLog::Trace(const std::string& msg) noexcept - { - SHLOG_TRACE(msg) - } -#endif - void SHLog_Info(const char* msg) noexcept { SHLOG_INFO(msg) diff --git a/SHADE_Engine/src/Tools/Logger/SHLogger.cpp b/SHADE_Engine/src/Tools/Logger/SHLogger.cpp index 9c1e76fc..72791eb1 100644 --- a/SHADE_Engine/src/Tools/Logger/SHLogger.cpp +++ b/SHADE_Engine/src/Tools/Logger/SHLogger.cpp @@ -323,34 +323,6 @@ namespace SHADE SHLOG_FLOOR() } - #ifdef _DEBUG - void SHLogger::LogTrace(const std::string& msg) noexcept - { - SHLOG_TRACE(msg) - } - - void SHLogger::LogVerboseTrace(const std::string& msg, const std::source_location& src) noexcept - { - const bool SHOW_SRC_FILE = configFlags & (1U << 3); - const bool SHOW_SRC_LINE = configFlags & (1U << 4); - - std::stringstream ss; - ss << "["; - if (SHOW_SRC_FILE) - { - ss << std::filesystem::path(src.file_name()).filename().string() << ", "; - if (SHOW_SRC_LINE) - { - ss << src.line() << ", "; - } - } - - ss << src.function_name() << "] " << msg; - - SHLOG_TRACE(ss.str()) - } - #endif - /*-----------------------------------------------------------------------------------*/ /* Private Function Member Definitions */ /*-----------------------------------------------------------------------------------*/ From d3be8127cdd629a883a35c3f3b75143ad12ec8d4 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Tue, 15 Nov 2022 16:22:48 +0800 Subject: [PATCH 05/14] [FIXED] Parenting of entities selected using Shift+Select [FIXED] Component Active Checkbox not working for non reflected components --- .../EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp | 10 +++++++++- .../EditorWindow/Inspector/SHEditorComponentView.hpp | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp index 2a24ad0e..cf545223 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp @@ -345,10 +345,18 @@ namespace SHADE void SHHierarchyPanel::ParentSelectedEntities(EntityID parentEID, std::vector const& entities) const noexcept { auto const& sceneGraph = SHSceneManager::GetCurrentSceneGraph(); + + std::vector entitiesToParent{}; + std::ranges::copy_if(entities, std::back_inserter(entitiesToParent), [&sceneGraph](EntityID const& eid) + { + if (sceneGraph.GetParent(eid)->GetEntityID() == MAX_EID) + return true; + return false; + }); //auto const editor = SHSystemManager::GetSystem(); SHEntityParentCommand::EntityParentData entityParentData; std::vector parentedEIDS; - for (auto const& eid : entities) + for (auto const& eid : entitiesToParent) { if(eid == parentEID) continue; diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index 6091556e..146e36c3 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -68,10 +68,10 @@ namespace SHADE { if (!component) return; + const auto componentType = rttr::type::get(); ImGui::PushID(SHFamilyID::GetID()); SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); - ImGui::PopID(); ImGui::SameLine(); if (ImGui::CollapsingHeader(componentType.get_name().data())) { @@ -216,6 +216,8 @@ namespace SHADE } } else DrawContextMenu(component); + ImGui::PopID(); + } template<> @@ -223,7 +225,8 @@ namespace SHADE { if (!component) return; - ImGui::PushID(component); + ImGui::PushID(SHFamilyID::GetID()); + const auto componentType = rttr::type::get(*component); SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); ImGui::SameLine(); @@ -330,6 +333,7 @@ namespace SHADE { if (!component) return; + ImGui::PushID(SHFamilyID::GetID()); const auto componentType = rttr::type::get(*component); SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); ImGui::SameLine(); @@ -353,6 +357,7 @@ namespace SHADE { DrawContextMenu(component); } + ImGui::PopID(); } template<> @@ -360,6 +365,7 @@ namespace SHADE { if (!component) return; + ImGui::PushID(SHFamilyID::GetID()); const auto componentType = rttr::type::get(*component); SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); ImGui::SameLine(); @@ -397,5 +403,6 @@ namespace SHADE { DrawContextMenu(component); } + ImGui::PopID(); } } From 0e4d97da81adb18d819eadc53403aed751c2a627 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Tue, 15 Nov 2022 16:28:46 +0800 Subject: [PATCH 06/14] tooltip now reflects the correct keys --- .../Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp index efd04162..564731d6 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/ViewportWindow/SHEditorViewport.cpp @@ -151,7 +151,7 @@ namespace SHADE if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::BeginTooltip(); - ImGui::Text("Translate [Q]"); + ImGui::Text("Translate [W]"); ImGui::EndTooltip(); } if (isTranslate) @@ -169,7 +169,7 @@ namespace SHADE if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::BeginTooltip(); - ImGui::Text("Rotate [W]"); + ImGui::Text("Rotate [E]"); ImGui::EndTooltip(); } if (isRotate) @@ -187,7 +187,7 @@ namespace SHADE if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::BeginTooltip(); - ImGui::Text("Scale [E]"); + ImGui::Text("Scale [R]"); ImGui::EndTooltip(); } if (isScale) From 93cded6ed94508d1f02b03c127615c534b6277f3 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Tue, 15 Nov 2022 17:04:52 +0800 Subject: [PATCH 07/14] Added serialization of component isActive --- SHADE_Engine/src/Serialization/SHSerialization.cpp | 4 +++- .../src/Serialization/SHSerializationHelper.hpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/SHADE_Engine/src/Serialization/SHSerialization.cpp b/SHADE_Engine/src/Serialization/SHSerialization.cpp index 8e4e350c..6933fbb5 100644 --- a/SHADE_Engine/src/Serialization/SHSerialization.cpp +++ b/SHADE_Engine/src/Serialization/SHSerialization.cpp @@ -179,7 +179,9 @@ namespace SHADE { if (ComponentType* component = SHComponentManager::GetComponent_s(eid)) { - componentsNode[rttr::type::get().get_name().data()] = YAML::convert::encode(*component); + auto componentNode = YAML::convert::encode(*component); + componentNode[IsActive.data()] = component->isActive; + componentsNode[rttr::type::get().get_name().data()] = componentNode; } } diff --git a/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp b/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp index 84e99345..b560acae 100644 --- a/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp +++ b/SHADE_Engine/src/Serialization/SHSerializationHelper.hpp @@ -14,6 +14,8 @@ namespace SHADE { + static constexpr std::string_view IsActive = "IsActive"; + using AssetQueue = std::unordered_map; struct SHSerializationHelper { @@ -118,9 +120,9 @@ namespace SHADE YAML::Node node{}; if (!component) return node; - auto componentType = rttr::type::get(); node = RTTRToNode(*component); + node[IsActive.data()] = component->isActive; return node; } @@ -198,6 +200,9 @@ namespace SHADE auto componentNode = componentsNode[rttrType.get_name().data()]; if (!componentNode.IsDefined()) return; + if(componentNode[IsActive.data()].IsDefined()) + component->isActive = componentNode[IsActive.data()].as(); + auto properties = rttrType.get_properties(); for (auto const& prop : properties) { @@ -227,8 +232,10 @@ namespace SHADE auto component = SHComponentManager::GetComponent_s(eid); if (componentsNode.IsNull() && !component) return; - - YAML::convert::decode(GetComponentNode(componentsNode, eid), *component); + auto componentNode = GetComponentNode(componentsNode, eid); + if (componentNode[IsActive.data()].IsDefined()) + component->isActive = componentNode[IsActive.data()].as(); + YAML::convert::decode(componentNode, *component); } template , bool> = true> From a752bdb985a76c0a863e7c646fe99ba6560f518d Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Tue, 15 Nov 2022 18:45:58 +0800 Subject: [PATCH 08/14] someone donno how to normalise sia --- SHADE_Managed/src/Math/Vector3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SHADE_Managed/src/Math/Vector3.cxx b/SHADE_Managed/src/Math/Vector3.cxx index f2286aa7..edd78f6b 100644 --- a/SHADE_Managed/src/Math/Vector3.cxx +++ b/SHADE_Managed/src/Math/Vector3.cxx @@ -52,7 +52,7 @@ namespace SHADE Vector3 Vector3::GetNormalised() { - return *this / GetSqrMagnitude(); + return *this / GetMagnitude(); } float Vector3::GetMagnitude() From 37aad4940654b04f2ade8f24afb66d0c42c01ed4 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Tue, 15 Nov 2022 21:09:24 +0800 Subject: [PATCH 09/14] Added requested rigidbody component view with debug information Changed DragVec controls to not push commands if ImGuiSliderFlags_ReadOnly is enabled --- .../Inspector/SHEditorComponentView.hpp | 93 ++++++++++++++++--- SHADE_Engine/src/Editor/SHEditorWidgets.hpp | 6 +- 2 files changed, 85 insertions(+), 14 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index 146e36c3..f8cec296 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -220,6 +220,86 @@ namespace SHADE } + template<> + static void DrawComponent(SHRigidBodyComponent* component) + { + if(!component) + return; + ImGui::PushID(SHFamilyID::GetID()); + + const auto componentType = rttr::type::get(); + SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }, "Is Component Active"); + ImGui::SameLine(); + if (ImGui::CollapsingHeader(componentType.get_name().data())) + { + DrawContextMenu(component); + + SHRigidBodyComponent::Type rbType = component->GetType(); + + auto enumAlign = rttr::type::get().get_enumeration(); + auto names = enumAlign.get_names(); + std::vector list; + for (auto const& name : names) + list.push_back(name.data()); + SHEditorWidgets::ComboBox("Type", list, [component] {return static_cast(component->GetType()); }, [component, enumAlign](int const& idx) + { + auto values = enumAlign.get_values(); + auto it = std::next(values.begin(), idx); + component->SetType((*it).convert()); + }, "RigidBody Type"); + + + if(rbType == SHRigidBodyComponent::Type::DYNAMIC) //Dynamic only fields + { + SHEditorWidgets::DragFloat("Mass", [component] {return component->GetMass(); }, [component](float const& value) {component->SetMass(value); }, "Mass"); + SHEditorWidgets::DragFloat("Drag", [component] {return component->GetDrag(); }, [component](float const& value) {component->SetDrag(value); }, "Drag"); + SHEditorWidgets::DragFloat("Angular Drag", [component] {return component->GetAngularDrag(); }, [component](float const& value) {component->SetAngularDrag(value); }, "Angular Drag"); + SHEditorWidgets::CheckBox("Use Gravity", [component]{return component->IsGravityEnabled();}, [component](bool const& value){component->SetGravityEnabled(value);}, "Gravity"); + } + if (rbType == SHRigidBodyComponent::Type::DYNAMIC || rbType == SHRigidBodyComponent::Type::KINEMATIC) //Dynamic or Kinematic only fields + { + SHEditorWidgets::CheckBox("Interpolate", [component] {return component->IsInterpolating(); }, [component](bool const& value) {component->SetInterpolate(value); }, "Interpolate"); + + SHEditorWidgets::BeginPanel(std::format("{} Constraints", ICON_FA_LOCK).data(), { ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y }); + + SHEditorWidgets::TextLabel("Freeze Position"); + SHEditorWidgets::CheckBox("X", [component] {return component->GetFreezePositionX(); }, [component](bool const& value) {component->SetFreezePositionX(value); }, "Freeze Position - X"); ImGui::SameLine(); + SHEditorWidgets::CheckBox("Y", [component] {return component->GetFreezePositionY(); }, [component](bool const& value) {component->SetFreezePositionY(value); }, "Freeze Position - Y"); ImGui::SameLine(); + SHEditorWidgets::CheckBox("Z", [component] {return component->GetFreezePositionZ(); }, [component](bool const& value) {component->SetFreezePositionZ(value); }, "Freeze Position - Z"); + + SHEditorWidgets::TextLabel("Freeze Rotation"); + SHEditorWidgets::CheckBox("X", [component] {return component->GetFreezeRotationX(); }, [component](bool const& value) {component->SetFreezeRotationX(value); }, "Freeze Rotation - X"); ImGui::SameLine(); + SHEditorWidgets::CheckBox("Y", [component] {return component->GetFreezeRotationY(); }, [component](bool const& value) {component->SetFreezeRotationY(value); }, "Freeze Rotation - Y"); ImGui::SameLine(); + SHEditorWidgets::CheckBox("Z", [component] {return component->GetFreezeRotationZ(); }, [component](bool const& value) {component->SetFreezeRotationZ(value); }, "Freeze Rotation - Z"); + + SHEditorWidgets::EndPanel(); + } + + //Debug Info (Read-Only) + if(ImGui::CollapsingHeader("Debug Information", ImGuiTreeNodeFlags_DefaultOpen))//Dynamic or Kinematic only fields + { + SHEditorWidgets::DragVec3("Position", { "X", "Y", "Z" }, [component] {return component->GetPosition(); }, [](SHVec3 const& value) {}, false, "Position", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + SHEditorWidgets::DragVec3("Rotation", { "X", "Y", "Z" }, [component] {return component->GetRotation(); }, [](SHVec3 const& value) {}, false, "Rotation", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + if (rbType == SHRigidBodyComponent::Type::DYNAMIC || rbType == SHRigidBodyComponent::Type::KINEMATIC) //Dynamic or Kinematic only fields + { + SHEditorWidgets::DragVec3("Velocity", { "X", "Y", "Z" }, [component] {return component->GetLinearVelocity(); }, [](SHVec3 const& value) {}, false, "Linear Velocity", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + SHEditorWidgets::DragVec3("Angular Velocity", { "X", "Y", "Z" }, [component] {return component->GetAngularVelocity(); }, [](SHVec3 const& value) {}, false, "Angular Velocity", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + } + if (rbType == SHRigidBodyComponent::Type::DYNAMIC) //Dynamic only fields + { + SHEditorWidgets::DragVec3("Force", { "X", "Y", "Z" }, [component] {return component->GetForce(); }, [](SHVec3 const& value) {}, false, "Force", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + SHEditorWidgets::DragVec3("Torque", { "X", "Y", "Z" }, [component] {return component->GetTorque(); }, [](SHVec3 const& value) {}, false, "Torque", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + } + } + + } + else + { + DrawContextMenu(component); + } + ImGui::PopID(); + } + template<> static void DrawComponent(SHColliderComponent* component) { @@ -278,21 +358,12 @@ namespace SHADE [&collider] { auto offset = collider->GetRotationOffset(); - offset.x = SHMath::RadiansToDegrees(offset.x); - offset.y = SHMath::RadiansToDegrees(offset.y); - offset.z = SHMath::RadiansToDegrees(offset.z); return offset; }, [&collider](SHVec3 const& vec) { - const SHVec3 vecInRad - { - SHMath::DegreesToRadians(vec.x) - , SHMath::DegreesToRadians(vec.y) - , SHMath::DegreesToRadians(vec.z) - }; - collider->SetRotationOffset(vecInRad); - }); + collider->SetRotationOffset(vec); + }, true); SHEditorWidgets::EndPanel(); } diff --git a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp index 0855d68d..11b35cfc 100644 --- a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp +++ b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp @@ -219,7 +219,7 @@ namespace SHADE } bool const changed = DragN(label, componentLabels, { &values.x, &values.y }, speed, displayFormat, valueMin, valueMax, flags); static bool startRecording = false; - if (changed) + if (!(flags & ImGuiSliderFlags_ReadOnly) && changed) { if(isAnAngleInRad) { @@ -255,7 +255,7 @@ namespace SHADE bool isHovered = false; bool const changed = DragN(label, componentLabels, { &values.x, &values.y, &values.z }, speed, displayFormat, valueMin, valueMax, flags, &isHovered); static bool startRecording = false; - if (changed) + if (!(flags & ImGuiSliderFlags_ReadOnly) && changed) { SHVec3 old = get(); if(isAnAngleInRad) @@ -293,7 +293,7 @@ namespace SHADE } bool const changed = DragN(label, componentLabels, { &values.x, &values.y, &values.z, &values.w }, speed, displayFormat, valueMin, valueMax, flags); static bool startRecording = false; - if (changed) + if (!(flags & ImGuiSliderFlags_ReadOnly) && changed) { if(isAnAngleInRad) { From dc9291bc017f442081194490425edefdd0a4c233 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Wed, 16 Nov 2022 15:00:56 +0800 Subject: [PATCH 10/14] Added Audio class for playing audio from C# --- SHADE_Engine/src/AudioSystem/SHAudioSystem.h | 2 +- SHADE_Managed/premake5.lua | 7 +- SHADE_Managed/src/Audio/Audio.cxx | 101 ++++++++++++++++++ SHADE_Managed/src/Audio/Audio.hxx | 103 +++++++++++++++++++ 4 files changed, 211 insertions(+), 2 deletions(-) create mode 100644 SHADE_Managed/src/Audio/Audio.cxx create mode 100644 SHADE_Managed/src/Audio/Audio.hxx diff --git a/SHADE_Engine/src/AudioSystem/SHAudioSystem.h b/SHADE_Engine/src/AudioSystem/SHAudioSystem.h index f19fcc3b..7196b40d 100644 --- a/SHADE_Engine/src/AudioSystem/SHAudioSystem.h +++ b/SHADE_Engine/src/AudioSystem/SHAudioSystem.h @@ -7,7 +7,7 @@ #include "ECS_Base/System/SHSystem.h" #include "ECS_Base/System/SHSystemRoutine.h" #include "ECS_Base/SHECSMacros.h" -#include "Math/SHMath.h" +#include "Math/Vector/SHVec3.h" #include #include #include "SH_API.h" diff --git a/SHADE_Managed/premake5.lua b/SHADE_Managed/premake5.lua index 64f6e23e..2384cae8 100644 --- a/SHADE_Managed/premake5.lua +++ b/SHADE_Managed/premake5.lua @@ -39,13 +39,15 @@ project "SHADE_Managed" "%{IncludeDir.dotnet}\\include", "%{IncludeDir.reactphysics3d}\\include", "%{IncludeDir.VULKAN}\\include", + "%{IncludeDir.fmod}\\include", "%{wks.location}/SHADE_Engine/src" } libdirs { "%{IncludeDir.RTTR}/lib", - "%{IncludeDir.SDL}/lib" + "%{IncludeDir.SDL}/lib", + "%{IncludeDir.fmod}/lib" } links @@ -93,16 +95,19 @@ project "SHADE_Managed" symbols "On" defines {"_DEBUG"} links{"librttr_core_d.lib"} + links{"fmodstudioL_vc.lib", "fmodL_vc.lib"} filter "configurations:Release" optimize "On" defines{"_RELEASE"} links{"librttr_core.lib"} + links{"fmodstudio_vc.lib", "fmod_vc.lib"} filter "configurations:Publish" optimize "On" defines{"_RELEASE"} links{"librttr_core.lib"} + links{"fmodstudio_vc.lib", "fmod_vc.lib"} require "vstudio" diff --git a/SHADE_Managed/src/Audio/Audio.cxx b/SHADE_Managed/src/Audio/Audio.cxx new file mode 100644 index 00000000..52e29529 --- /dev/null +++ b/SHADE_Managed/src/Audio/Audio.cxx @@ -0,0 +1,101 @@ +/************************************************************************************//*! +\file Audio.cxx +\author Tng Kah Wei, kahwei.tng, 390009620 +\par email: kahwei.tng\@digipen.edu +\date Nov 16, 2022 +\brief Contains the function definitions of the managed Audio static class. + + Note: This file is written in C++17/CLI. + +Copyright (C) 2022 DigiPen Institute of Technology. +Reproduction or disclosure of this file or its contents without the prior written consent +of DigiPen Institute of Technology is prohibited. +*//*************************************************************************************/ +// Precompiled Header +#include "SHpch.h" +// Primary Header +#include "Audio.hxx" +// External Dependencies +#include "AudioSystem/SHAudioSystem.h" +#include "ECS_Base/Managers/SHSystemManager.h" +#include "Utility/Convert.hxx" + +namespace SHADE +{ + /*-----------------------------------------------------------------------------*/ + /* Properties */ + /*-----------------------------------------------------------------------------*/ + float Audio::BGMVolume::get() + { + auto audioSys = SHSystemManager::GetSystem(); + return audioSys->GetBgmVolume(); + } + void Audio::BGMVolume::set(float value) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->SetBgmVolume(System::Math::Clamp(value, 0.0f, 1.0f)); + } + float Audio::SFXVolume::get() + { + auto audioSys = SHSystemManager::GetSystem(); + return audioSys->GetSfxVolume(); + } + void Audio::SFXVolume::set(float value) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->SetSfxVolume(System::Math::Clamp(value, 0.0f, 1.0f)); + } + float Audio::MasterVolume::get() + { + auto audioSys = SHSystemManager::GetSystem(); + return audioSys->GetMasterVolume(); + } + void Audio::MasterVolume::set(float value) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->SetMasterVolume(System::Math::Clamp(value, 0.0f, 1.0f)); + } + bool Audio::IsPaused::get() + { + auto audioSys = SHSystemManager::GetSystem(); + return audioSys->GetPaused(); + } + void Audio::IsPaused::set(bool value) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->SetPaused(value); + } + + /*-----------------------------------------------------------------------------*/ + /* Playback Control Functions */ + /*-----------------------------------------------------------------------------*/ + void Audio::PlaySFXOnce2D(System::String^ path) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->PlayEventOnce(Convert::ToNative(path).data()); + } + + void Audio::PlaySFXOnce3D(System::String^ path, GameObject gameObject) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->PlayEventOnce(Convert::ToNative(path).data(), true, gameObject.GetEntity(), true); + } + + void Audio::PlayBGMOnce2D(System::String^ path) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->PlayEventOnce(Convert::ToNative(path).data(), false); + } + + void Audio::PlayBGMOnce3D(System::String^ path, GameObject gameObject) + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->PlayEventOnce(Convert::ToNative(path).data(), false, gameObject.GetEntity(), true); + } + + void Audio::StopAllSounds() + { + auto audioSys = SHSystemManager::GetSystem(); + audioSys->StopAllSounds(); + } +} diff --git a/SHADE_Managed/src/Audio/Audio.hxx b/SHADE_Managed/src/Audio/Audio.hxx new file mode 100644 index 00000000..d568dc90 --- /dev/null +++ b/SHADE_Managed/src/Audio/Audio.hxx @@ -0,0 +1,103 @@ +/************************************************************************************//*! +\file Audio.hxx +\author Tng Kah Wei, kahwei.tng, 390009620 +\par email: kahwei.tng\@digipen.edu +\date Nov 16, 2022 +\brief Contains the definitions of the managed Audio static class. + + Note: This file is written in C++17/CLI. + +Copyright (C) 2022 DigiPen Institute of Technology. +Reproduction or disclosure of this file or its contents without the prior written consent +of DigiPen Institute of Technology is prohibited. +*//*************************************************************************************/ +#pragma once +#include "Engine/GameObject.hxx" + +namespace SHADE +{ + /// + /// Static class that contains the functions for interfacing with the Audio system. + /// + public ref class Audio abstract sealed + { + public: + /*-----------------------------------------------------------------------------*/ + /* Properties */ + /*-----------------------------------------------------------------------------*/ + /// + /// Volume of background music playback. Clamped between 0.0 and 1.0. + /// + static property float BGMVolume + { + float get(); + void set(float value); + } + /// + /// Volume of sound effects playback. Clamped between 0.0 and 1.0. + /// + static property float SFXVolume + { + float get(); + void set(float value); + } + /// + /// Overall volume for all audio playback. Clamped between 0.0 and 1.0. + /// + static property float MasterVolume + { + float get(); + void set(float value); + } + /// + /// Whether or not all audio playback is paused. + /// + static property bool IsPaused + { + bool get(); + void set(bool value); + } + + /*-----------------------------------------------------------------------------*/ + /* Playback Control Functions */ + /*-----------------------------------------------------------------------------*/ + /// + /// Plays a sound effect without looping without spatial attenuation. + /// + /// + /// Path to the audio file relative to the working directory. + /// + static void PlaySFXOnce2D(System::String^ path); + /// + /// Plays a sound effect without looping with spatial attenuation. + /// + /// + /// Path to the audio file relative to the working directory. + /// + /// + /// Object whose position is used to play the sound effect. + /// + static void PlaySFXOnce3D(System::String^ path, GameObject gameObject); + /// + /// Plays background music without looping without spatial attenuation. + /// + /// + /// Path to the audio file relative to the working directory. + /// + static void PlayBGMOnce2D(System::String^ path); + /// + /// Plays background music without looping with spatial attenuation. + /// + /// + /// Path to the audio file relative to the working directory. + /// + /// + /// Object whose position is used to play the background music. + /// + static void PlayBGMOnce3D(System::String^ path, GameObject gameObject); + /// + /// Stops playback of all sound effects and music. + /// + static void StopAllSounds(); + }; +} From ba39c02f9f9d745dae9b22997308d3616ad0ec20 Mon Sep 17 00:00:00 2001 From: Sri Sham Haran Date: Wed, 16 Nov 2022 15:28:42 +0800 Subject: [PATCH 11/14] Changed formatting slightly for RigidBody component view --- .../EditorWindow/Inspector/SHEditorComponentView.hpp | 9 +++++---- SHADE_Engine/src/Editor/SHEditorWidgets.hpp | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index f8cec296..79891b82 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -251,13 +251,14 @@ namespace SHADE if(rbType == SHRigidBodyComponent::Type::DYNAMIC) //Dynamic only fields { - SHEditorWidgets::DragFloat("Mass", [component] {return component->GetMass(); }, [component](float const& value) {component->SetMass(value); }, "Mass"); - SHEditorWidgets::DragFloat("Drag", [component] {return component->GetDrag(); }, [component](float const& value) {component->SetDrag(value); }, "Drag"); - SHEditorWidgets::DragFloat("Angular Drag", [component] {return component->GetAngularDrag(); }, [component](float const& value) {component->SetAngularDrag(value); }, "Angular Drag"); SHEditorWidgets::CheckBox("Use Gravity", [component]{return component->IsGravityEnabled();}, [component](bool const& value){component->SetGravityEnabled(value);}, "Gravity"); + SHEditorWidgets::DragFloat("Mass", [component] {return component->GetMass(); }, [component](float const& value) {component->SetMass(value); }, "Mass"); } if (rbType == SHRigidBodyComponent::Type::DYNAMIC || rbType == SHRigidBodyComponent::Type::KINEMATIC) //Dynamic or Kinematic only fields { + SHEditorWidgets::DragFloat("Drag", [component] {return component->GetDrag(); }, [component](float const& value) {component->SetDrag(value); }, "Drag"); + SHEditorWidgets::DragFloat("Angular Drag", [component] {return component->GetAngularDrag(); }, [component](float const& value) {component->SetAngularDrag(value); }, "Angular Drag"); + SHEditorWidgets::CheckBox("Interpolate", [component] {return component->IsInterpolating(); }, [component](bool const& value) {component->SetInterpolate(value); }, "Interpolate"); SHEditorWidgets::BeginPanel(std::format("{} Constraints", ICON_FA_LOCK).data(), { ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y }); @@ -283,7 +284,7 @@ namespace SHADE if (rbType == SHRigidBodyComponent::Type::DYNAMIC || rbType == SHRigidBodyComponent::Type::KINEMATIC) //Dynamic or Kinematic only fields { SHEditorWidgets::DragVec3("Velocity", { "X", "Y", "Z" }, [component] {return component->GetLinearVelocity(); }, [](SHVec3 const& value) {}, false, "Linear Velocity", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); - SHEditorWidgets::DragVec3("Angular Velocity", { "X", "Y", "Z" }, [component] {return component->GetAngularVelocity(); }, [](SHVec3 const& value) {}, false, "Angular Velocity", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); + SHEditorWidgets::DragVec3("Angular\nVelocity", { "X", "Y", "Z" }, [component] {return component->GetAngularVelocity(); }, [](SHVec3 const& value) {}, false, "Angular Velocity", 0.1f, "%.3f", 0.0f, 0.0f, ImGuiSliderFlags_ReadOnly); } if (rbType == SHRigidBodyComponent::Type::DYNAMIC) //Dynamic only fields { diff --git a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp index 11b35cfc..bfde7525 100644 --- a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp +++ b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp @@ -166,14 +166,14 @@ namespace SHADE const ImGuiWindow* const window = ImGui::GetCurrentWindow(); if (window->SkipItems) return false; - + static constexpr float defaultLabelColWidth = 80.0f; const ImGuiContext& g = *GImGui; bool valueChanged = false; ImGui::BeginGroup(); ImGui::PushID(label.c_str()); PushMultiItemsWidthsAndLabels(componentLabels, 0.0f); ImGui::BeginColumns("DragVecCol", 2, ImGuiOldColumnFlags_NoBorder | ImGuiOldColumnFlags_NoResize); - ImGui::SetColumnWidth(-1, 80.0f); + ImGui::SetColumnWidth(-1, defaultLabelColWidth); ImGui::Text(label.c_str()); if (isHovered) *isHovered |= ImGui::IsItemHovered(); From 3a6f1f852bac3c58560380d8ec02a9cf391cbd7c Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Wed, 16 Nov 2022 15:29:11 +0800 Subject: [PATCH 12/14] SHMaterialInstance::GetProperty() will now retrieve a property from the base material if it was not overriden --- .../Graphics/MiddleEnd/Interface/SHMaterial.h | 3 ++- .../Interface/SHMaterialInstance.hpp | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterial.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterial.h index 964f9e34..ac793089 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterial.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterial.h @@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited. // Project Includes #include "Resource/SHHandle.h" #include "SHCommonTypes.h" +#include "SH_API.h" namespace SHADE { @@ -35,7 +36,7 @@ namespace SHADE Describes a Pipeline along with it's associated properties for this instance. */ /***********************************************************************************/ - class SHMaterial + class SH_API SHMaterial { public: /*-----------------------------------------------------------------------------*/ diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp index e70631ea..3f7013fe 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp @@ -11,6 +11,7 @@ of DigiPen Institute of Technology is prohibited. *//*************************************************************************************/ #pragma once #include "SHMaterialInstance.h" +#include "SHMaterial.h" namespace SHADE { @@ -70,11 +71,22 @@ namespace SHADE // Search Override Data for the property uint32_t PROP_IDX = SHADER_INFO->GetVariableIndex(key); auto prop = std::find_if(overrideData.begin(), overrideData.end(), [&](const OverrideData& data) - { - return PROP_IDX == data.Index; - }); + { + return PROP_IDX == data.Index; + }); + + // No overrides, we get from the base material instead if (prop == overrideData.end()) - throw std::invalid_argument("Attempted to get an property that was not set previously!"); + { + if (baseMaterial) + { + return baseMaterial->GetProperty(key); + } + else + { + throw std::invalid_argument("Attempted to get an property that was not set previously!"); + } + } // Get offset and return the memory directly T* dataPtr = reinterpret_cast(dataStore.get() + prop->StoredDataOffset); From 3e3a66f2610e2c8c0c3ee321401729b31bb4a0e2 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Wed, 16 Nov 2022 16:32:12 +0800 Subject: [PATCH 13/14] Fixed memory corruption issue caused by SHMaterialInstance::SetMaterial() --- .../MiddleEnd/Interface/SHMaterialInstance.h | 6 +-- .../Interface/SHMaterialInstance.hpp | 41 ++++++++++++------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.h index b6fcc830..1e8136cc 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.h @@ -43,9 +43,9 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ struct OverrideData { - size_t Index; - size_t DataSize; - size_t StoredDataOffset; + uint32_t Index; + uint32_t DataSize; + uint32_t StoredDataOffset; }; /*-----------------------------------------------------------------------------*/ diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp index 3f7013fe..3805cc72 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHMaterialInstance.hpp @@ -35,26 +35,39 @@ namespace SHADE dataStore.reset(new char[dataStoreSize]); } - OverrideData od; - od.Index = SHADER_INFO->GetVariableIndex(key); - od.DataSize = sizeof(T); - if (overrideData.empty()) + // Check if this was stored before + const uint32_t VAR_IDX = SHADER_INFO->GetVariableIndex(key); + auto existingOverride = std::find_if(overrideData.begin(), overrideData.end(), [&](const OverrideData& od) { - od.StoredDataOffset = 0; - } - else + return od.Index == VAR_IDX; + }); + + // Otherwise, create it + if (existingOverride == overrideData.end()) { - const OverrideData& lastInsertedData = overrideData.back(); - od.StoredDataOffset = lastInsertedData.StoredDataOffset + lastInsertedData.DataSize; + OverrideData od; + od.Index = VAR_IDX; + od.DataSize = sizeof(T); + + if (overrideData.empty()) + { + od.StoredDataOffset = 0; + } + else + { + const OverrideData& lastInsertedData = overrideData.back(); + od.StoredDataOffset = lastInsertedData.StoredDataOffset + lastInsertedData.DataSize; + } + + // Save the override data information + overrideData.emplace_back(std::move(od)); + existingOverride = overrideData.end() - 1; } // Get offset and modify the memory directly - T* dataPtr = reinterpret_cast(dataStore.get() + od.StoredDataOffset); + T* dataPtr = reinterpret_cast(dataStore.get() + existingOverride->StoredDataOffset); *dataPtr = value; - - // Save the override data information - overrideData.emplace_back(std::move(od)); - + // Flag dataWasChanged = true; } From acae84d12c2a360d5550fb54df79079fbf173d71 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Wed, 16 Nov 2022 16:38:04 +0800 Subject: [PATCH 14/14] Fixed bug where creation of custom material instance for Renderables are not updated on the GPU --- SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHRenderable.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHRenderable.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHRenderable.cpp index c5511606..c743c019 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHRenderable.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHRenderable.cpp @@ -91,6 +91,7 @@ namespace SHADE { SHGraphicsSystem* gfxSystem = SHSystemManager::GetSystem(); material = gfxSystem->AddMaterialInstanceCopy(sharedMaterial); + matChanged = true; } return material;