|
Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
|
Owns the engine runtime and provides access to engine subsystems. More...
#include <Engine.h>
Public Member Functions | |
| EngineKern () | |
| Creates an uninitialized engine instance. | |
| ~EngineKern () | |
| Destroys the engine object after run() has completed cleanup. | |
| void | loadEngineConfig () |
| Loads the engine config and checks whether it exists. | |
| void | run (GameModule &module) |
| Starts the engine, runs the main loop, then shuts subsystems down. | |
| 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. | |
| void | unregisterRuntimeMaterial (Assets::MaterialHandle handle) |
| Unloads a material previously created with registerRuntimeMaterial(). | |
| void | setFreezeCulling (bool freeze) const |
| Enables or disables renderer culling freeze for debug inspection. | |
| bool | isFreezeCulling () const |
| Returns whether renderer culling updates are frozen. | |
| double | getDeltaTimeSeconds () const |
| Returns the duration of the previous frame in seconds. | |
| double | getGlobalTimeSeconds () const |
| Returns engine simulation time in seconds. | |
| Core::ApplicationContext * | getContext () const |
| Returns the Vulkan application context. | |
| uint32_t | getRenderableSceneObjectCount () const |
| Counts ECS entities with static mesh render data. | |
| Rendering::Renderer * | getRenderer () const |
| Returns the renderer subsystem. | |
| Input::XrInputHandler & | getXrInputHandler () const |
| Returns the XR input handler. | |
| Input::InputManager * | getInputManager () const |
| Returns the input action manager. | |
| Input::XrRig & | getXrRig () const |
| Returns resolved XR rig poses. | |
| Core::TimerManager * | getTimerManager () const |
| Returns the engine timer manager. | |
| Rendering::Headset * | getHeadset () const |
| Returns the active XR headset wrapper. | |
| World::WindField & | getWindField () |
| Returns mutable wind-field state used by wind-aware components. | |
| const World::WindField & | getWindField () const |
| Returns read-only wind-field state used by wind-aware components. | |
| Entities::EntityContainer & | getPersistentEntities () |
| Returns entities that persist independently of the active scene. | |
| const Entities::EntityContainer & | getPersistentEntities () const |
| Returns read-only access to entities that persist independently of the active scene. | |
| const std::unique_ptr< Core::SceneManager > & | getSceneManager () const |
| Returns the scene manager. | |
| template<typename T> | |
| void | loadScene () |
| Queues a scene change after the current frame completes. | |
| Physics::CollisionProfileRegistry * | getCollisionProfileRegistry () const |
| Returns the active collision profile registry. | |
Private Member Functions | |
| void | createInputManager () |
| Manages all kinds of inputs the engine has. Has subclasses for device specific implementations. | |
| void | createTimerManager () |
| Creates the manager for timing by seconds. It is not time accurate. Is a minimum threshold where we wait for the time which has passed to be greater than x and then execute event. | |
| void | createVulkanDebugMessenger () |
| void | completeFrameAsync (VkFence graphicsFence, bool presentMirror) |
| Runs on background thread: waits for GPU fence, ends XR frame, presents mirror This allows CPU work to overlap with GPU execution of the previous frame. | |
| void | createStartupScene () const |
| Creates the initial scene the engine loads before an actual level is loaded. | |
| void | initVulkan () |
| Initialisation of all vulkan related resources. | |
| void | tryCreateApplicationContext () |
| will try to create a window and if there is no openxr runtime detected it will wait 5 seconds and try to find one again | |
| void | calculateFrameTime (double &lastFrameTimeMilliseconds) |
| Calculates the delta time. | |
| void | fixLoadingAssets () const |
| When assets have been requested but are not loaded yet the static mesh data is in a limbo where it has no asset yet but a path. This function fixes this issue by checking each frame if the asset is loaded already and if it is it sets it. | |
| void | processResourceLoadingPipelines () |
| Collects and processes the pipelines which have finished and dispatches the new steps. Asset loading. | |
| void | update (double &gameTime) |
| Function which causes all objects to tick. | |
| void | updateAudioListener () |
| Pushes the headset pose into the audio engine's HRTF listener each frame. | |
| void | captureRenderdocFrame () |
| Captures a frame for render doc if the define RENDERDOC_ENABLED is set. | |
| bool | isMirrorViewMinimized () const |
| Checks the glfw window attributes if the window is minimized. | |
| void | mainLoop () |
| Main engine loop where the rendering and game steps happen. | |
| void | cleanup () |
| Cleanup of pointers for vulkan and subsystems. | |
| void | initStartupScene () |
| void | createAssetManager () |
| void | createPhysicsWorld () |
| PHYSICS. | |
| void | destroyPhysicsWorld () |
| void | createAudioEngine () |
| AUDIO. | |
| void | destroyAudioEngine () |
Static Private Member Functions | |
| static void | processMirrorWindowEvents () |
| processes glfw window events like key presses or window events | |
| static void | physicsFrameUpdate () |
| Steps the physics simulation and synchronizes physics body transforms with the ECS. Called once per frame from update(). | |
Private Attributes | |
| Debugger | debugger_ |
| double | gameTime_ = 0.0f |
| double | deltaTimeSeconds_ = 0.0 |
| int64_t | lastPredictedDisplayTime_ = 0 |
| Predicted display time of the previous XR frame, used to derive simulation delta time from the runtime's display clock instead of the wall clock. | |
| std::unique_ptr< Core::AssetManager > | assetManager_ = nullptr |
| std::unique_ptr< Core::AssetRegistry > | assetRegistry_ = nullptr |
| GameModule * | module_ = nullptr |
| std::unique_ptr< Input::InputManager > | inputManager_ |
| uint64_t | frameCounter_ = 0 |
| std::unique_ptr< Core::ApplicationContext > | applicationContext_ |
| std::unique_ptr< Rendering::MirrorView > | mirrorView_ |
| std::unique_ptr< Rendering::Headset > | headset_ |
| std::unique_ptr< Rendering::Renderer > | renderer_ |
| std::unique_ptr< Debug::UI::ImGuiManager > | imguiManager_ |
| std::future< void > | frameCompletionFuture_ |
| std::atomic< bool > | previousFrameXrComplete_ {true} |
| int | forceSyncFramesRemaining_ = 0 |
| std::unique_ptr< NamedThreadPool > | xrFrameThreadPool_ |
| std::unique_ptr< Core::TimerManager > | timerManager_ |
| std::unique_ptr< Core::SceneManager > | sceneManager_ = nullptr |
| std::unique_ptr< Core::PhysicsEngine > | physicsEngine_ = nullptr |
| std::unique_ptr< Physics::CollisionProfileRegistry > | collisionProfileRegistry_ = nullptr |
| std::unique_ptr< Core::AudioEngine > | audioEngine_ = nullptr |
| World::WindField | windField_ |
| Entities::EntityContainer | persistentEntities_ |
Owns the engine runtime and provides access to engine subsystems.
Create one instance in the application entry point, register it with Engine::EngineManager, then call Engine::EngineKern::run() with a game module.
| Engine::EngineKern::EngineKern | ( | ) |
Creates an uninitialized engine instance.
| Engine::EngineKern::~EngineKern | ( | ) |
Destroys the engine object after run() has completed cleanup.
|
private |
Calculates the delta time.
| lastFrameTimeMilliseconds | how long did the last frame take to render |
|
private |
Captures a frame for render doc if the define RENDERDOC_ENABLED is set.
|
private |
Cleanup of pointers for vulkan and subsystems.
|
private |
Runs on background thread: waits for GPU fence, ends XR frame, presents mirror This allows CPU work to overlap with GPU execution of the previous frame.
| graphicsFence | The fence to wait on (from the frame that was just submitted) |
| presentMirror | Whether to present the mirror view after xrEndFrame |
|
private |
|
private |
AUDIO.
|
private |
Manages all kinds of inputs the engine has. Has subclasses for device specific implementations.
|
private |
PHYSICS.
|
private |
Creates the initial scene the engine loads before an actual level is loaded.
|
private |
Creates the manager for timing by seconds. It is not time accurate. Is a minimum threshold where we wait for the time which has passed to be greater than x and then execute event.
|
private |
|
private |
|
private |
|
private |
When assets have been requested but are not loaded yet the static mesh data is in a limbo where it has no asset yet but a path. This function fixes this issue by checking each frame if the asset is loaded already and if it is it sets it.
|
inlinenodiscard |
Returns the active collision profile registry.
Definition at line 370 of file Engine.h.
References collisionProfileRegistry_.
|
inlinenodiscard |
Returns the Vulkan application context.
Definition at line 137 of file Engine.h.
References applicationContext_.
|
nodiscard |
Returns the duration of the previous frame in seconds.
|
nodiscard |
Returns engine simulation time in seconds.
|
inlinenodiscard |
|
inlinenodiscard |
Returns the input action manager.
Definition at line 188 of file Engine.h.
References inputManager_.
|
inlinenodiscard |
Returns entities that persist independently of the active scene.
Definition at line 221 of file Engine.h.
References persistentEntities_.
|
inlinenodiscard |
Returns read-only access to entities that persist independently of the active scene.
Definition at line 226 of file Engine.h.
References persistentEntities_.
|
nodiscard |
Counts ECS entities with static mesh render data.
|
nodiscard |
Returns the renderer subsystem.
|
inlinenodiscard |
Returns the scene manager.
Definition at line 294 of file Engine.h.
References sceneManager_.
|
inlinenodiscard |
Returns the engine timer manager.
Definition at line 200 of file Engine.h.
References timerManager_.
|
inlinenodiscard |
Returns mutable wind-field state used by wind-aware components.
Definition at line 211 of file Engine.h.
References windField_.
|
inlinenodiscard |
Returns read-only wind-field state used by wind-aware components.
Definition at line 216 of file Engine.h.
References windField_.
|
inlinenodiscard |
Returns the XR input handler.
Definition at line 182 of file Engine.h.
References inputManager_.
|
inlinenodiscard |
Returns resolved XR rig poses.
Definition at line 194 of file Engine.h.
References inputManager_.
|
private |
|
private |
Initialisation of all vulkan related resources.
|
nodiscard |
Returns whether renderer culling updates are frozen.
|
nodiscardprivate |
Checks the glfw window attributes if the window is minimized.
| void Engine::EngineKern::loadEngineConfig | ( | ) |
Loads the engine config and checks whether it exists.
|
inline |
Queues a scene change after the current frame completes.
| T | Scene type to construct. Must derive from Engine::Entities::Scene. |
Definition at line 362 of file Engine.h.
References sceneManager_.
|
private |
Main engine loop where the rendering and game steps happen.
|
staticprivate |
Steps the physics simulation and synchronizes physics body transforms with the ECS. Called once per frame from update().
|
staticprivate |
processes glfw window events like key presses or window events
|
private |
Collects and processes the pipelines which have finished and dispatches the new steps. Asset loading.
|
nodiscard |
Registers a material created at runtime and not loaded from a static asset file.
| materialPath | Logical material path used as the registry key. |
| material | Material owned by the registry after this call. |
| void Engine::EngineKern::run | ( | GameModule & | module | ) |
Starts the engine, runs the main loop, then shuts subsystems down.
| module | Non-null game module owned by the caller for the duration of the run. |
| void Engine::EngineKern::setFreezeCulling | ( | bool | freeze | ) | const |
Enables or disables renderer culling freeze for debug inspection.
| freeze | True to keep the current culling result, false to resume normal culling updates. |
|
private |
will try to create a window and if there is no openxr runtime detected it will wait 5 seconds and try to find one again
| void Engine::EngineKern::unregisterRuntimeMaterial | ( | Assets::MaterialHandle | handle | ) |
Unloads a material previously created with registerRuntimeMaterial().
| handle | Runtime material handle to unload. |
|
private |
Function which causes all objects to tick.
| gameTime | total time since the start of the game |
|
private |
Pushes the headset pose into the audio engine's HRTF listener each frame.
|
private |
Definition at line 231 of file Engine.h.
Referenced by getContext().
|
private |
|
private |
|
private |
|
private |
Definition at line 381 of file Engine.h.
Referenced by getCollisionProfileRegistry().
|
private |
|
private |
|
private |
Definition at line 233 of file Engine.h.
Referenced by getHeadset().
|
private |
|
private |
Definition at line 154 of file Engine.h.
Referenced by getInputManager(), getXrInputHandler(), and getXrRig().
|
private |
|
private |
|
private |
|
private |
Definition at line 389 of file Engine.h.
Referenced by getPersistentEntities(), and getPersistentEntities().
|
private |
|
private |
|
private |
|
private |
Definition at line 373 of file Engine.h.
Referenced by getSceneManager(), and loadScene().
|
private |
Definition at line 252 of file Engine.h.
Referenced by getTimerManager().
|
private |
Definition at line 388 of file Engine.h.
Referenced by getWindField(), and getWindField().
|
private |