blob: 7c4149e5f868d90b397a4c137e82188341baf937 (
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
|
#pragma once
#include "xe_model.hpp"
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/fwd.hpp>
#include <memory>
namespace xe {
struct TransformComponent {
glm::vec3 translation{};
glm::vec3 scale{1.f, 1.f, 1.f};
glm::vec3 rotation{};
glm::mat4 mat4();
glm::mat3 normalMatrix();
};
class GameObject {
public:
using id_t = unsigned int;
static GameObject createGameObject() {
static id_t currentId = 0;
return GameObject(currentId++);
}
GameObject(const GameObject &) = delete;
GameObject &operator=(const GameObject &) = delete;
GameObject(GameObject&&) = default;
GameObject &operator=(GameObject &&) = default;
id_t getId() { return id; }
std::shared_ptr<Model> model{};
// glm::vec3 color{};
TransformComponent transform;
private:
GameObject(id_t objId) : id{objId} {}
id_t id;
};
}
|