normalize axes returned by Mat4.getForward getUp and getRight

This commit is contained in:
Anthony J. Thibault 2019-10-04 14:10:28 -07:00
parent e3f799d039
commit 521f64f152

View file

@ -70,15 +70,16 @@ glm::mat4 Mat4::inverse(const glm::mat4& m) const {
}
glm::vec3 Mat4::getForward(const glm::mat4& m) const {
return -glm::vec3(m[2]);
// -z is forward
return -glm::normalize(glm::vec3(m[2]));
}
glm::vec3 Mat4::getRight(const glm::mat4& m) const {
return glm::vec3(m[0]);
return glm::normalize(glm::vec3(m[0]));
}
glm::vec3 Mat4::getUp(const glm::mat4& m) const {
return glm::vec3(m[1]);
return glm::normalize(glm::vec3(m[1]));
}
void Mat4::print(const QString& label, const glm::mat4& m, bool transpose) const {