Fixed float angle wrapping

This commit is contained in:
2015-12-14 15:20:55 +01:00
parent bc6a211276
commit fb2cd0c6ae
2 changed files with 3 additions and 6 deletions
+1
View File
@@ -1,4 +1,5 @@
#include <imgui/imgui.h>
#include <glm/gtx/common.hpp>
#include "../Core/System.h"
#include "../Core/EMousePress.h"
#include "../Rendering/EPicking.h"
+2 -6
View File
@@ -141,12 +141,8 @@ void EditorSystem::drawUI(World* world, double dt)
if (field == "Scale") {
ImGui::DragFloat3(field.c_str(), glm::value_ptr(val), 0.1f, 0.f, std::numeric_limits<float>::max());
} else if (field == "Orientation") {
glm::vec3 times = val / glm::vec3(glm::pi<float>());
times.x = std::floor(times.x);
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>())) {
glm::vec3 tempVal = glm::fmod(val, glm::vec3(glm::two_pi<float>()));
if (ImGui::SliderFloat3(field.c_str(), glm::value_ptr(tempVal), 0.f, glm::two_pi<float>())) {
val = tempVal;
}
} else {