mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Removed euler, only quaternion and dirty flag
This commit is contained in:
@@ -10,6 +10,7 @@ public:
|
||||
|
||||
void Draw(Nuake::Entity entity) override
|
||||
{
|
||||
using namespace Nuake;
|
||||
Nuake::TransformComponent& component = entity.GetComponent<Nuake::TransformComponent>();
|
||||
BeginComponentTable(TRANSFORM, Nuake::TransformComponent);
|
||||
{
|
||||
@@ -17,30 +18,63 @@ public:
|
||||
ImGui::Text("Translation");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiHelper::DrawVec3("Translation", &component.Translation);
|
||||
Vector3 position = component.GetLocalPosition();
|
||||
ImGuiHelper::DrawVec3("Translation", &position);
|
||||
if (position != component.GetLocalPosition())
|
||||
component.SetLocalPosition(position);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ComponentTableReset(component.Translation, Nuake::Vector3(0, 0, 0));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
|
||||
std::string resetLabel = std::string(ICON_FA_UNDO) + "##ResetTranslation";
|
||||
if (ImGui::Button(resetLabel.c_str()))
|
||||
component.SetLocalPosition(Vector3(0, 0, 0));
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
ImGui::Text("Rotation");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
//ImGuiHelper::DrawVec3("Rotation", &component.Rotation);
|
||||
Vector3 eulerAngles = glm::eulerAngles(component.GetLocalRotation());
|
||||
ImGuiHelper::DrawVec3("Rotation", &eulerAngles);
|
||||
|
||||
Vector3 eulerLocal = glm::eulerAngles(component.GetLocalRotation());
|
||||
if (eulerLocal != eulerAngles)
|
||||
{
|
||||
Quat rotation = QuatFromEuler(eulerAngles.x, eulerAngles.y, eulerAngles.z);
|
||||
//component.SetLocalRotation(rotation);
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
//ComponentTableReset(component.Rotation, Nuake::Vector3(0, 0, 0));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
|
||||
std::string resetLabel = std::string(ICON_FA_UNDO) + "##ResetRotation";
|
||||
if (ImGui::Button(resetLabel.c_str()))
|
||||
{
|
||||
component.SetLocalRotation(Quat(1, 0, 0, 0));
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
ImGui::Text("Scale");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiHelper::DrawVec3("Scale", &component.Scale);
|
||||
Vector3 localScale = component.GetLocalScale();
|
||||
ImGuiHelper::DrawVec3("Scale", &localScale);
|
||||
|
||||
if (localScale != component.GetLocalScale())
|
||||
component.SetLocalScale(localScale);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ComponentTableReset(component.Scale, Nuake::Vector3(1, 1, 1));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
|
||||
std::string resetLabel = std::string(ICON_FA_UNDO) + "##ResetScale";
|
||||
if (ImGui::Button(resetLabel.c_str()))
|
||||
component.SetLocalScale(Vector3(1, 1, 1));
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
EndComponentTable();
|
||||
|
||||
Reference in New Issue
Block a user