Overte C++ Documentation
GraphicsEngine Class Reference

#include <GraphicsEngine.h>

Collaboration diagram for GraphicsEngine:

Public Member Functions

void initializeGPU (GLWidget *primaryWidget)
 
void initializeGPU (VKWidget *primaryWidget)
 
void initializeRender ()
 
void startup ()
 
void shutdown ()
 
render::ScenePointer getRenderScene () const
 
render::EnginePointer getRenderEngine () const
 
gpu::ContextPointer getGPUContext () const
 
bool shouldPaint () const
 
bool checkPendingRenderEvent ()
 
size_t getRenderFrameCount () const
 
float getRenderLoopRate () const
 
void editRenderArgs (RenderArgsEditor editor)
 

Protected Attributes

QRecursiveMutex _renderArgsMutex
 
AppRenderArgs _appRenderArgs
 
RateCounter< 500 > _renderLoopCounter
 
uint32_t _renderFrameCount { 0 }
 
render::ScenePointer _renderScene { new render::Scene(glm::vec3(-0.5f * (float)TREE_SCALE), (float)TREE_SCALE) }
 
render::EnginePointer _renderEngine { new render::RenderEngine() }
 
gpu::ContextPointer _gpuContext
 
QObject * _renderEventHandler { nullptr }
 
FrameTimingsScriptingInterface _frameTimingsScriptingInterface
 
std::shared_ptr< ProceduralSkybox > _splashScreen { std::make_shared<ProceduralSkybox>() }
 
NetworkTexturePointer _texture
 
std::atomic< bool > _programsCompiled { false }
 

Friends

class RenderEventHandler
 

Detailed Description

Main class for the graphics engine.

Member Function Documentation

◆ checkPendingRenderEvent()

bool GraphicsEngine::checkPendingRenderEvent ( )

Used by Application::onPresent to check if a new Frame object creation event can be posted. Internally it changes state of _pendingRenderingEvent atomic_bool.

Returns
true if previous Frame object creation event has finished and new one can be posted.

◆ editRenderArgs()

void GraphicsEngine::editRenderArgs ( RenderArgsEditor  editor)

Give Graphics Engine new frame configuration.

Parameters
editor

◆ getGPUContext()

gpu::ContextPointer GraphicsEngine::getGPUContext ( ) const
inline
Returns
Shared pointer to the gpu::Context.

◆ getRenderEngine()

render::EnginePointer GraphicsEngine::getRenderEngine ( ) const
inline
Returns
Shared pointer to the RenderEngine.

◆ getRenderFrameCount()

size_t GraphicsEngine::getRenderFrameCount ( ) const
inline
Returns
Number of Frame objects generated this far. Does not have to be equal to number of frames actually rendered.

◆ getRenderLoopRate()

float GraphicsEngine::getRenderLoopRate ( ) const
inline
Returns
Framerate of the "Render" loop. Render loop does not actually render, it only generates frames to be rendered on a separate thread.

◆ getRenderScene()

render::ScenePointer GraphicsEngine::getRenderScene ( ) const
inline
Returns
Shared pointer to the render::Scene.

◆ initializeGPU() [1/2]

void GraphicsEngine::initializeGPU ( GLWidget *  primaryWidget)

Creates render event handler, rendering backend and context. Initializes compiling the basic set of shaders if needed.

Parameters
primaryWidgetWidget containing 3D view on the main window.

◆ initializeGPU() [2/2]

void GraphicsEngine::initializeGPU ( VKWidget *  primaryWidget)

Creates render event handler, rendering backend and context. Initializes compiling the basic set of shaders if needed.

Parameters
primaryWidgetWidget containing 3D view on the main window.

◆ initializeRender()

void GraphicsEngine::initializeRender ( )

Adds renderer jobs, loads renderer configuration from a json file and initializes shape pipelines.

◆ shouldPaint()

bool GraphicsEngine::shouldPaint ( ) const

Same as the one in application. Used by render event handler. Can return false during shutdown, and when framerate is throttled. There's a setting to throttle framerate when out of focus which uses this function.

Returns
true if application should render frame, false if not.

◆ shutdown()

void GraphicsEngine::shutdown ( )

Flushes and processes all transactions, shutdown the gpu::Context and the render engine. Schedules render event handler for deletion. Called on main thread from the Application destructor.

◆ startup()

void GraphicsEngine::startup ( )

Tells render thread to start operation.

Member Data Documentation

◆ _appRenderArgs

AppRenderArgs GraphicsEngine::_appRenderArgs
protected

Frame configuration. Updated from the main thread and used by the "Render" thread, which generates Frame objects but does not render them.

◆ _frameTimingsScriptingInterface

FrameTimingsScriptingInterface GraphicsEngine::_frameTimingsScriptingInterface
protected

Used for "FrameTimings" scripting API.

◆ _gpuContext

gpu::ContextPointer GraphicsEngine::_gpuContext
protected

Object that manages rendering backend and GPU statistics.

◆ _programsCompiled

std::atomic< bool > GraphicsEngine::_programsCompiled { false }
protected

Changes to true when the shaders are loaded and compiled. Used to show the splash screen skybox.

◆ _renderArgsMutex

QRecursiveMutex GraphicsEngine::_renderArgsMutex
mutableprotected

Mutex used to protect frame configuration.

◆ _renderEngine

render::EnginePointer GraphicsEngine::_renderEngine { new render::RenderEngine() }
protected

RenderEngine object contains all the tasks needed to generate a Frame object that can later be submitted to display plugin to be rendered.

◆ _renderEventHandler

QObject* GraphicsEngine::_renderEventHandler { nullptr }
protected

RenderEventHandler responsible for creating Frame objects and submitting them to display plugin, where later they get rendered on Present thread.

◆ _renderFrameCount

uint32_t GraphicsEngine::_renderFrameCount { 0 }
protected

Counts number of frame objects that were created.

◆ _renderLoopCounter

RateCounter<500> GraphicsEngine::_renderLoopCounter
protected

Used for measuring rate at which frame objects are generated.

◆ _renderScene

render::ScenePointer GraphicsEngine::_renderScene { new render::Scene(glm::vec3(-0.5f * (float)TREE_SCALE), (float)TREE_SCALE) }
protected

DOCTODO

◆ _splashScreen

std::shared_ptr<ProceduralSkybox> GraphicsEngine::_splashScreen { std::make_shared<ProceduralSkybox>() }
protected

A simple skybox shown before the shaders are compiled.

◆ _texture

NetworkTexturePointer GraphicsEngine::_texture
protected

Splash screen texture. Shown as a skybox before the shaders load and compile.


The documentation for this class was generated from the following files: