NDEVR
API Documentation
QModelViewCapture

Used to capture a 2D image of a DesignObjectLookup from a specific perspective. More...

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

Public Member Functions

 QModelViewCapture (const DynamicPointer< GraphicsDevice > &device, QTModelManager *manager)
 Constructs the model view capture.
virtual ~QModelViewCapture ()
 Destructor.
void addRequest (const ConstPointer< CaptureRequest > &request)
 Adds a capture request to the queue.
void executeRequest (const ConstPointer< CaptureRequest > &request)
 Immediately executes a capture request.
void finishFrame (GraphicsUpdateArguments &args) override
 Called after a frame is finished for post-processing.
uint04 getGrabImageSize () final override
 Returns the number of image grabs supported per frame.
QImage getModelImage (const CaptureInfo &info)
 Synchronously captures an image for the given parameters.
virtual void * getSurface () override
 Returns a platform-specific pointer to the rendering surface.
virtual void initialize ()
 Initializes the capture context and renderer.
void removeRequest (const ConstPointer< CaptureRequest > &request)
 Removes a capture request from the queue.
void requestModelImage (const ConstPointer< CaptureRequest > &request)
 Queues a model image capture request.
uint04 requestSize () const
 Returns the number of pending capture requests.
void setCacheCallback (const std::function< void(const CaptureCache &)> &function)
 Sets a callback invoked when a capture is cached.
void setCamera (const DynamicPointer< Camera > &camera) override
 Sets the camera for capture.
void setSize (const Vector< 2, uint04 > &size) final override
 Sets the logical size of the window.
void setupMaterialModel ()
 Sets up the material preview model.
virtual bool shouldExit () const override
 Checks whether the capture should exit.
bool update ()
 Performs an update cycle, processing pending capture requests.
Public Member Functions inherited from WindowInstance
 WindowInstance ()
 Default constructor.
 WindowInstance (const DynamicPointer< Camera > &camera, DesignObjectLookup *lookup)
 Constructs a WindowInstance with a given camera and design object lookup.
 ~WindowInstance ()
 Destructor.
void addKeyboardEvent (const std::function< void(KeyEvent)> &key_event)
 Registers a callback to be invoked when a keyboard event occurs.
void addMouseEvent (const std::function< void(MouseEvent)> &mouse_event)
 Registers a callback to be invoked when a mouse event occurs.
virtual const DynamicPointer< Camera > & camera ()
 Returns a reference to the dynamic camera pointer.
virtual ConstPointer< Cameracamera () const
 Returns a const pointer to the current camera.
void createEvent (const KeyEvent &event)
 Dispatches a keyboard event to all registered keyboard event callbacks.
void createEvent (const MouseEvent &event)
 Dispatches a mouse event to all registered mouse event callbacks.
fltp08 devicePixelRatio () const
 Returns the current device pixel ratio.
KeyControllergetKeyController ()
 Returns the keyboard controller associated with this window.
MouseControllergetMouseController ()
 Returns the mouse controller associated with this window.
Time getSurfaceUpdateTime () const
 Returns the timestamp of the last surface update.
const void * lockptr () const
 Returns a pointer that can be used as a lock identifier for this instance.
virtual Vector< 2, uint04logicalSize () const
 Returns the logical (device-independent) size of the window.
virtual Vector< 2, uint04pixelSize () const
 Returns the size of the window in physical pixels, accounting for the device pixel ratio.
virtual fltp08 referencePixelSize ()
 Returns the reference size in physical pixels, accounting for the device pixel ratio.
virtual fltp08 referenceSize ()
 Returns the reference size used for scaling calculations.
void setDevicePixelRatio (const fltp08 ratio)
 Sets the device pixel ratio (physical pixels per logical pixel).
void setLookup (DesignObjectLookup *lookup)
 Sets the design object lookup used for scene queries.
virtual void setReferenceSize (fltp08 size)
 Sets the reference size used for scaling calculations.
virtual void updateInstance ()
 Called to update the window instance state.
virtual bool visible () const
 Returns whether this window is currently visible.

Public Attributes

Resource< bool > is_running
 Whether the capture system is running.

Additional Inherited Members

Protected Member Functions inherited from WindowInstance
void setExposed (bool exposed)
 Sets whether the window surface is currently exposed (visible and ready for rendering).
Protected Attributes inherited from WindowInstance
DynamicPointer< Cameram_camera
 The camera used for rendering in this window.
