41#include "nlohmann/json.hpp"
42#include "scene/GameObject.h"
91 template<
typename T,
typename =
typename std::enable_if_t<std::is_base_of_v<GameObject, T>>>
99 m_objectsToAdd.push_back({obj, parent});
134 static std::shared_ptr<Scene>
Load(
const str &path);
137 const std::vector<std::unique_ptr<GameObject>> &
GetRootObjects()
const {
return m_objects; }
141 void CollectLightsRecursive(
GameObject *obj, std::vector<LightData> &out);
142 void LoadObject(
const nlohmann::json &jsonObject,
GameObject *parent =
nullptr);
145 std::vector<std::unique_ptr<GameObject>> m_objects;
146 std::vector<std::pair<GameObject *, GameObject *>> m_objectsToAdd;
Engine-wide primitive type aliases and GLM math imports.
Node in the scene graph: a named transform that owns components and children.
Container for the entire game object graph.
void Update(f32 deltaTime)
static std::shared_ptr< Scene > Load(const str &path)
GameObject * CreateObject(const std::string &name, GameObject *parent=nullptr)
Create a plain GameObject owned by this scene.
static void RegisterTypes()
Update all root objects (which recursively update their children).
std::vector< LightData > CollectLight()
Walk the entire object tree and collect all LightData.
void SetMainCamera(GameObject *camera)
Designate the camera object whose CameraComponent drives the view.
GameObject * GetMainCamera()
Returns the current main camera object (set via SetMainCamera).
const std::vector< std::unique_ptr< GameObject > > & GetRootObjects() const
Editor access: iterate root GameObjects (non-owning).
T * CreateObject(const str &name, GameObject *parent=nullptr)
Create a typed GameObject subclass owned by this scene.
bool SetParent(GameObject *obj, GameObject *parent)
Move a GameObject in the hierarchy.
void Clear()
Destroy all objects and reset the scene to an empty state.
std::string str
Convenience alias for std::string.
float f32
32-bit IEEE float — the standard GL scalar type.