summaryrefslogtreecommitdiff
path: root/transform.h
blob: 783ef310c247147349996f18db4c55d4a4344429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef TRANSFORM_INCLUDED_H
#define TRANSFORM_INCLUDED_H

#include <glm/glm.hpp>
#include <utility>

class Camera;

class Transform {
public:
	Transform(glm::vec3 pos = {}, glm::vec3 rot = {}, glm::vec3 scale = {1.0f, 1.0f, 1.0f});

	glm::mat4 GetModel() const;

	glm::mat4 GetMVP(const Camera & camera) const;

	inline glm::vec3 &
	GetPos()
	{
		return pos;
	}

	inline glm::vec3 &
	GetRot()
	{
		return rot;
	}

	inline glm::vec3 &
	GetScale()
	{
		return scale;
	}

	inline void
	SetPos(glm::vec3 && pos)
	{
		this->pos = std::move(pos);
	}

	inline void
	SetRot(glm::vec3 && rot)
	{
		this->rot = std::move(rot);
	}

	inline void
	SetScale(glm::vec3 && scale)
	{
		this->scale = std::move(scale);
	}

private:
	glm::vec3 pos;
	glm::vec3 rot;
	glm::vec3 scale;
};

#endif