14 class ApplicationContext;
62 [[nodiscard]]
const std::vector<Components::Mesh *> &
getGameObjects()
const;
136 template <
typename T>
140 std::vector<T*> outComponents;
141 for (
const auto entity :
activeScene->getEntities()) {
143 if (actor->hasComponent<T>())
145 std::vector<T*> components = actor->getComponents<T>();
146 outComponents.insert(outComponents.end(), components.begin(), components.end());
150 return outComponents;
154 template <
typename T>
A component which can be attached as many times to an actor as one wants. It makes it possible to ren...
The application context is the core class which stores the basic openxr and vulkan objects.
ApplicationContext * context
Entities::Scene * activeScene
void clear()
Clears all game objects and resets the manager state for a new scene.
void destroyMeshletToObjectMapBuffer()
uint32_t getGameObjectCount() const
returns the amount of objects present in the current scene
void unloadScene()
Unloads the current scene.
bool isSceneChangePending() const
Checks if a scene change has been requested.
Components::Mesh * registerGameObject(Components::Mesh *gameObject)
registers a game object to the active scene
Entities::Scene * getActiveScene() const
const Vulkan::Buffer & getMeshletToObjectBuffer() const
std::vector< Entities::Entity * > getAllEntities()
Gets a list of pointers to all entities in the current scene.
void unregisterGameObject(const Components::Mesh *gameObject)
unregisters a game object from the active scene
AssetManager * assetManager_
std::vector< Components::Mesh * > gameObjects
const std::vector< Components::Mesh * > & getGameObjects() const
const Components::Mesh * getGameObject(const scene_object_id id) const
std::function< void()> pendingSceneLoad
void executePendingSceneLoading()
Executes the pending scene load. Should be called between frames.
std::vector< Entities::Actor * > getAllActors()
Gets a list of pointers to all actors in the scene.
void loadSceneContent() const
void loadScene()
Triggers the load of a new scene. Will be executed once the current frame has finished processing.
SceneManager(ApplicationContext *context)
std::vector< uint32_t > gameObjectToMeshletMap
std::vector< T * > getAllComponentsOfClassFromActors()
Gets a list of all components over all actors (EXPENSIVE!)
void setActiveScene(Entities::Scene *scene)
void createMeshletToObjectMapBuffer(ApplicationContext *context)
std::optional< Vulkan::Buffer > meshletToObjectMapBuffer
void uploadGameObjectToMeshletMap()
Uploads the changed data to the buffer on the gpu. Is only one buffer.
void setAssetManager(AssetManager *manager)
Sets the asset manager that will be injected into scenes.
An Actor is similar to an Engine::Entities::Entity. An actor is an Entity with a transform.
A scene is the overarching structure which can spawn, contain and destroy actors or entities.
RAII wrapper for Vulkan buffer and device memory.
Core audio subsystem owning the miniaudio engine and managing playback.