NDEVR
API Documentation

An object that renders a specific Camera object, typically run on a different thread than the main UI thread. More...

Public Member Functions

 Renderer (const DynamicPointer< GraphicsPipeline > &pipeline, const ConstPointer< Camera > &camera, WindowInstance *instance, LogPtr log)
 Constructs a renderer for a given pipeline, camera, and window.
virtual ~Renderer ()
 Destructor.
void cleanup ()
 Cleans up all GPU resources.
const DynamicPointer< GraphicsDevice > & device () const
 Returns the graphics device.
void ensureLastRenderComplete ()
 Blocks until the last submitted render is complete.
GraphicsUpdateArgumentsgetArguments ()
 Returns the render arguments.
fltp08 getFPS () const
 Returns the target frames per second.
Time getFrameStartTime () const
 Returns the start time of the current frame.
void grabImage (Image *image)
 Grabs the current frame into an image immediately.
void grabImageNextRender (Image *image)
 Queues an image grab for the next render.
void init (DesignObjectLookup *lookup)
 Initializes the renderer with a design object lookup.
bool isActive ()
 Checks whether this renderer is active.
LogPtr log ()
 Returns the log pointer.
uint04 multisample () const
 Returns the current multisample count.
void pause (TimeSpan span)
 Pauses rendering for a duration.
DynamicPointer< GraphicsPipelinepipeline () const
 Returns the graphics pipeline.
void render (bool wait_until_needed, bool force_render=true)
 Renders a single frame.
void renderLoop ()
 Enters the continuous render loop.
void requestRedraw ()
 Requests a redraw on the next update cycle.
void run ()
 Starts the render thread.
void setActive (bool is_active)
 Sets whether this renderer is active.
virtual void setCamera (const ConstPointer< Camera > &camera)
 Sets the camera to render from.
void setFPS (fltp08 fps)
 Sets the target frames per second.
void setOverrideMaterial (UUID material)
 Sets a material override for all rendered objects.
void setPostRenderFunction (const std::function< void()> &function)
 Sets a function called after each render completes.
void setupSurface ()
 Creates the rendering surface for the window.
void setWindowInstance (WindowInstance *window)
 Sets the window instance for this renderer.
void update ()
 Performs a single update cycle.
void updateArgs (bool force_render)
 Updates the render arguments from current state.
void updatePipeline ()
 Recreates and updates the rendering pipeline.
GraphicsUpdaterupdater () const
 Returns the associated graphics updater.

Detailed Description

An object that renders a specific Camera object, typically run on a different thread than the main UI thread.


Rendering takes place between calls to the GraphicsUpdater. If there is more than one QTGraphicsWindow, there may be more than one Renderer running at a time.

Definition at line 52 of file Renderer.h.

Constructor & Destructor Documentation

◆ Renderer()

Renderer::Renderer ( const DynamicPointer< GraphicsPipeline > & pipeline,
const ConstPointer< Camera > & camera,
WindowInstance * instance,
LogPtr log )

Constructs a renderer for a given pipeline, camera, and window.

Parameters
[in]pipelineThe graphics pipeline.
[in]cameraThe camera to render from.
[in]instanceThe window instance.
[in]logThe log.

References log(), and pipeline().

Member Function Documentation

◆ device()

const DynamicPointer< GraphicsDevice > & Renderer::device ( ) const

Returns the graphics device.

Returns
Reference to the device pointer.

◆ getArguments()

GraphicsUpdateArguments & Renderer::getArguments ( )
inline

Returns the render arguments.

Returns
Reference to the arguments.

Definition at line 111 of file Renderer.h.

◆ getFPS()

fltp08 Renderer::getFPS ( ) const
inline

Returns the target frames per second.

Returns
The FPS.

Definition at line 77 of file Renderer.h.

◆ getFrameStartTime()

Time Renderer::getFrameStartTime ( ) const
inline

Returns the start time of the current frame.

Returns
The frame start time.

Definition at line 87 of file Renderer.h.

◆ grabImage()

void Renderer::grabImage ( Image * image)

Grabs the current frame into an image immediately.

Parameters
[in]imageThe image to fill.

◆ grabImageNextRender()

void Renderer::grabImageNextRender ( Image * image)

Queues an image grab for the next render.

Parameters
[in]imageThe image to fill after rendering.

◆ init()

void Renderer::init ( DesignObjectLookup * lookup)

Initializes the renderer with a design object lookup.

Parameters
[in]lookupThe design object lookup.

◆ isActive()

bool Renderer::isActive ( )
inline

Checks whether this renderer is active.

Returns
True if active.

Definition at line 151 of file Renderer.h.

◆ log()

LogPtr Renderer::log ( )
inline

Returns the log pointer.

Returns
The log.

Definition at line 100 of file Renderer.h.

Referenced by Renderer().

◆ multisample()

uint04 Renderer::multisample ( ) const

Returns the current multisample count.

Returns
The multisample count.

◆ pause()

void Renderer::pause ( TimeSpan span)

Pauses rendering for a duration.

Parameters
[in]spanThe pause duration.

◆ pipeline()

DynamicPointer< GraphicsPipeline > Renderer::pipeline ( ) const
inline

Returns the graphics pipeline.

Returns
The pipeline pointer.

Definition at line 136 of file Renderer.h.

Referenced by Renderer().

◆ render()

void Renderer::render ( bool wait_until_needed,
bool force_render = true )

Renders a single frame.

Parameters
[in]wait_until_neededWhether to wait for a render request.
[in]force_renderWhether to force rendering even if not needed.

◆ setActive()

void Renderer::setActive ( bool is_active)

Sets whether this renderer is active.

Parameters
[in]is_activeWhether the renderer is active.

◆ setCamera()

virtual void Renderer::setCamera ( const ConstPointer< Camera > & camera)
virtual

Sets the camera to render from.

Parameters
[in]cameraThe camera pointer.

◆ setFPS()

void Renderer::setFPS ( fltp08 fps)
inline

Sets the target frames per second.

Parameters
[in]fpsThe target FPS.

Definition at line 74 of file Renderer.h.

◆ setOverrideMaterial()

void Renderer::setOverrideMaterial ( UUID material)

Sets a material override for all rendered objects.

Parameters
[in]materialThe override material UUID.

◆ setPostRenderFunction()

void Renderer::setPostRenderFunction ( const std::function< void()> & function)
inline

Sets a function called after each render completes.

Parameters
[in]functionThe post-render callback.

Definition at line 120 of file Renderer.h.

◆ setWindowInstance()

void Renderer::setWindowInstance ( WindowInstance * window)

Sets the window instance for this renderer.

Parameters
[in]windowThe window instance.

◆ updateArgs()

void Renderer::updateArgs ( bool force_render)

Updates the render arguments from current state.

Parameters
[in]force_renderWhether to force a render.

◆ updater()

GraphicsUpdater * Renderer::updater ( ) const
inline

Returns the associated graphics updater.

Returns
Pointer to the updater.

Definition at line 108 of file Renderer.h.


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