summaryrefslogtreecommitdiff
path: root/gfx/gl/transform.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-01-17 19:36:30 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-01-17 22:16:48 +0000
commit0bf4ad9e4a9e1c97e92aa23a365405dfef89bd7c (patch)
tree68a80976a247836bbb1eecc835af437e3489fbb7 /gfx/gl/transform.h
parentFirst cut modernizing and sanitizing (diff)
downloadilt-0bf4ad9e4a9e1c97e92aa23a365405dfef89bd7c.tar.bz2
ilt-0bf4ad9e4a9e1c97e92aa23a365405dfef89bd7c.tar.xz
ilt-0bf4ad9e4a9e1c97e92aa23a365405dfef89bd7c.zip
Big reshuffle
Fixes code quality warnings now picked up.
Diffstat (limited to 'gfx/gl/transform.h')
-rw-r--r--gfx/gl/transform.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/gfx/gl/transform.h b/gfx/gl/transform.h
new file mode 100644
index 0000000..07040ae
--- /dev/null
+++ b/gfx/gl/transform.h
@@ -0,0 +1,58 @@
+#ifndef TRANSFORM_INCLUDED_H
+#define TRANSFORM_INCLUDED_H
+
+#include <glm/glm.hpp>
+
+class Camera;
+
+class Transform {
+public:
+ explicit Transform(glm::vec3 pos = {}, glm::vec3 rot = {}, glm::vec3 scale = {1.0F, 1.0F, 1.0F});
+
+ [[nodiscard]] glm::mat4 GetModel() const;
+
+ [[nodiscard]] glm::mat4 GetMVP(const Camera & camera) const;
+
+ [[nodiscard]] inline glm::vec3 &
+ GetPos()
+ {
+ return pos;
+ }
+
+ [[nodiscard]] inline glm::vec3 &
+ GetRot()
+ {
+ return rot;
+ }
+
+ [[nodiscard]] inline glm::vec3 &
+ GetScale()
+ {
+ return scale;
+ }
+
+ inline void
+ SetPos(glm::vec3 && pos)
+ {
+ this->pos = pos;
+ }
+
+ inline void
+ SetRot(glm::vec3 && rot)
+ {
+ this->rot = rot;
+ }
+
+ inline void
+ SetScale(glm::vec3 && scale)
+ {
+ this->scale = scale;
+ }
+
+private:
+ glm::vec3 pos;
+ glm::vec3 rot;
+ glm::vec3 scale;
+};
+
+#endif