Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Entities::Scene Class Reference

A scene is the overarching structure which can spawn, contain and destroy actors or entities. More...

#include <Scene.h>

Inheritance diagram for Engine::Entities::Scene:
Collaboration diagram for Engine::Entities::Scene:

Public Member Functions

 Scene ()
 ~Scene () override
template<typename T, typename... Args>
T * spawnActor (const Ecs::Transform &spawnTransform, Args &&... args)
 Spawns an actor from a specific class in somewhere into the scene.
void destroyActor (Entities::Actor *actor)
virtual void loadContent ()
virtual void unloadContent ()
std::vector< Entities::Entity * > getEntities () const
void reserveActorCapacity (size_t additionalActors)
 Reserves storage for a known number of upcoming actor spawns.
void cleanup ()
Core::SceneManagergetSceneManager () const
Core::AssetManagergetAssetManager () const
 Gets the asset manager for this scene.
void setAssetManager (Core::AssetManager *manager)
 Sets the asset manager for this scene (used for dependency injection in tests)
EngineKerngetEngine () const
 Gets the engine instance for this scene.
SceneGraphgetSceneGraph () const
Public Member Functions inherited from Engine::Core::ITickable
virtual ~ITickable ()=default
virtual void preTick ()
 Function which executes immediately before the execution of ITickable::preTick()
virtual void tick (double deltaTimeSeconds)
 Function called each frame when a tick component has been registered with EnTT Ecs::Tick.
virtual void postTick ()
 Function which executes immediately after the execution of ITickable::postTick()

Static Public Member Functions

template<typename ActorT = StaticMeshActor>
static std::vector< ActorT * > spawnAll (Scene *scene, const std::filesystem::path &gltfPath)
 Spawns all meshes from a GLTF file into the scene.

Protected Attributes

EngineKernengine_ = nullptr
Core::AssetManagerassetManager = nullptr

Private Attributes

std::unique_ptr< SceneGraphsceneGraph
std::vector< Entity * > entities

Detailed Description

A scene is the overarching structure which can spawn, contain and destroy actors or entities.

Definition at line 56 of file Scene.h.

Constructor & Destructor Documentation

◆ Scene()

Engine::Entities::Scene::Scene ( )

Referenced by spawnAll().

Here is the caller graph for this function:

◆ ~Scene()

Engine::Entities::Scene::~Scene ( )
override

Member Function Documentation

◆ cleanup()

void Engine::Entities::Scene::cleanup ( )

◆ destroyActor()

void Engine::Entities::Scene::destroyActor ( Entities::Actor * actor)

◆ getAssetManager()

Core::AssetManager * Engine::Entities::Scene::getAssetManager ( ) const
nodiscard

Gets the asset manager for this scene.

Returns
Pointer to the AssetManager, or nullptr if not set

◆ getEngine()

EngineKern * Engine::Entities::Scene::getEngine ( ) const
inlinenodiscard

Gets the engine instance for this scene.

Returns
Pointer to the Engine, or nullptr if not set

Definition at line 155 of file Scene.h.

References engine_.

◆ getEntities()

std::vector< Entities::Entity * > Engine::Entities::Scene::getEntities ( ) const
nodiscard

◆ getSceneGraph()

SceneGraph * Engine::Entities::Scene::getSceneGraph ( ) const
inlinenodiscard

Definition at line 156 of file Scene.h.

References sceneGraph.

◆ getSceneManager()

Core::SceneManager * Engine::Entities::Scene::getSceneManager ( ) const
nodiscard

◆ loadContent()

virtual void Engine::Entities::Scene::loadContent ( )
virtual

◆ reserveActorCapacity()

void Engine::Entities::Scene::reserveActorCapacity ( size_t additionalActors)

Reserves storage for a known number of upcoming actor spawns.

◆ setAssetManager()

void Engine::Entities::Scene::setAssetManager ( Core::AssetManager * manager)

Sets the asset manager for this scene (used for dependency injection in tests)

Parameters
managerPointer to the AssetManager

◆ spawnActor()

template<typename T, typename... Args>
T * Engine::Entities::Scene::spawnActor ( const Ecs::Transform & spawnTransform,
Args &&... args )
inline

Spawns an actor from a specific class in somewhere into the scene.

Parameters
spawnTransformwhere the actor should be placed into the world
argsArguments
Returns
The spawned actor in the provided class
Template Parameters
ArgsArguments

Definition at line 72 of file Scene.h.

References entities, sceneGraph, and TRACY_ZONE_SCOPED_NAMED.

Referenced by spawnAll().

Here is the caller graph for this function:

◆ spawnAll()

template<typename ActorT = StaticMeshActor>
std::vector< ActorT * > Engine::Entities::Scene::spawnAll ( Scene * scene,
const std::filesystem::path & gltfPath )
inlinestatic

Spawns all meshes from a GLTF file into the scene.

Each mesh in the GLTF file becomes a separate actor of type ActorT, positioned using the transform from the GLTF file.

Template Parameters
ActorTActor type to spawn (default: StaticMeshActor)
Parameters
sceneThe scene to spawn actors into
gltfPathPath to the GLTF/GLB file
Returns
Vector of spawned actor pointers

Definition at line 106 of file Scene.h.

References Engine::Entities::detail::applyGltfNodeExtensions(), Engine::Entities::detail::GltfSpawnPlan::meshNodes, Engine::Entities::detail::GltfSpawnNode::meshPath, Engine::Entities::detail::prepareGltfSpawnPlan(), Scene(), spawnActor(), and Engine::Entities::detail::GltfSpawnNode::transform.

Referenced by Engine::Entities::GltfSpawner::spawnAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadContent()

virtual void Engine::Entities::Scene::unloadContent ( )
virtual

Member Data Documentation

◆ assetManager

Core::AssetManager* Engine::Entities::Scene::assetManager = nullptr
protected

Definition at line 160 of file Scene.h.

◆ engine_

EngineKern* Engine::Entities::Scene::engine_ = nullptr
protected

Definition at line 159 of file Scene.h.

Referenced by getEngine().

◆ entities

std::vector<Entity*> Engine::Entities::Scene::entities
private

Definition at line 165 of file Scene.h.

Referenced by spawnActor().

◆ sceneGraph

std::unique_ptr<SceneGraph> Engine::Entities::Scene::sceneGraph
private

Definition at line 163 of file Scene.h.

Referenced by getSceneGraph(), and spawnActor().


The documentation for this class was generated from the following file:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Entity/Scene.h