2
3
4
5
10#include "Core/Math/Math.h"
11#include "Core/Input/Input.h"
12#include "Core/Input/KeyCodes.h"
13#include "World/World/World.h"
14#include "World/Entity.h"
15#include "Systems/SlateSystem.h"
17#include <glm/gtc/type_ptr.hpp>
29
30
31 ImGuizmo::SetOrthographic(
false);
34
35
36 ImGuizmo::SetDrawlist();
39
40
42 m_Owner->GetPanelPos().x,
43 m_Owner->GetPanelPos().y,
44 m_Owner->GetPanelSize().x,
45 m_Owner->GetPanelSize().y
50
51
53 glm::mat4 viewMat = glm::mat4(1.0f);
54 glm::mat4 projectionMat = glm::mat4(1.0f);
57
58
63
64
71 viewMat = glm::inverse(transComp.GetModelMatrix());
72 projectionMat = tComp.GetCamera()->GetPMatrix();
83
84
89
90
91 ImGuizmo::ViewManipulate(
92 glm::value_ptr(viewMat),
94 ImVec2(m_Owner->GetPanelPos().x, m_Owner->GetPanelPos().y + m_Owner->GetPanelSize().y - 96),
101
102
114
115
122
123
125 static_cast<entt::entity>(*
m_FrameInfo.m_PickEntityID.end_k()),
130
131
135
136
137 glm::mat4 model = tc.GetModelMatrix();
140
141
143 float snapValue = 0.5f;
145 if (m_GizmoType == ImGuizmo::OPERATION::ROTATE)
150 float snapValues[3] = { snapValue, snapValue ,snapValue };
153
154
158 ImGuizmo::Manipulate(
159 glm::value_ptr(viewMat),
160 glm::value_ptr(projectionMat),
161 (ImGuizmo::OPERATION)m_GizmoType,
163 glm::value_ptr(model),
164 nullptr, snap ? snapValues :
nullptr
169
170
174 if (ImGuizmo::IsUsing())
177
178
179 glm::vec3 translation, rotation, scale;
180 DecomposeTransform(model, translation, rotation, scale);
181 rotation = { glm::degrees(rotation.x), glm::degrees(rotation.y), glm::degrees(rotation.z) };
184 glm::vec3 deltaRotation = rotation - tc.GetRotation();
185 tc.SetPosition(translation);
186 tc.SetRotation(tc.GetRotation() + deltaRotation);
201
202
206
207
219 m_GizmoType = ImGuizmo::OPERATION::UNIVERSAL;
223 m_GizmoType = ImGuizmo::OPERATION::TRANSLATE;
227 m_GizmoType = ImGuizmo::OPERATION::ROTATE;
231 m_GizmoType = ImGuizmo::OPERATION::SCALE;
#define BIND_EVENT_FN(x)
Bind Event.
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
CameraComponent Class. This class defines the specific behaves of CameraComponent.
Entity Class. This class defines the specific behaves of Entity.
EventDispatcher(Event &event)
Constructor Function.
This Class store a Specific Event type first and Dispatch a event handle function to it.
This Class is the basic Event Class. Inherit from it and create specific event class.
static FrameInfo & Get()
Get FrameInfo.
FrameInfo Class. This class defines the FrameInfo data.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
bool OnKeyPressed(KeyPressedEvent &e)
Event Dispatcher target. Registry on Key Resized.
int m_GizmoType
Gizmo Type, Transpose, rotate, scale, universal.
bool bEnableGizmo
Is Enable Gizmo.
The ImguiGizmos Class. This class defines how to render a viewport gizmo.
FrameInfo & m_FrameInfo
The FrameData reference.
const int & GetKeyCode() const
Get Key Input Code.
This Class is inherited from KeyEvent Class.
World Class. This class defines the basic behaves of World. When we create an new world,...