diff --git a/Assets/Editor/Layouts/UserLayout.ini b/Assets/Editor/Layouts/UserLayout.ini deleted file mode 100644 index 33b4ccfd..00000000 --- a/Assets/Editor/Layouts/UserLayout.ini +++ /dev/null @@ -1,48 +0,0 @@ -[Window][MainStatusBar] -Pos=0,1389 -Size=2547,20 -Collapsed=0 - -[Window][SHEditorMenuBar] -Pos=0,48 -Size=2547,1341 -Collapsed=0 - -[Window][Hierarchy Panel] -Pos=0,172 -Size=571,1217 -Collapsed=0 -DockId=0x00000004,0 - -[Window][Debug##Default] -Pos=60,60 -Size=400,400 -Collapsed=0 - -[Window][Inspector] -Pos=2276,48 -Size=271,1341 -Collapsed=0 -DockId=0x00000006,0 - -[Window][Profiler] -Pos=0,48 -Size=571,122 -Collapsed=0 -DockId=0x00000003,0 - -[Window][Viewport] -Pos=573,48 -Size=1701,1341 -Collapsed=0 -DockId=0x00000002,0 - -[Docking][Data] -DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=8,79 Size=2547,1341 Split=X - DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1992,1036 Split=X - DockNode ID=0x00000001 Parent=0x00000005 SizeRef=571,1036 Split=Y Selected=0x1E6EB881 - DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,94 Selected=0x1E6EB881 - DockNode ID=0x00000004 Parent=0x00000001 SizeRef=225,940 Selected=0xE096E5AE - DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1074,1036 CentralNode=1 Selected=0x13926F0B - DockNode ID=0x00000006 Parent=0xC5C9B8AB SizeRef=271,1036 Selected=0xE7039252 - diff --git a/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.cpp b/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.cpp index a9276b6d..5c3a0ce0 100644 --- a/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.cpp +++ b/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.cpp @@ -4,6 +4,10 @@ #include "ECS_Base/Managers/SHComponentManager.h" #include "ECS_Base/Managers/SHSystemManager.h" #include "Editor/SHEditor.hpp" +#include +#include + +#include "Camera/SHCameraSystem.h" namespace SHADE { @@ -18,7 +22,21 @@ namespace SHADE selectedEntityTranformComponent = SHComponentManager::GetComponent_s(eid); } + if(!editorCamera) + { + auto const cameraSystem = SHSystemManager::GetSystem(); + editorCamera = cameraSystem->GetEditorCamera(); + } + ImGuizmo::SetOrthographic(false); + SHMatrix view = editorCamera->GetViewMatrix(); + SHMatrix proj = editorCamera->GetProjMatrix(); + SHMatrix mat = selectedEntityTranformComponent->GetTRS(); + ImGuizmo::DrawGrid(view.m[0], proj.m[0], mat.m[0], 10.f); + if(ImGuizmo::Manipulate(view.m[0], proj.m[0], ImGuizmo::OPERATION::UNIVERSAL, ImGuizmo::MODE::WORLD, mat.m[0])) + { + + } } } diff --git a/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.h b/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.h index d034eef9..4ddbeb66 100644 --- a/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.h +++ b/SHADE_Engine/src/Editor/Gizmos/SHTransformGizmo.h @@ -1,4 +1,5 @@ #pragma once +#include "Camera/SHCameraComponent.h" #include "Math/Transform/SHTransformComponent.h" namespace SHADE @@ -9,5 +10,6 @@ namespace SHADE void Draw(); private: SHTransformComponent* selectedEntityTranformComponent{nullptr}; + SHCameraComponent* editorCamera{nullptr}; }; } diff --git a/SHADE_Engine/src/Editor/SHEditor.cpp b/SHADE_Engine/src/Editor/SHEditor.cpp index 6b3c3a93..7399665f 100644 --- a/SHADE_Engine/src/Editor/SHEditor.cpp +++ b/SHADE_Engine/src/Editor/SHEditor.cpp @@ -36,6 +36,7 @@ #include #include #include +#include //#==============================================================# //|| ImGui Backend Includes || @@ -129,6 +130,9 @@ namespace SHADE if(window->isOpen) window->Update(); } + + ImGuizmo::SetDrawlist(ImGui::GetForegroundDrawList()); + transformGizmo.Draw(); if(ImGui::IsKeyDown(ImGuiKey_LeftShift) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_Z)) { @@ -366,6 +370,7 @@ namespace SHADE ImGui_ImplVulkan_NewFrame(); ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); + ImGuizmo::BeginFrame(); } diff --git a/SHADE_Engine/src/Editor/SHEditor.hpp b/SHADE_Engine/src/Editor/SHEditor.hpp index baa6324e..4f8b32e2 100644 --- a/SHADE_Engine/src/Editor/SHEditor.hpp +++ b/SHADE_Engine/src/Editor/SHEditor.hpp @@ -16,6 +16,8 @@ #include "Resource/Handle.h" #include "EditorWindow/SHEditorWindow.h" #include "Tools/SHLogger.h" +#include "Gizmos/SHTransformGizmo.h" + //#==============================================================# //|| Library Includes || @@ -200,5 +202,7 @@ namespace SHADE SDL_Window* sdlWindow {nullptr}; ImGuiIO* io{nullptr}; + + SHTransformGizmo transformGizmo; };//class SHEditor }//namespace SHADE