Fixed float angle wrapping
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
#include <glm/gtx/common.hpp>
|
||||||
#include "../Core/System.h"
|
#include "../Core/System.h"
|
||||||
#include "../Core/EMousePress.h"
|
#include "../Core/EMousePress.h"
|
||||||
#include "../Rendering/EPicking.h"
|
#include "../Rendering/EPicking.h"
|
||||||
|
|||||||
@@ -141,12 +141,8 @@ void EditorSystem::drawUI(World* world, double dt)
|
|||||||
if (field == "Scale") {
|
if (field == "Scale") {
|
||||||
ImGui::DragFloat3(field.c_str(), glm::value_ptr(val), 0.1f, 0.f, std::numeric_limits<float>::max());
|
ImGui::DragFloat3(field.c_str(), glm::value_ptr(val), 0.1f, 0.f, std::numeric_limits<float>::max());
|
||||||
} else if (field == "Orientation") {
|
} else if (field == "Orientation") {
|
||||||
glm::vec3 times = val / glm::vec3(glm::pi<float>());
|
glm::vec3 tempVal = glm::fmod(val, glm::vec3(glm::two_pi<float>()));
|
||||||
times.x = std::floor(times.x);
|
if (ImGui::SliderFloat3(field.c_str(), glm::value_ptr(tempVal), 0.f, glm::two_pi<float>())) {
|
||||||
times.y = std::floor(times.y);
|
|
||||||
times.z = std::floor(times.z);
|
|
||||||
glm::vec3 tempVal = val - (times*glm::pi<float>());
|
|
||||||
if (ImGui::SliderFloat3(field.c_str(), glm::value_ptr(tempVal), 0.f, glm::pi<float>())) {
|
|
||||||
val = tempVal;
|
val = tempVal;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user