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

#include <Engine.h>

Collaboration diagram for Engine::EngineKern:

Public Member Functions

 EngineKern ()=default
 ~EngineKern ()
void initRenderDoc ()
 Initialization point for software driven captures.
void run (std::unique_ptr< GameModule > module)
 Runs the engine. Is the entry point for this module.
const std::unique_ptr< Core::AssetManager > & getAssetManager () const
 Getter.
double getDeltaTimeSeconds ()
 gets the time between frames
double getGlobalTimeSeconds ()
 Gets the time since the beginning of the simulation (sum of all delta times)
Core::ApplicationContextgetContext () const
 Gets the application context which stores the vulkan instance the device and queues.
uint32_t getRenderableSceneObjectCount () const
 Counts the amount of entities which have renderable components.
Rendering::RenderergetRenderer () const
 Getter for the renderer.
Input::XrInputHandlergetXrInputHandler () const
 Getter for the XR input handler.
Input::InputManagergetInputManager () const
 Getter for the unified input action manager.
Input::XrRiggetXrRig () const
 Getter for the resolved XR rig poses.
Rendering::HeadsetgetHeadset () const
 Getter for the VR headset.
World::WindFieldgetWindField ()
const World::WindFieldgetWindField () const
void processMirrorWindowEvents ()
 processes glfw window events like key presses or window events
const std::unique_ptr< Core::SceneManager > & getSceneManager () const
template<typename T>
void loadScene ()
 Triggers the load of a new scene. Will be executed once the current frame has finished processing.
Core::PhysicsEnginegetPhysicsEngine () const
 Getter for the pointer to the physics engine.
Core::AudioEnginegetAudioEngine () const
 Getter for the audio engine.

Private Member Functions

void createInputManager ()
void initWindow ()
void createVulkanDebugMessenger ()
void populateDebugMessengerCreateInfo (VkDebugUtilsMessengerCreateInfoEXT &createInfo)
bool checkValidationLayerSupport ()
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 &lastTime)
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)
void captureRenderdocFrame ()
 Captures a frame for render doc if the define RENDERDOC_ENABLED is set.
int isMirrorViewMinimized ()
void mainLoop ()
 Main engine loop where the rendering and game steps happen.
void cleanup ()
 Cleanup of pointers for vulkan and subsystems.
void initializePlogDebugger ()
void initStartupScene ()
void createAssetManager ()
void initAssets ()
void createPhysicsWorld ()
 PHYSICS.
void destroyPhysicsWorld ()
void createAudioEngine ()
 AUDIO.
void destroyAudioEngine ()

Static Private Member Functions

static VkBool32 debugCallback (VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *pUserData)

Private Attributes

double gameTime = 0.0f
double deltaTimeSeconds
std::unique_ptr< Core::AssetManagerassetManager
std::unique_ptr< GameModulemodule
VkDebugUtilsMessengerEXT debugMessenger = nullptr
Input::XrInputHandlerxrInputHandler = nullptr
Input::InputManagerinputManager = nullptr
Input::XrRigxrRig = nullptr
uint64_t frameCounter = 0
bool descriptorDataIsDirty = false
std::vector< VkCommandBuffer > commandBuffers
uint32_t currentFrame = 0
uint32_t textureCount = 0
uint32_t meshCount = 0
bool isXrSessionRunning = false
PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT = nullptr
Core::ApplicationContextapplicationContext = nullptr
Rendering::MirrorView * mirrorView = nullptr
Rendering::Headsetheadset = nullptr
Rendering::Rendererrenderer = nullptr
Debug::UI::ImGuiManager * imguiManager_ = nullptr
std::future< void > frameCompletionFuture_
std::atomic< bool > previousFrameXrComplete_ {true}
int forceSyncFramesRemaining_ = 0
std::unique_ptr< NamedThreadPoolxrFrameThreadPool_
std::unique_ptr< Core::SceneManagersceneManager
Core::PhysicsEnginephysicsEngine = nullptr
Core::AudioEngineaudioEngine_ = nullptr
World::WindField windField_

Detailed Description

Definition at line 38 of file Engine.h.

