Elevate Engine 1
Loading...
Searching...
No Matches
Transform.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include <glm/mat4x4.hpp>
6#include <glm/vec3.hpp>
7
10
11namespace Elevate
12{
14 {
15 public:
16 Transform();
17
18 // TODO mettre dans le fichier cpp
19 void SetPosition(glm::vec3 pos) { this->position = pos; m_isDirty = true; }
20 void SetRotation(glm::vec3 rot) { this->rotation = rot; m_isDirty = true; }
21 void SetScale(glm::vec3 scale) { this->scale = scale; m_isDirty = true; }
22
23 glm::vec3& GetPosition() { return position; }
24 const glm::vec3& GetPosition() const { return position; }
25 glm::vec3& GetRotation() { return rotation; }
26 const glm::vec3& GetRotation() const { return rotation; }
27 glm::vec3& GetScale() { return scale; }
28 const glm::vec3& GetScale() const { return scale; }
29
30 glm::vec3 GetRight() const;
31 // TODO GETLEFT (-right)
32 glm::vec3 GetUp() const;
33 // TODO GETDOWN(); (-up)
34 glm::vec3 GetBackward() const;
35 glm::vec3 GetForward() const;
36 glm::vec3 GetGlobalScale() const;
37
38 const glm::mat4& GetModelMatrix() const;
39 void UpdateModelMatrix();
40
42 {
43 return ComponentLayout(
44 "Transform",
45 {
46 {"Positon", ComponentDataType::Float3, &position},
47 {"Rotation", ComponentDataType::Float3, &rotation},
48 {"Scale", ComponentDataType::Float3, &scale}
49 }
50 );
51 }
52 private:
53 bool m_isDirty = true;
54
55 glm::vec3 position;
56 glm::vec3 rotation;
57 glm::vec3 scale;
58
59 glm::mat4 m_ModelMatrix;
60 };
61}
glm::vec3 GetBackward() const
Definition Transform.cpp:26
glm::vec3 & GetPosition()
Definition Transform.h:23
void SetPosition(glm::vec3 pos)
Definition Transform.h:19
const glm::mat4 & GetModelMatrix() const
Definition Transform.cpp:41
glm::vec3 & GetScale()
Definition Transform.h:27
glm::vec3 GetForward() const
Definition Transform.cpp:31
glm::vec3 GetGlobalScale() const
Definition Transform.cpp:36
void SetScale(glm::vec3 scale)
Definition Transform.h:21
glm::vec3 & GetRotation()
Definition Transform.h:25
glm::vec3 GetUp() const
Definition Transform.cpp:21
const glm::vec3 & GetScale() const
Definition Transform.h:28
void SetRotation(glm::vec3 rot)
Definition Transform.h:20
const glm::vec3 & GetPosition() const
Definition Transform.h:24
const glm::vec3 & GetRotation() const
Definition Transform.h:26
glm::vec3 GetRight() const
Definition Transform.cpp:16
ComponentLayout GetLayout() const
Definition Transform.h:41