-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhierarchy.hpp
67 lines (49 loc) · 1.45 KB
/
hierarchy.hpp
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
60
61
62
63
64
65
66
#pragma once
#include <vector>
#include <map>
#include "game-object.hpp"
using namespace std;
class Hierarchy {
private:
/**
* Game objects in the hierarchy tree. Key - gameObjectID, value - gameObject
*/
static map<int, GameObject*> gameObjects;
/**
* Root of the hierarchy tree
*/
static GameObject* root;
public:
static void initialize();
public:
/**
* Get game objects in the hierarchy tree
*/
static map<int, GameObject*>* getGameObjects();
// ===
/**
* Creates new game object and adds it to the hierarchy tree
* @return created game object
*/
static GameObject* createGameObjectInTree();
static GameObject* createRoot();
// === Hierarchy tree operations ===
/**
* Adds game object and its children to the hierarchy tree.
*/
static void addToHierarchy(GameObject* gameObject);
static GameObject* getParent(const GameObject* gameObject);
static void setParent(GameObject* child, GameObject* parent);
static void setParent(const vector<GameObject*>& children, GameObject* parent);
static void updateTransformTree();
static void updateTransformTree(GameObject* transform);
private:
/**
* Used in traverse game object's children
*/
static void updateTransform(GameObject* gameObject);
/**
* Used in traverse game object's children
*/
static void addToGameObjects(GameObject* gameObject);
};