Constructor & Destructor Documentation

◆ EngineKern()

Engine::EngineKern::EngineKern ( )
default

◆ ~EngineKern()

Engine::EngineKern::~EngineKern ( )

Member Function Documentation

◆ calculateFrameTime()

void Engine::EngineKern::calculateFrameTime ( double & lastTime)
private

◆ captureRenderdocFrame()

void Engine::EngineKern::captureRenderdocFrame ( )
private

Captures a frame for render doc if the define RENDERDOC_ENABLED is set.

◆ checkValidationLayerSupport()

bool Engine::EngineKern::checkValidationLayerSupport ( )
private

◆ cleanup()

void Engine::EngineKern::cleanup ( )
private

Cleanup of pointers for vulkan and subsystems.

◆ completeFrameAsync()

void Engine::EngineKern::completeFrameAsync ( VkFence graphicsFence,
bool presentMirror )
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.

Parameters
graphicsFenceThe fence to wait on (from the frame that was just submitted)
presentMirrorWhether to present the mirror view after xrEndFrame

◆ createAssetManager()

void Engine::EngineKern::createAssetManager ( )
private

◆ createAudioEngine()

void Engine::EngineKern::createAudioEngine ( )
private

AUDIO.

◆ createInputManager()

void Engine::EngineKern::createInputManager ( )
private

◆ createPhysicsWorld()

void Engine::EngineKern::createPhysicsWorld ( )
private

PHYSICS.

◆ createStartupScene()

void Engine::EngineKern::createStartupScene ( ) const
private

Creates the initial scene the engine loads before an actual level is loaded.

◆ createVulkanDebugMessenger()

void Engine::EngineKern::createVulkanDebugMessenger ( )
private

◆ debugCallback()

VkBool32 Engine::EngineKern::debugCallback ( VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT * pCallbackData,
void * pUserData )
staticprivate

◆ destroyAudioEngine()

void Engine::EngineKern::destroyAudioEngine ( )
private

◆ destroyPhysicsWorld()

void Engine::EngineKern::destroyPhysicsWorld ( )
private

◆ fixLoadingAssets()

void Engine::EngineKern::fixLoadingAssets ( ) const
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.

◆ getAssetManager()

const std::unique_ptr< Core::AssetManager > & Engine::EngineKern::getAssetManager ( ) const

Getter.

◆ getAudioEngine()

Core::AudioEngine * Engine::EngineKern::getAudioEngine ( ) const
inlinenodiscard

Getter for the audio engine.

Returns
pointer to the audio engine, or nullptr if not initialized

Definition at line 281 of file Engine.h.

References audioEngine_.

◆ getContext()

Core::ApplicationContext * Engine::EngineKern::getContext ( ) const
inlinenodiscard

Gets the application context which stores the vulkan instance the device and queues.

Returns
the context object

Definition at line 78 of file Engine.h.

References applicationContext.

◆ getDeltaTimeSeconds()

double Engine::EngineKern::getDeltaTimeSeconds ( )

gets the time between frames

Returns
time in seconds

◆ getGlobalTimeSeconds()

double Engine::EngineKern::getGlobalTimeSeconds ( )

Gets the time since the beginning of the simulation (sum of all delta times)

Returns
time since the beginning of simulation

◆ getHeadset()

Rendering::Headset * Engine::EngineKern::getHeadset ( ) const
inlinenodiscard

Getter for the VR headset.

Returns
pointer to the headset

Definition at line 131 of file Engine.h.

References headset.

◆ getInputManager()

Input::InputManager * Engine::EngineKern::getInputManager ( ) const
inlinenodiscard

Getter for the unified input action manager.

Returns
pointer to the input manager

Definition at line 119 of file Engine.h.

References inputManager.

◆ getPhysicsEngine()

Core::PhysicsEngine * Engine::EngineKern::getPhysicsEngine ( ) const
inlinenodiscard

Getter for the pointer to the physics engine.

Returns
pointer to the physics engine

Definition at line 275 of file Engine.h.

References physicsEngine.

◆ getRenderableSceneObjectCount()

