|
|
|
@ -15,8 +15,9 @@ namespace lunarium
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/// This function was taken from the Hazel engine written by Cherno!
|
|
|
|
/// This function was taken from the Hazel engine written by Cherno!
|
|
|
|
/// https://github.com/TheCherno/Hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp
|
|
|
|
/// https://github.com/TheCherno/Hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp
|
|
|
|
void ImGuiExt::Vec3Control(const std::string& label, glm::vec3& values, float resetValue, float columnWidth)
|
|
|
|
bool ImGuiExt::Vec3Control(const std::string& label, glm::vec3& values, float resetValue, float columnWidth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool values_updated = false;
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(2);
|
|
|
|
ImGui::Columns(2);
|
|
|
|
@ -40,7 +41,7 @@ namespace lunarium
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
values_updated = ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f") | values_updated;
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
|
|
|
|
@ -54,7 +55,7 @@ namespace lunarium
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
values_updated = ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f") | values_updated;
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
|
|
|
|
@ -68,7 +69,7 @@ namespace lunarium
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::DragFloat("##Z", &values.z, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
values_updated = ImGui::DragFloat("##Z", &values.z, 0.1f, 0.0f, 0.0f, "%.2f") | values_updated;
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
@ -76,11 +77,14 @@ namespace lunarium
|
|
|
|
ImGui::Columns(1);
|
|
|
|
ImGui::Columns(1);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopID();
|
|
|
|
ImGui::PopID();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return values_updated;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ImGuiExt::Vec2Control(const std::string& label, glm::vec3& values, float resetValue, float columnWidth)
|
|
|
|
bool ImGuiExt::Vec2Control(const std::string& label, glm::vec3& values, float resetValue, float columnWidth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool values_updated = false;
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(2);
|
|
|
|
ImGui::Columns(2);
|
|
|
|
@ -104,7 +108,7 @@ namespace lunarium
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
values_updated = ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f") | values_updated;
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
|
|
|
|
@ -118,7 +122,7 @@ namespace lunarium
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
values_updated = ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f") | values_updated;
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
@ -126,11 +130,14 @@ namespace lunarium
|
|
|
|
ImGui::Columns(1);
|
|
|
|
ImGui::Columns(1);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopID();
|
|
|
|
ImGui::PopID();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return values_updated;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ImGuiExt::FloatControl(const std::string& label, float& value, float resetValue, float columnWidth)
|
|
|
|
bool ImGuiExt::FloatControl(const std::string& label, float& value, float resetValue, float columnWidth)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool values_updated = false;
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(2);
|
|
|
|
ImGui::Columns(2);
|
|
|
|
@ -154,7 +161,7 @@ namespace lunarium
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::DragFloat("##X", &value, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
values_updated = ImGui::DragFloat("##X", &value, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -163,6 +170,7 @@ namespace lunarium
|
|
|
|
ImGui::Columns(1);
|
|
|
|
ImGui::Columns(1);
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopID();
|
|
|
|
ImGui::PopID();
|
|
|
|
|
|
|
|
return values_updated;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Only works if this is the only item on the line
|
|
|
|
/// Only works if this is the only item on the line
|
|
|
|
|