diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-14 15:12:46 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-14 15:12:46 +0000 |
commit | e4caa1251ae452c380804ce518226abfdf1ede83 (patch) | |
tree | 4e568f0add0e1faec5cf4956281bad104442fcc5 /gfx | |
parent | Remove unused scale component from Transform (diff) | |
download | ilt-e4caa1251ae452c380804ce518226abfdf1ede83.tar.bz2 ilt-e4caa1251ae452c380804ce518226abfdf1ede83.tar.xz ilt-e4caa1251ae452c380804ce518226abfdf1ede83.zip |
Use consts for Transform
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/gl/transform.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gfx/gl/transform.cpp b/gfx/gl/transform.cpp index 8aa118b..c7004ba 100644 --- a/gfx/gl/transform.cpp +++ b/gfx/gl/transform.cpp @@ -1,5 +1,6 @@ #include "transform.h" #include <glm/gtx/transform.hpp> +#include <maths.h> Transform::Transform(glm::vec3 pos, glm::vec3 rot) : pos {pos}, rot {rot} { } @@ -7,9 +8,9 @@ glm::mat4 Transform::GetModel() const { const auto posMat = glm::translate(pos); - const auto rotX = glm::rotate(rot.x, glm::vec3(1.0, 0.0, 0.0)); - const auto rotY = glm::rotate(rot.y, glm::vec3(0.0, 1.0, 0.0)); - const auto rotZ = glm::rotate(rot.z, glm::vec3(0.0, 0.0, 1.0)); + const auto rotX = glm::rotate(rot.x, west); + const auto rotY = glm::rotate(rot.y, up); + const auto rotZ = glm::rotate(rot.z, north); return posMat * rotY * rotX * rotZ; } |