fltp08 m_device_pixel_ratio
 Ratio of physical pixels to logical pixels.
bool m_is_exposed = false
 Whether the window surface is currently exposed.
Buffer< std::function< void(KeyEvent)> > m_key_events
 Registered keyboard event callbacks.
DesignObjectLookupm_lookup
 Pointer to the design object lookup for scene queries.
Buffer< std::function< void(MouseEvent)> > m_mouse_events
 Registered mouse event callbacks.
fltp08 m_reference_size
 Reference size used for scaling calculations.
Vector< 2, uint04m_size
 Logical size of the window.
Time m_surface_update_time
 Timestamp of the last surface update.

Detailed Description

Used to capture a 2D image of a DesignObjectLookup from a specific perspective.


Definition at line 45 of file ModelViewCapture.h.

Constructor & Destructor Documentation

◆ QModelViewCapture()

QModelViewCapture::QModelViewCapture ( const DynamicPointer< GraphicsDevice > & device,
QTModelManager * manager )
explicit

Constructs the model view capture.

Parameters
[in]deviceThe graphics device.
[in]managerThe model manager.

Member Function Documentation

◆ addRequest()

void QModelViewCapture::addRequest ( const ConstPointer< CaptureRequest > & request)

Adds a capture request to the queue.

Parameters
[in]requestThe capture request.

◆ executeRequest()

void QModelViewCapture::executeRequest ( const ConstPointer< CaptureRequest > & request)

Immediately executes a capture request.

Parameters
[in]requestThe capture request.

◆ finishFrame()

void QModelViewCapture::finishFrame ( GraphicsUpdateArguments & args)
overridevirtual

Called after a frame is finished for post-processing.

Parameters
[in]argsThe update arguments.

Reimplemented from WindowInstance.

◆ getGrabImageSize()

uint04 QModelViewCapture::getGrabImageSize ( )
inlinefinaloverridevirtual

Returns the number of image grabs supported per frame.

Returns
Always 1.

Reimplemented from WindowInstance.

Definition at line 72 of file ModelViewCapture.h.

◆ getModelImage()

QImage QModelViewCapture::getModelImage ( const CaptureInfo & info)

Synchronously captures an image for the given parameters.

Parameters
[in]infoThe capture parameters.
Returns
The captured QImage.

◆ getSurface()

virtual void * QModelViewCapture::getSurface ( )
inlineoverridevirtual

Returns a platform-specific pointer to the rendering surface.

Returns
A void pointer to the underlying surface. Must be implemented by subclasses.

Implements WindowInstance.

Definition at line 65 of file ModelViewCapture.h.

◆ removeRequest()

void QModelViewCapture::removeRequest ( const ConstPointer< CaptureRequest > & request)

Removes a capture request from the queue.

Parameters
[in]requestThe capture request.

◆ requestModelImage()

void QModelViewCapture::requestModelImage ( const ConstPointer< CaptureRequest > & request)

Queues a model image capture request.

Parameters
[in]requestThe capture request.

◆ requestSize()

uint04 QModelViewCapture::requestSize ( ) const
inline

Returns the number of pending capture requests.

Returns
The request count.

Definition at line 92 of file ModelViewCapture.h.

◆ setCacheCallback()

void QModelViewCapture::setCacheCallback ( const std::function< void(const CaptureCache &)> & function)
inline

Sets a callback invoked when a capture is cached.

Parameters
[in]functionThe callback.

Definition at line 95 of file ModelViewCapture.h.

◆ setCamera()

void QModelViewCapture::setCamera ( const DynamicPointer< Camera > & camera)
overridevirtual

Sets the camera for capture.

Parameters
[in]cameraThe camera pointer.

Reimplemented from WindowInstance.

References WindowInstance::camera().

◆ setSize()

void QModelViewCapture::setSize ( const Vector< 2, uint04 > & size)
inlinefinaloverridevirtual

Sets the logical size of the window.

Parameters
[in]sizeThe new logical dimensions.

Reimplemented from WindowInstance.

Definition at line 61 of file ModelViewCapture.h.

References WindowInstance::setSize().

◆ shouldExit()

virtual bool QModelViewCapture::shouldExit ( ) const
overridevirtual

Checks whether the capture should exit.

Returns
True if exit is needed.

Reimplemented from WindowInstance.

◆ update()

bool QModelViewCapture::update ( )

Performs an update cycle, processing pending capture requests.

Returns
True if an update was performed.

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