NDEVR
API Documentation
GraphicsUpdater

Responsible for updating resources or layouts of data in-between calls to render. More...

Inheritance diagram for GraphicsUpdater:
[legend]
Collaboration diagram for GraphicsUpdater:
[legend]

Public Member Functions

 GraphicsUpdater (DesignObjectLookup *lookup, const DynamicPointer< GraphicsDevice > &device, LogPtr log=LogPtr())
 Constructs the updater for a design lookup and graphics device.
 ~GraphicsUpdater ()
 Destructor.
void addManager (const UUID &id, Renderer *renderer)
 Registers a renderer for a given camera ID.
void addPipeline (GraphicsPipeline *pipline)
 Adds a graphics pipeline to the update list.
GraphicsUpdateArgumentsargs ()
 Returns the current graphics update arguments.
CheckoutLock checkout (const UUID &id, bool wait_until_ready)
 Checks out a renderer, blocking until available.
const DynamicPointer< GraphicsDevice > & device () const
 Returns the graphics device.
bool hasManager (const UUID &id)
 Checks whether a renderer is registered for the given ID.
Time lastUpdateTime () const
 Returns the last time an update was performed.
void recreate ()
 Triggers a full pipeline recreation.
void removeManager (const UUID &id)
 Removes a registered renderer.
void removePipeline (GraphicsPipeline *pipline)
 Removes a graphics pipeline from the update list.
void setExceptionCallback (const std::function< void(const Exception &)> &callback)
 Sets a callback invoked when a graphics exception occurs.
void setIsGrabSetup (bool grab_setup)
 Sets whether this updater is configured for image grab mode.
void setLog (LogPtr log)
 Sets the log for graphics update operations.
void setLookup (DesignObjectLookup *lookup)
 Sets the design object lookup.
CheckoutLock tryCheckout (const UUID &id, bool wait_until_ready)
 Attempts a non-blocking checkout of a renderer.
void update ()
 Performs an update using the internal arguments.
void update (DesignObjectLookup *lookup, Time time) override
 Performs a full update cycle for all graphics resources.
void update (GraphicsUpdateArguments &args)
 Performs an update using the provided arguments.

Static Public Member Functions

static GraphicsUpdaterDefaultUpdater (DesignObjectLookup *lookup, LogPtr log, DynamicPointer< GraphicsDevice > device)
 Returns or creates the default updater singleton.

Protected Attributes

GraphicsUpdateArguments m_args
 Current graphics update arguments.
std::mutex m_critical_section
 Mutex for thread-safe access.
DynamicPointer< GraphicsDevicem_device
 The graphics device used for rendering.
std::function< void(const Exception &)> m_exception_callback
 Callback for graphics exceptions.
bool m_grab_setup
 Whether the updater is in image-grab mode.
Time m_last_update_time
 Last time a full update was performed.
Buffer< GraphicsPipeline * > m_pipelines
 Registered graphics pipelines.
Dictionary< UUID, Renderer * > m_renderers
 Registered renderers keyed by camera UUID.
volatile uint04 m_total_checked_out_count
 Number of currently checked-out renderers.
Dictionary< UUID, bool > needs_update
 Per-renderer update flags.

Detailed Description

Responsible for updating resources or layouts of data in-between calls to render.


Definition at line 49 of file GraphicsUpdater.h.

Constructor & Destructor Documentation

◆ GraphicsUpdater()

GraphicsUpdater::GraphicsUpdater ( DesignObjectLookup * lookup,
const DynamicPointer< GraphicsDevice > & device,
LogPtr log = LogPtr() )

Constructs the updater for a design lookup and graphics device.

Parameters
[in]lookupThe design object lookup.
[in]deviceThe graphics device.
[in]logOptional log.

References device().

Referenced by DefaultUpdater().

Member Function Documentation

◆ addManager()

void GraphicsUpdater::addManager ( const UUID & id,
Renderer * renderer )

Registers a renderer for a given camera ID.

Parameters
[in]idThe camera UUID.
[in]rendererThe renderer to register.

◆ addPipeline()

void GraphicsUpdater::addPipeline ( GraphicsPipeline * pipline)
inline

Adds a graphics pipeline to the update list.