uint32_t Engine::EngineKern::getRenderableSceneObjectCount ( ) const
nodiscard

Counts the amount of entities which have renderable components.

Returns
amount of entities which fit the description of a renderable object

◆ getRenderer()

Rendering::Renderer * Engine::EngineKern::getRenderer ( ) const
nodiscard

Getter for the renderer.

Returns
pointer to the renderer

◆ getSceneManager()

const std::unique_ptr< Core::SceneManager > & Engine::EngineKern::getSceneManager ( ) const
inline

Definition at line 223 of file Engine.h.

References sceneManager.

◆ getWindField() [1/2]

World::WindField & Engine::EngineKern::getWindField ( )
inlinenodiscard

Definition at line 133 of file Engine.h.

References windField_.

◆ getWindField() [2/2]

const World::WindField & Engine::EngineKern::getWindField ( ) const
inlinenodiscard

Definition at line 134 of file Engine.h.

References windField_.

◆ getXrInputHandler()

Input::XrInputHandler * Engine::EngineKern::getXrInputHandler ( ) const
inlinenodiscard

Getter for the XR input handler.

Returns
pointer to the XR input handler

Definition at line 113 of file Engine.h.

References xrInputHandler.

◆ getXrRig()

Input::XrRig * Engine::EngineKern::getXrRig ( ) const
inlinenodiscard

Getter for the resolved XR rig poses.

Returns
pointer to the XR rig

Definition at line 125 of file Engine.h.

References xrRig.

◆ initAssets()

void Engine::EngineKern::initAssets ( )
private

◆ initializePlogDebugger()

void Engine::EngineKern::initializePlogDebugger ( )
private

◆ initRenderDoc()

void Engine::EngineKern::initRenderDoc ( )

Initialization point for software driven captures.

◆ initStartupScene()

void Engine::EngineKern::initStartupScene ( )
private

◆ initVulkan()

void Engine::EngineKern::initVulkan ( )
private

Initialisation of all vulkan related resources.

◆ initWindow()

void Engine::EngineKern::initWindow ( )
private

◆ isMirrorViewMinimized()

int Engine::EngineKern::isMirrorViewMinimized ( )
private

◆ loadScene()

template<typename T>
void Engine::EngineKern::loadScene ( )
inline

Triggers the load of a new scene. Will be executed once the current frame has finished processing.

Template Parameters
TType of the scene to load. Has to be child of EngineCore::Scene

Definition at line 267 of file Engine.h.

References sceneManager.

◆ mainLoop()

void Engine::EngineKern::mainLoop ( )
private

Main engine loop where the rendering and game steps happen.

◆ populateDebugMessengerCreateInfo()

void Engine::EngineKern::populateDebugMessengerCreateInfo ( VkDebugUtilsMessengerCreateInfoEXT & createInfo)
private

◆ processMirrorWindowEvents()

void Engine::EngineKern::processMirrorWindowEvents ( )

processes glfw window events like key presses or window events

◆ processResourceLoadingPipelines()

void Engine::EngineKern::processResourceLoadingPipelines ( )
private

Collects and processes the pipelines which have finished and dispatches the new steps. Asset loading.

◆ run()

void Engine::EngineKern::run ( std::unique_ptr< GameModule > module)

Runs the engine. Is the entry point for this module.

References module.

◆ tryCreateApplicationContext()

void Engine::EngineKern::tryCreateApplicationContext ( )
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

◆ update()

void Engine::EngineKern::update ( double & gameTime)
private

References gameTime.

Member Data Documentation

◆ applicationContext

Core::ApplicationContext* Engine::EngineKern::applicationContext = nullptr
private

Definition at line 166 of file Engine.h.

Referenced by getContext().

◆ assetManager

std::unique_ptr<Core::AssetManager> Engine::EngineKern::assetManager
private

Definition at line 83 of file Engine.h.

◆ audioEngine_

Core::AudioEngine* Engine::EngineKern::audioEngine_ = nullptr
private

Definition at line 298 of file Engine.h.

Referenced by getAudioEngine().

◆ commandBuffers

std::vector<VkCommandBuffer> Engine::EngineKern::commandBuffers
private

