Set Gizmo Projection type.
Use Window Draw List.
Locating Gizmo.
Instnce empty camera.
Fill in camera.
Iter by view.
Draw Editor ViewManipulate.
Draw Editor Gizmo.
Snapping.
Gozmo Manipulater.
Split Channels from Matrix.
Set Gizmo Projection type.
Use Window Draw List.
Locating Gizmo.
Instnce empty camera.
Fill in camera.
Iter by view.
Draw Editor ViewManipulate.
Draw Editor Gizmo.
Snapping.
Gozmo Manipulater.
Split Channels from Matrix.
22 {
24
25 {
27
31 ImGuizmo::SetOrthographic(false);
32
36 ImGuizmo::SetDrawlist();
37
41 ImGuizmo::SetRect(
46 );
47 }
48
52 Entity CameraEntity;
53 glm::mat4 viewMat = glm::mat4(1.0f);
54 glm::mat4 projectionMat = glm::mat4(1.0f);
55
59 {
61
66
68
69 if (tComp.IsActive())
70 {
71 viewMat = glm::inverse(transComp.GetModelMatrix());
72 projectionMat = tComp.GetCamera()->GetPMatrix();
73
75 return true;
76 }
77
78 return false;
79 });
80 }
81
85 {
87
91 ImGuizmo::ViewManipulate(
92 glm::value_ptr(viewMat),
93 8.0f,
95 ImVec2(96, 96),
96 0x10101010
97 );
98 }
99
103
104
105
106
107
108
109
110
111
112
116 {
118
120 {
124 Entity entity(
127 );
128
132 auto& tc = entity.GetComponent<TransformComponent>();
133
137 glm::mat4 model = tc.GetModelMatrix();
138
143 float snapValue = 0.5f;
144
146 {
147 snapValue = 45.0F;
148 }
149
150 float snapValues[3] = { snapValue, snapValue ,snapValue };
151
155 {
157
158 ImGuizmo::Manipulate(
159 glm::value_ptr(viewMat),
160 glm::value_ptr(projectionMat),
162 ImGuizmo::LOCAL,
163 glm::value_ptr(model),
164 nullptr, snap ? snapValues : nullptr
165 );
166 }
167
171 {
173
174 if (ImGuizmo::IsUsing())
175 {
179 glm::vec3 translation, rotation, scale;
181 rotation = { glm::degrees(rotation.x), glm::degrees(rotation.y), glm::degrees(rotation.z) };
182
183
184 glm::vec3 deltaRotation = rotation - tc.GetRotation();
185 tc.SetPosition(translation);
186 tc.SetRotation(tc.GetRotation() + deltaRotation);
187 tc.SetScale(scale);
188
190 }
191 }
192 }
193 }
194 }
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
static FrameInfo & Get()
Get FrameInfo.
std::shared_ptr< World > m_World
The shared pointer of specific world.
scl::linked_unordered_map< int, std::string > m_PickEntityID
int m_GizmoType
Gizmo Type, Transpose, rotate, scale, universal.
ImguiSlate * m_Owner
The owner, usually is a ImguiViewport class.
bool bEnableGizmo
Is Enable Gizmo.
ImVec2 & GetPanelSize()
Get Panel Size.
FrameInfo & m_FrameInfo
The FrameData reference.
ImVec2 & GetPanelPos()
Get Panel Pos.
size_t size()
The container's element size.
bool DecomposeTransform(const glm::mat4 &transform, glm::vec3 &outTranslation, glm::vec3 &outRotation, glm::vec3 &outScale)
Decompose matrix to split SRT transform.