aboutsummaryrefslogtreecommitdiff
path: root/source/GameObject.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/GameObject.hpp')
-rw-r--r--source/GameObject.hpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/source/GameObject.hpp b/source/GameObject.hpp
index 9567edd..750ae4a 100644
--- a/source/GameObject.hpp
+++ b/source/GameObject.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "EditorCoreAPI.hpp"
#include "GameObjectTypeTag.hpp"
#include "Material.hpp"
#include "Mesh.hpp"
@@ -11,12 +12,13 @@
class GameWorld;
class GameObject {
-private:
- GameWorld* mWorld;
- GameObject* mParent;
+public: // NOTE: public for editors
+ std::unique_ptr<EditorGameObjectAttachment, EditorGameObjectAttachmentDeleter> mEditorAttachment = nullptr;
+ GameWorld* mWorld = nullptr;
+ GameObject* mParent = nullptr;
PodVector<GameObject*> mChildren;
- glm::quat mRot;
- glm::vec3 mPos;
+ glm::quat mRot{};
+ glm::vec3 mPos{};
public:
static void FreeRecursive(GameObject* object);
@@ -25,6 +27,11 @@ public:
explicit GameObject(GameWorld* world);
virtual ~GameObject();
+ GameObject(const GameObject&) = delete;
+ GameObject& operator=(const GameObject&) = delete;
+ GameObject(GameObject&&) = default;
+ GameObject& operator=(GameObject&&) = default;
+
GameWorld* GetWorld() const;
GameObject* GetParent() const;
const PodVector<GameObject*>& GetChildren() const;
@@ -33,13 +40,17 @@ public:
GameObject* RemoveChild(GameObject* child);
PodVector<GameObject*> RemoveAllChildren();
+ EditorGameObjectAttachment* GetEditorAttachment() const { return mEditorAttachment.get(); }
+ void SetEditorAttachment(EditorGameObjectAttachment* attachment) { mEditorAttachment.reset(attachment); }
+
// Tag
- virtual Tags::GameObjectMemoryManagement GetMemoryManagement() const;
+ virtual Tags::GameObjectMemoryManagement
+ GetMemoryManagement() const;
virtual Tags::GameObjectType GetTypeTag() const;
// Visuals
virtual const Material* GetMeshMaterial() const;
- virtual const Mesh* GetMesh() const;
+ virtual const GpuMesh* GetMesh() const;
// Lifetime hooks
virtual void Awaken();