diff options
author | rtk0c <[email protected]> | 2022-04-25 20:22:07 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-04-25 20:22:07 -0700 |
commit | 855da86feae1a5cc14dc2d486ccf115f484dbc2e (patch) | |
tree | 8284c6a6bdfb1a919eb1a22f466f4180a329c7f3 /source/GameObject.hpp | |
parent | d78a55de5003dbb040f1d1c369409e63a2c806d8 (diff) |
Changeset: 16 Initial work on rendering sprites to screen
Diffstat (limited to 'source/GameObject.hpp')
-rw-r--r-- | source/GameObject.hpp | 36 |
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(); |