aboutsummaryrefslogtreecommitdiff
path: root/source/GameObject.hpp
diff options
context:
space:
mode:
authorhnOsmium0001 <[email protected]>2022-04-25 20:22:07 -0700
committerhnOsmium0001 <[email protected]>2022-04-25 20:22:07 -0700
commitf54370de7e4214cb7813d26b1a39a8f6e42b7b56 (patch)
tree20913b4099b77af933fcd2ebb4e73f53b366ad8f /source/GameObject.hpp
parentc8ebee643f23c34ff57f69f8dfcf1903b59ea9d1 (diff)
Initial work on rendering sprites to screen
Diffstat (limited to 'source/GameObject.hpp')
-rw-r--r--source/GameObject.hpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/source/GameObject.hpp b/source/GameObject.hpp
index e1e6dd1..be53ca0 100644
--- a/source/GameObject.hpp
+++ b/source/GameObject.hpp
@@ -1,30 +1,46 @@
#pragma once
#include "EditorAttachment.hpp"
-#include "GameObjectTags.hpp"
#include "Material.hpp"
-#include "Mesh.hpp"
#include "PodVector.hpp"
+#include "Renderer.hpp"
+#include "VertexIndex.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
+#include <span>
#include <vector>
class GameWorld;
class GameObject {
-public: // NOTE: public for editors
+public:
+ enum Kind {
+ KD_Generic,
+ KD_Player,
+ KD_SimpleGeometry,
+ KD_Building,
+ KD_LevelWrapper,
+ KD_COUNT,
+ };
+
+private:
std::unique_ptr<EditorAttachment> mEditorAttachment = nullptr;
GameWorld* mWorld = nullptr;
GameObject* mParent = nullptr;
PodVector<GameObject*> mChildren;
glm::quat mRot{};
glm::vec3 mPos{};
+ Kind mKind;
+
+protected:
+ bool mStopFreePropagation : 1 = true;
public:
static void FreeRecursive(GameObject* object);
// TODO allow moving between worlds
- explicit GameObject(GameWorld* world);
+ GameObject(GameWorld* world);
+ GameObject(Kind kind, GameWorld* world);
virtual ~GameObject();
GameObject(const GameObject&) = delete;
@@ -32,6 +48,10 @@ public:
GameObject(GameObject&&) = default;
GameObject& operator=(GameObject&&) = default;
+ static std::string_view ToString(Kind kind);
+ static Kind FromString(std::string_view name);
+ Kind GetKind() const;
+
GameWorld* GetWorld() const;
GameObject* GetParent() const;
const PodVector<GameObject*>& GetChildren() const;
@@ -49,15 +69,11 @@ public:
const glm::quat& GetRotation() const;
void SetRotation(const glm::quat& rotation);
- // Tag
- virtual Tags::GameObjectMemoryManagement GetMemoryManagement() const;
- virtual Tags::GameObjectType GetTypeTag() const;
-
// Visuals
- virtual const Material* GetMeshMaterial() const;
- virtual const GpuMesh* GetMesh() const;
+ virtual std::span<const RenderObject> GetRenderObjects() const;
// Lifetime hooks
+ virtual void OnInitialized();
virtual void Awaken();
virtual void Resleep();
virtual void Update();