3#include "core/ecs/Component.h"
4#include "common/maths/Vec.h"
5#include "imguizmo/ImGuizmo.h"
7#include "glm/gtc/quaternion.hpp"
26 bool m_FixScale =
false;
27 glm::mat4 m_Transform;
28 ImGuizmo::OPERATION m_CurrentGizmoOperation = ImGuizmo::TRANSLATE;
29 ImGuizmo::MODE m_CurrentGizmoMode = ImGuizmo::LOCAL;
30 bool m_UsingSnap =
false;
31 float m_Snap[3] = { 1.f, 1.f, 1.f };
33 void updateTransformImGUI();
35 void drawGizmo(
Camera* camera);
43 ImGuizmo::RecomposeMatrixFromComponents(&m_Position.x, &m_Rotation.x, &m_Scale.x, &m_Transform[0][0]);
46 : m_Position(position)
47 , m_Rotation(rotation)
50 ImGuizmo::RecomposeMatrixFromComponents(&m_Position.x, &m_Rotation.x, &m_Scale.x, &m_Transform[0][0]);
55 inline Maths::Vec3 GetPosition()
const {
return m_Position; }
56 inline Maths::Vec3 GetRotation()
const {
return m_Rotation; }
57 inline Maths::Vec3 GetScale()
const {
return m_Scale; }
58 inline glm::mat4 GetTransform() {
return m_Transform; }
62 m_Position = position;
63 ImGuizmo::RecomposeMatrixFromComponents(&m_Position.x, &m_Rotation.x, &m_Scale.x, &m_Transform[0][0]);
67 m_Rotation = rotation;
68 ImGuizmo::RecomposeMatrixFromComponents(&m_Position.x, &m_Rotation.x, &m_Scale.x, &m_Transform[0][0]);
73 ImGuizmo::RecomposeMatrixFromComponents(&m_Position.x, &m_Rotation.x, &m_Scale.x, &m_Transform[0][0]);
76 ComponentType GetComponentType()
override {
return ComponentType::TransformComponent; }
78 inline ImGuizmo::OPERATION GetCurrentGizmoOperation()
const {
return m_CurrentGizmoOperation; }
79 inline ImGuizmo::MODE GetCurrentGizmoMode()
const {
return m_CurrentGizmoMode; }
80 inline bool IsUsingSnap()
const {
return m_UsingSnap; }
81 inline float* GetSnap() {
return m_Snap; }
83 void DrawGizmo(
Camera* camera);
84 void Draw(
Camera* camera)
override;
85 void ImGuiRender()
override;
A class that represents the camera.