Definition at line 141 of file Engine.h.

◆ currentFrame

uint32_t Engine::EngineKern::currentFrame = 0
private

Definition at line 144 of file Engine.h.

◆ debugMessenger

VkDebugUtilsMessengerEXT Engine::EngineKern::debugMessenger = nullptr
private

Definition at line 89 of file Engine.h.

◆ deltaTimeSeconds

double Engine::EngineKern::deltaTimeSeconds
private

Definition at line 81 of file Engine.h.

◆ descriptorDataIsDirty

bool Engine::EngineKern::descriptorDataIsDirty = false
private

Definition at line 137 of file Engine.h.

◆ forceSyncFramesRemaining_

int Engine::EngineKern::forceSyncFramesRemaining_ = 0
private

Definition at line 182 of file Engine.h.

◆ frameCompletionFuture_

std::future<void> Engine::EngineKern::frameCompletionFuture_
private

Definition at line 174 of file Engine.h.

◆ frameCounter

uint64_t Engine::EngineKern::frameCounter = 0
private

Definition at line 94 of file Engine.h.

◆ gameTime

double Engine::EngineKern::gameTime = 0.0f
private

Definition at line 59 of file Engine.h.

Referenced by update().

◆ headset

Rendering::Headset* Engine::EngineKern::headset = nullptr
private

Definition at line 168 of file Engine.h.

Referenced by getHeadset().

◆ imguiManager_

Debug::UI::ImGuiManager* Engine::EngineKern::imguiManager_ = nullptr
private

Definition at line 170 of file Engine.h.

◆ inputManager

Input::InputManager* Engine::EngineKern::inputManager = nullptr
private

Definition at line 92 of file Engine.h.

Referenced by getInputManager().

◆ isXrSessionRunning

bool Engine::EngineKern::isXrSessionRunning = false
private

Definition at line 150 of file Engine.h.

◆ meshCount

uint32_t Engine::EngineKern::meshCount = 0
private

Definition at line 147 of file Engine.h.

◆ mirrorView

Rendering::MirrorView* Engine::EngineKern::mirrorView = nullptr
private

Definition at line 167 of file Engine.h.

◆ module

std::unique_ptr<GameModule> Engine::EngineKern::module
private

Definition at line 86 of file Engine.h.

Referenced by run().

◆ physicsEngine

Core::PhysicsEngine* Engine::EngineKern::physicsEngine = nullptr
private

Definition at line 293 of file Engine.h.

Referenced by getPhysicsEngine().

◆ previousFrameXrComplete_

std::atomic<bool> Engine::EngineKern::previousFrameXrComplete_ {true}
private

Definition at line 175 of file Engine.h.

◆ renderer

Rendering::Renderer* Engine::EngineKern::renderer = nullptr
private

Definition at line 169 of file Engine.h.

◆ sceneManager

std::unique_ptr<Core::SceneManager> Engine::EngineKern::sceneManager
private

Definition at line 284 of file Engine.h.

Referenced by getSceneManager(), and loadScene().

◆ textureCount

uint32_t Engine::EngineKern::textureCount = 0
private

Definition at line 146 of file Engine.h.

◆ vkDestroyDebugUtilsMessengerEXT

PFN_vkDestroyDebugUtilsMessengerEXT Engine::EngineKern::vkDestroyDebugUtilsMessengerEXT = nullptr
private

Definition at line 155 of file Engine.h.

◆ windField_

World::WindField Engine::EngineKern::windField_
private

Definition at line 300 of file Engine.h.

Referenced by getWindField(), and getWindField().

◆ xrFrameThreadPool_

std::unique_ptr<NamedThreadPool> Engine::EngineKern::xrFrameThreadPool_
private

Definition at line 185 of file Engine.h.

◆ xrInputHandler

Input::XrInputHandler* Engine::EngineKern::xrInputHandler = nullptr
private

Definition at line 91 of file Engine.h.

Referenced by getXrInputHandler().

◆ xrRig

Input::XrRig* Engine::EngineKern::xrRig = nullptr
private

Definition at line 93 of file Engine.h.

Referenced by getXrRig().


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