3#include "Engine/Asset/AssetHandles.h"
4#include "Engine/Audio/AudioEngine.h"
5#include "Engine/Files/AssetPath.h"
6#include "Engine/Material/RuntimeMaterialLease.h"
7#include "Engine/Mesh/AssetManager.h"
8#include "Engine/Core/TimerManager.h"
9#include "Engine/Entity/EntityContainer.h"
10#include "Engine/Physics/CollisionProfileRegistry.h"
11#include "Engine/Physics/PhysicsEngine.h"
12#include "Engine/World/WindField.h"
13#include "Engine/World/SceneManager.h"
15#include <Engine/Core/ApplicationContext.h>
16#include <Engine/Input/XrInputHandler.h>
18#include <vulkan/vulkan_core.h>
23#include "Engine/Debug/Debugger.h"
24#include "Engine/Input/InputManager.h"
25#include "Engine/Logging/TracyVkContextManager.h"
98 std::unique_ptr<Assets::Material> material
280 Debug::Tracy::TracyVkContextManager tracyContextManager_;
361 template <
typename T>
Move-only ownership of a material created at runtime.
The application context is the core class which stores the basic openxr and vulkan objects.
Schedules one-shot callbacks against engine time.
Owns the engine runtime and provides access to engine subsystems.
static void processMirrorWindowEvents()
processes glfw window events like key presses or window events
void mainLoop()
Main engine loop where the rendering and game steps happen.
std::atomic< bool > previousFrameXrComplete_
void update(double &gameTime)
Function which causes all objects to tick.
World::WindField windField_
Core::TimerManager * getTimerManager() const
Returns the engine timer manager.
uint32_t getRenderableSceneObjectCount() const
Counts ECS entities with static mesh render data.
void unregisterRuntimeMaterial(Assets::MaterialHandle handle)
Unloads a material previously created with registerRuntimeMaterial().
void initVulkan()
Initialisation of all vulkan related resources.
double getGlobalTimeSeconds() const
Returns engine simulation time in seconds.
void updateAudioListener()
Pushes the headset pose into the audio engine's HRTF listener each frame.
void createTimerManager()
Creates the manager for timing by seconds. It is not time accurate. Is a minimum threshold where we w...
std::unique_ptr< Core::AssetRegistry > assetRegistry_
void createStartupScene() const
Creates the initial scene the engine loads before an actual level is loaded.
World::WindField & getWindField()
Returns mutable wind-field state used by wind-aware components.
std::unique_ptr< Debug::UI::ImGuiManager > imguiManager_
const std::unique_ptr< Core::SceneManager > & getSceneManager() const
Returns the scene manager.
void captureRenderdocFrame()
Captures a frame for render doc if the define RENDERDOC_ENABLED is set.
std::unique_ptr< Core::AudioEngine > audioEngine_
void createPhysicsWorld()
PHYSICS.
Physics::CollisionProfileRegistry * getCollisionProfileRegistry() const
Returns the active collision profile registry.
bool isMirrorViewMinimized() const
Checks the glfw window attributes if the window is minimized.
std::unique_ptr< Rendering::MirrorView > mirrorView_
std::unique_ptr< Rendering::Renderer > renderer_
void createVulkanDebugMessenger()
void run(GameModule &module)
Starts the engine, runs the main loop, then shuts subsystems down.
void loadScene()
Queues a scene change after the current frame completes.
const World::WindField & getWindField() const
Returns read-only wind-field state used by wind-aware components.
void completeFrameAsync(VkFence graphicsFence, bool presentMirror)
Runs on background thread: waits for GPU fence, ends XR frame, presents mirror This allows CPU work t...
Rendering::Headset * getHeadset() const
Returns the active XR headset wrapper.
void tryCreateApplicationContext()
will try to create a window and if there is no openxr runtime detected it will wait 5 seconds and try...
void createAudioEngine()
AUDIO.
void fixLoadingAssets() const
When assets have been requested but are not loaded yet the static mesh data is in a limbo where it ha...
bool isFreezeCulling() const
Returns whether renderer culling updates are frozen.
std::future< void > frameCompletionFuture_
std::unique_ptr< Core::AssetManager > assetManager_
Assets::RuntimeMaterialLease registerRuntimeMaterial(Asset::MeshPath materialPath, std::unique_ptr< Assets::Material > material)
Registers a material created at runtime and not loaded from a static asset file.
static void physicsFrameUpdate()
Steps the physics simulation and synchronizes physics body transforms with the ECS....
std::unique_ptr< Core::ApplicationContext > applicationContext_
std::unique_ptr< Core::SceneManager > sceneManager_
void setFreezeCulling(bool freeze) const
Enables or disables renderer culling freeze for debug inspection.
int forceSyncFramesRemaining_
const Entities::EntityContainer & getPersistentEntities() const
Returns read-only access to entities that persist independently of the active scene.
Entities::EntityContainer persistentEntities_
void loadEngineConfig()
Loads the engine config and checks whether it exists.
std::unique_ptr< Physics::CollisionProfileRegistry > collisionProfileRegistry_
Rendering::Renderer * getRenderer() const
Returns the renderer subsystem.
std::unique_ptr< Input::InputManager > inputManager_
void createInputManager()
Manages all kinds of inputs the engine has. Has subclasses for device specific implementations.
int64_t lastPredictedDisplayTime_
Predicted display time of the previous XR frame, used to derive simulation delta time from the runtim...
Input::XrInputHandler & getXrInputHandler() const
Returns the XR input handler.
void processResourceLoadingPipelines()
Collects and processes the pipelines which have finished and dispatches the new steps....
Input::InputManager * getInputManager() const
Returns the input action manager.
void cleanup()
Cleanup of pointers for vulkan and subsystems.
std::unique_ptr< Core::PhysicsEngine > physicsEngine_
~EngineKern()
Destroys the engine object after run() has completed cleanup.
Input::XrRig & getXrRig() const
Returns resolved XR rig poses.
void calculateFrameTime(double &lastFrameTimeMilliseconds)
Calculates the delta time.
EngineKern()
Creates an uninitialized engine instance.
void destroyAudioEngine()
std::unique_ptr< NamedThreadPool > xrFrameThreadPool_
Entities::EntityContainer & getPersistentEntities()
Returns entities that persist independently of the active scene.
std::unique_ptr< Core::TimerManager > timerManager_
void destroyPhysicsWorld()
std::unique_ptr< Rendering::Headset > headset_
void createAssetManager()
Core::ApplicationContext * getContext() const
Returns the Vulkan application context.
double getDeltaTimeSeconds() const
Returns the duration of the previous frame in seconds.
static EngineManager & getInstance()
Returns the singleton engine manager instance.
virtual ~EngineManager()=default
Destroys the engine manager interface.
Engine::EngineKern * engine_
Active engine instance, or null when none is registered.
EngineKern * getEngineModule()
Returns the active engine.
EngineManager()=default
Creates an empty engine manager.
void setEngine(EngineKern *engineInstance)
Registers the active engine pointer.
EngineManager & operator=(const EngineManager &)=delete
cannot be copy-assigned.
EngineManager(const EngineManager &)=delete
cannot be copied.
Owns entity lifetime and deferred destruction for a scene or subsystem.
Base interface implemented by game-specific engine modules.
Registers collision profile names, enum mappings, and pair responses.
Owns the OpenXR session, XR swapchain, eye transforms, and per-frame XR submission state.
Procedural wind field used by glider flight, particles, and debug rendering.
AssetHandle< MaterialHandleTag > MaterialHandle
Handle to a material payload.
Identifies a named mesh-like asset inside an asset file.