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