22#include < InspectorViewUIComponent.h>
33#include < UIComponentDrawerHelper.h>
44#include < ZEngine/Core/Coroutine.h>
5+ #include < ZEngine/Core/Maths/Matrix.h>
56#include < ZEngine/Helpers/MeshHelper.h>
67#include < ZEngine/Rendering/Textures/Texture.h>
78
8- #define GLM_ENABLE_EXPERIMENTAL
9- #include < glm/gtx/matrix_decompose.hpp>
10-
119using namespace ZEngine ::Rendering::Textures;
1210using namespace ZEngine ::Helpers;
11+ using namespace ZEngine ::Core::Maths;
1312
1413namespace Tetragrama ::Components
1514{
@@ -56,20 +55,20 @@ namespace Tetragrama::Components
5655 // Helpers::DrawEntityControl("Transform", m_scene_entity, m_node_flag, [this] {
5756 // auto transform = m_scene_entity.GetTransform();
5857
59- // glm::vec3 translation, scale, skew;
60- // glm::qua <float> rot_quat;
61- // glm::vec4 perspective;
62- // glm:: decompose(transform, scale, rot_quat, translation, skew, perspective);
58+ // Vec3f translation, scale, skew;
59+ // Quaternion <float> rot_quat;
60+ // Vec4f perspective;
61+ // decompose(transform, scale, rot_quat, translation, skew, perspective);
6362
6463 // ImGui::Dummy(ImVec2(0, 3));
65- // Helpers::DrawVec3Control("Position", translation, [&translation](glm::vec3 & value) { translation = value; });
64+ // Helpers::DrawVec3Control("Position", translation, [&translation](Vec3f & value) { translation = value; });
6665
67- // glm::vec3 rotation = glm:: eulerAngles(rot_quat);
66+ // Vec3f rotation = eulerAngles(rot_quat);
6867 // ImGui::Dummy(ImVec2(0, 0.5));
69- // Helpers::DrawVec3Control("Rotation", rotation, [&rotation](glm::vec3 & value) { rotation = value; });
68+ // Helpers::DrawVec3Control("Rotation", rotation, [&rotation](Vec3f & value) { rotation = value; });
7069
7170 // ImGui::Dummy(ImVec2(0, 0.5));
72- // Helpers::DrawVec3Control("Scale", scale, [&scale](glm::vec3 & value) { scale = value; }, 1.0f);
71+ // Helpers::DrawVec3Control("Scale", scale, [&scale](Vec3f & value) { scale = value; }, 1.0f);
7372 // });
7473
7574 // Mesh Renderer
@@ -143,24 +142,24 @@ namespace Tetragrama::Components
143142 if (light_type == LightType::DIRECTIONAL)
144143 {
145144 auto light_ptr = reinterpret_cast<DirectionalLight*>(light.get());
146- auto direction = light_ptr->Direction.As<glm::vec3 >();
147- auto ambient = light_ptr->Ambient.As<glm::vec3 >();
148- auto diffuse = light_ptr->Diffuse.As<glm::vec3 >();
149- auto specular = light_ptr->Specular.As<glm::vec3 >();
145+ auto direction = light_ptr->Direction.As<Vec3f >();
146+ auto ambient = light_ptr->Ambient.As<Vec3f >();
147+ auto diffuse = light_ptr->Diffuse.As<Vec3f >();
148+ auto specular = light_ptr->Specular.As<Vec3f >();
150149
151150 ImGui::Dummy(ImVec2(0, 0.5f));
152151 {
153- Helpers::DrawVec3Control("Direction", direction, [light_ptr](glm::vec3 & value) {
154- light_ptr->Direction = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
152+ Helpers::DrawVec3Control("Direction", direction, [light_ptr](Vec3f & value) {
153+ light_ptr->Direction = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
155154
156- Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](glm::vec3 & value) {
157- light_ptr->Ambient = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
155+ Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](Vec3f & value) {
156+ light_ptr->Ambient = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
158157
159- Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](glm::vec3 & value) {
160- light_ptr->Diffuse = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
158+ Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](Vec3f & value) {
159+ light_ptr->Diffuse = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
161160
162- Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](glm::vec3 & value) {
163- light_ptr->Specular = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
161+ Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](Vec3f & value) {
162+ light_ptr->Specular = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
164163 }
165164 }
166165
@@ -169,24 +168,24 @@ namespace Tetragrama::Components
169168 auto transform = m_scene_entity.GetTransform();
170169 auto light_ptr = reinterpret_cast<PointLight*>(light.get());
171170
172- auto position = glm::vec3 (transform[3]);
173- auto ambient = light_ptr->Ambient.As<glm::vec3 >();
174- auto diffuse = light_ptr->Diffuse.As<glm::vec3 >();
175- auto specular = light_ptr->Specular.As<glm::vec3 >();
171+ auto position = Vec3f (transform[3]);
172+ auto ambient = light_ptr->Ambient.As<Vec3f >();
173+ auto diffuse = light_ptr->Diffuse.As<Vec3f >();
174+ auto specular = light_ptr->Specular.As<Vec3f >();
176175
177176 ImGui::Dummy(ImVec2(0, 0.5f));
178177 {
179- Helpers::DrawVec3Control("Position", position, [light_ptr](glm::vec3 & value) { light_ptr->Position =
180- glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
178+ Helpers::DrawVec3Control("Position", position, [light_ptr](Vec3f & value) { light_ptr->Position =
179+ Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
181180
182- Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](glm::vec3 & value) {
183- light_ptr->Ambient = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
181+ Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](Vec3f & value) {
182+ light_ptr->Ambient = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
184183
185- Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](glm::vec3 & value) {
186- light_ptr->Diffuse = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
184+ Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](Vec3f & value) {
185+ light_ptr->Diffuse = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
187186
188- Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](glm::vec3 & value) {
189- light_ptr->Specular = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
187+ Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](Vec3f & value) {
188+ light_ptr->Specular = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
190189
191190 Helpers::DrawDragFloatControl("Constant", light_ptr->Constant, 0.2f, 0.0f, 0.0f, "%.2f",
192191 [light_ptr](float value) { light_ptr->Constant = value; }); ImGui::Dummy(ImVec2(0, 0.5f));
@@ -204,32 +203,32 @@ namespace Tetragrama::Components
204203 auto transform = m_scene_entity.GetTransform();
205204 auto light_ptr = reinterpret_cast<Spotlight*>(light.get());
206205
207- auto direction = light_ptr->Direction.As<glm::vec3 >();
208- auto position = glm::vec3 (transform[3]);
209- auto ambient = light_ptr->Ambient.As<glm::vec3 >();
210- auto diffuse = light_ptr->Diffuse.As<glm::vec3 >();
211- auto specular = light_ptr->Specular.As<glm::vec3 >();
206+ auto direction = light_ptr->Direction.As<Vec3f >();
207+ auto position = Vec3f (transform[3]);
208+ auto ambient = light_ptr->Ambient.As<Vec3f >();
209+ auto diffuse = light_ptr->Diffuse.As<Vec3f >();
210+ auto specular = light_ptr->Specular.As<Vec3f >();
212211 static float phi_angle = 12.5f;
213212
214213 ImGui::Dummy(ImVec2(0, 0.5f));
215214 {
216- Helpers::DrawVec3Control("Position", position, [light_ptr](glm::vec3 & value) { light_ptr->Position =
217- glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
215+ Helpers::DrawVec3Control("Position", position, [light_ptr](Vec3f & value) { light_ptr->Position =
216+ Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
218217
219- Helpers::DrawVec3Control("Direction", direction, [light_ptr](glm::vec3 & value) {
220- light_ptr->Direction = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
218+ Helpers::DrawVec3Control("Direction", direction, [light_ptr](Vec3f & value) {
219+ light_ptr->Direction = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
221220
222- Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](glm::vec3 & value) {
223- light_ptr->Ambient = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
221+ Helpers::DrawColorEdit3Control("Ambient", ambient, [light_ptr](Vec3f & value) {
222+ light_ptr->Ambient = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
224223
225- Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](glm::vec3 & value) {
226- light_ptr->Diffuse = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
224+ Helpers::DrawColorEdit3Control("Diffuse", diffuse, [light_ptr](Vec3f & value) {
225+ light_ptr->Diffuse = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
227226
228- Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](glm::vec3 & value) {
229- light_ptr->Specular = glm::vec4 (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
227+ Helpers::DrawColorEdit3Control("Specular", specular, [light_ptr](Vec3f & value) {
228+ light_ptr->Specular = Vec4f (value, 1.0f); }); ImGui::Dummy(ImVec2(0, 0.5f));
230229
231230 Helpers::DrawDragFloatControl("CutOff", phi_angle, 0.1f, 0.0f, 360.0f, "%.2f", [light_ptr](float
232- value) { phi_angle = value; light_ptr->CutOff = glm:: cos(glm:: radians(value));
231+ value) { phi_angle = value; light_ptr->CutOff = cos(radians(value));
233232 });
234233 ImGui::Dummy(ImVec2(0, 0.5f));
235234
0 commit comments