31 struct GltfSpawnPlanData;
40 std::shared_ptr<const GltfSpawnPlanData>
data;
71 template<
typename T,
typename... Args>
73 static_assert(std::is_base_of_v<Entities::Actor, T>,
"T must derive from Actor");
78 throw std::runtime_error(
"Failed to spawn Actor with world node");
80 std::shared_ptr<Entities::SceneNode> node =
sceneGraph->createNode(spawnTransform,
sceneGraph->getRoot(),
false);
82 T* rawPtr =
new T(node,
this, std::forward<Args>(args)...);
85 rawPtr->sceneNode = node;
89 }
catch (
const std::exception &e) {
90 throw std::runtime_error(
"Failed to spawn actor: " + std::string(e.what()));
105 template<
typename ActorT = StaticMeshActor>
108 const std::filesystem::path& gltfPath)
112 std::vector<ActorT*> spawnedActors;
113 spawnedActors.reserve( spawnPlan.
meshNodes.size() );
117 spawnedActors.push_back(actor);
121 return spawnedActors;
#define TRACY_ZONE_SCOPED_NAMED(name)
This is the interface which is used to call a tick function on an object. Everything which should be ...
Manages game objects within a scene, handling registration, ID allocation, and GPU buffer synchroniza...
An Actor is similar to an Engine::Entities::Entity. An actor is an Entity with a transform.
Represents the entire scene as a graph (specifically, a tree) of SceneNode objects....
A scene is the overarching structure which can spawn, contain and destroy actors or entities.
static std::vector< ActorT * > spawnAll(Scene *scene, const std::filesystem::path &gltfPath)
Spawns all meshes from a GLTF file into the scene.
void destroyActor(Entities::Actor *actor)
Core::SceneManager * getSceneManager() const
SceneGraph * getSceneGraph() const
std::vector< Entities::Entity * > getEntities() const
Core::AssetManager * getAssetManager() const
Gets the asset manager for this scene.
virtual void unloadContent()
void reserveActorCapacity(size_t additionalActors)
Reserves storage for a known number of upcoming actor spawns.
std::unique_ptr< SceneGraph > sceneGraph
void setAssetManager(Core::AssetManager *manager)
Sets the asset manager for this scene (used for dependency injection in tests)
virtual void loadContent()
T * spawnActor(const Ecs::Transform &spawnTransform, Args &&... args)
Spawns an actor from a specific class in somewhere into the scene.
std::vector< Entity * > entities
Core::AssetManager * assetManager
EngineKern * getEngine() const
Gets the engine instance for this scene.
Wrapper for entt component creation which ensures types safety and attaches the correct component wit...
Core audio subsystem owning the miniaudio engine and managing playback.
GltfSpawnPlan prepareGltfSpawnPlan(Scene *scene, const std::filesystem::path &gltfPath)
void applyGltfNodeExtensions(Actor *actor, const GltfSpawnPlan &plan, const GltfSpawnNode &spawnNode)
std::shared_ptr< const GltfSpawnPlanData > data
std::vector< GltfSpawnNode > meshNodes