blob: 9567edd78f3addb93ee249adddd41ef9f7b229e8 (
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
|
#pragma once
#include "GameObjectTypeTag.hpp"
#include "Material.hpp"
#include "Mesh.hpp"
#include "PodVector.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <vector>
class GameWorld;
class GameObject {
private:
GameWorld* mWorld;
GameObject* mParent;
PodVector<GameObject*> mChildren;
glm::quat mRot;
glm::vec3 mPos;
public:
static void FreeRecursive(GameObject* object);
// TODO allow moving between worlds
explicit GameObject(GameWorld* world);
virtual ~GameObject();
GameWorld* GetWorld() const;
GameObject* GetParent() const;
const PodVector<GameObject*>& GetChildren() const;
void AddChild(GameObject* child);
GameObject* RemoveChild(int index);
GameObject* RemoveChild(GameObject* child);
PodVector<GameObject*> RemoveAllChildren();
// Tag
virtual Tags::GameObjectMemoryManagement GetMemoryManagement() const;
virtual Tags::GameObjectType GetTypeTag() const;
// Visuals
virtual const Material* GetMeshMaterial() const;
virtual const Mesh* GetMesh() const;
// Lifetime hooks
virtual void Awaken();
virtual void Resleep();
virtual void Update();
protected:
void SetParent(GameObject* parent);
};
|