Parameters
[in]piplineThe pipeline to add.

Definition at line 108 of file GraphicsUpdater.h.

References m_pipelines.

◆ args()

GraphicsUpdateArguments & GraphicsUpdater::args ( )
inline

Returns the current graphics update arguments.

Returns
Reference to the arguments.

Definition at line 118 of file GraphicsUpdater.h.

References m_args.

Referenced by update().

◆ checkout()

CheckoutLock GraphicsUpdater::checkout ( const UUID & id,
bool wait_until_ready )

Checks out a renderer, blocking until available.

Parameters
[in]idThe camera UUID.
[in]wait_until_readyWhether to wait for the renderer.
Returns
A CheckoutLock.

◆ DefaultUpdater()

GraphicsUpdater * GraphicsUpdater::DefaultUpdater ( DesignObjectLookup * lookup,
LogPtr log,
DynamicPointer< GraphicsDevice > device )
static

Returns or creates the default updater singleton.

Parameters
[in]lookupThe design object lookup.
[in]logThe log.
[in]deviceThe graphics device.
Returns
The default updater.

References GraphicsUpdater(), and device().

◆ device()

const DynamicPointer< GraphicsDevice > & GraphicsUpdater::device ( ) const
inline

Returns the graphics device.

Returns
Reference to the device pointer.

Definition at line 105 of file GraphicsUpdater.h.

References m_device.

Referenced by GraphicsUpdater(), and DefaultUpdater().

◆ hasManager()

bool GraphicsUpdater::hasManager ( const UUID & id)

Checks whether a renderer is registered for the given ID.

Parameters
[in]idThe renderer UUID.
Returns
True if a renderer exists for the ID.

◆ lastUpdateTime()

Time GraphicsUpdater::lastUpdateTime ( ) const
inline

Returns the last time an update was performed.

Returns
The last update time.

Definition at line 78 of file GraphicsUpdater.h.

References m_last_update_time.

◆ removeManager()

void GraphicsUpdater::removeManager ( const UUID & id)

Removes a registered renderer.

Parameters
[in]idThe camera UUID.

◆ removePipeline()

void GraphicsUpdater::removePipeline ( GraphicsPipeline * pipline)

Removes a graphics pipeline from the update list.

Parameters
[in]piplineThe pipeline to remove.

◆ setExceptionCallback()

void GraphicsUpdater::setExceptionCallback ( const std::function< void(const Exception &)> & callback)
inline

Sets a callback invoked when a graphics exception occurs.

Parameters
[in]callbackThe exception callback function.

Definition at line 129 of file GraphicsUpdater.h.

References m_exception_callback.

◆ setIsGrabSetup()

void GraphicsUpdater::setIsGrabSetup ( bool grab_setup)

Sets whether this updater is configured for image grab mode.

Parameters
[in]grab_setupWhether grab mode is active.

◆ setLog()

void GraphicsUpdater::setLog ( LogPtr log)
inline

Sets the log for graphics update operations.

Parameters
[in]logThe log pointer.

Definition at line 66 of file GraphicsUpdater.h.

References m_args.

◆ setLookup()

void GraphicsUpdater::setLookup ( DesignObjectLookup * lookup)
inline

Sets the design object lookup.

Parameters
[in]lookupThe lookup to use.

Definition at line 72 of file GraphicsUpdater.h.

References m_args.

◆ tryCheckout()

CheckoutLock GraphicsUpdater::tryCheckout ( const UUID & id,
bool wait_until_ready )

Attempts a non-blocking checkout of a renderer.

Parameters
[in]idThe camera UUID.
[in]wait_until_readyWhether to wait for the renderer.
Returns
A CheckoutLock (invalid if checkout failed).

◆ update() [1/2]

void GraphicsUpdater::update ( DesignObjectLookup * lookup,
Time time )
overridevirtual

Performs a full update cycle for all graphics resources.

Parameters
[in]lookupThe design object lookup.
[in]timeThe current time.

Implements DesignObjectUpdateTarget.

◆ update() [2/2]

void GraphicsUpdater::update ( GraphicsUpdateArguments & args)

Performs an update using the provided arguments.

Parameters
[in]argsThe update arguments.

References args().


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