Skip to content
Snippets Groups Projects
Commit f46a60fa authored by aboensch's avatar aboensch
Browse files

FIX: use identity quaternion [0,0,0,1] as default local_rotation

issue #486
parent a2c60a25
Branches
Tags
1 merge request!152Feature/#486 add gcc 7 to ci pipeline
......@@ -163,7 +163,7 @@ Transform& Transform::LookAt(const glm::vec3& target,
}
Transform& Transform::Reset() {
local_translation_ = glm::vec3();
local_rotation_ = glm::quat();
local_rotation_ = glm::quat(1.0f, glm::vec3());
local_scale_ = glm::vec3(1.0f);
local_matrix_ = glm::mat4(1.0f);
return *this;
......
......@@ -35,8 +35,8 @@ SUPPRESS_WARNINGS_BEGIN
SUPPRESS_WARNINGS_END
#include "phx/core/component.hpp"
#include "phx/utility/aspects/hierarchical.hpp"
#include "phx/export.hpp"
#include "phx/utility/aspects/hierarchical.hpp"
namespace phx {
......@@ -99,7 +99,7 @@ class PHOENIX_EXPORT Transform : public Component,
protected:
friend Entity;
Transform(const glm::vec3& translation = glm::vec3(),
const glm::quat& rotation = glm::quat(),
const glm::quat& rotation = glm::quat(1.0f, glm::vec3()),
const glm::vec3& scale = glm::vec3(1.0f));
Transform(const glm::vec3& translation, const glm::vec3& rotation_euler,
const glm::vec3& scale = glm::vec3(1.0f));
......
......@@ -61,12 +61,12 @@ SCENARIO(
WHEN("We query its local rotation.") {
auto rotation = transform->GetLocalRotation();
THEN("It should be equal to the unit quaternion.") {
THEN("It should be equal to the identity quaternion.") {
// REQUIRE(rotation == glm::quat());
REQUIRE(rotation[0] == 0.0f);
REQUIRE(rotation[1] == 0.0f);
REQUIRE(rotation[2] == 0.0f);
REQUIRE(rotation[3] == 0.0f);
REQUIRE(rotation[3] == 1.0f);
}
}
WHEN("We query its local rotation in Euler angles.") {
......@@ -156,12 +156,12 @@ SCENARIO(
}
WHEN("We reset it.") {
transform->Reset();
THEN("The local rotation should be equal to the unity quaternion.") {
THEN("The local rotation should be equal to the identity quaternion.") {
// REQUIRE(transform->GetLocalRotation() == glm::quat());
REQUIRE(transform->GetLocalRotation()[0] == 0.0f);
REQUIRE(transform->GetLocalRotation()[1] == 0.0f);
REQUIRE(transform->GetLocalRotation()[2] == 0.0f);
REQUIRE(transform->GetLocalRotation()[3] == 0.0f);
REQUIRE(transform->GetLocalRotation()[3] == 1.0f);
}
THEN(
"The local transform matrix should be equal to the identity "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment