NDEVR
API Documentation
WindowInstanceabstract

Contains core information about a Viewport. More...

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

Public Member Functions

 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.
virtual void finishFrame (GraphicsUpdateArguments &args)
 Called at the end of a frame to perform any finalization work.
virtual uint04 getGrabImageSize ()
 Returns the size for image grabbing operations.
KeyControllergetKeyController ()
 Returns the keyboard controller associated with this window.
MouseControllergetMouseController ()
 Returns the mouse controller associated with this window.
virtual void * getSurface ()=0
 Returns a platform-specific pointer to the rendering surface.
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.
virtual void setCamera (const DynamicPointer< Camera > &camera)
 Sets the camera associated with this window.
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 setSize (const Vector< 2, uint04 > &size)
 Sets the logical size of the window.
virtual bool shouldExit () const
 Returns whether this window should exit or close.
virtual void updateInstance ()
 Called to update the window instance state.
virtual bool visible () const
 Returns whether this window is currently visible.

Protected Member Functions

void setExposed (bool exposed)
 Sets whether the window surface is currently exposed (visible and ready for rendering).

Protected Attributes

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

Contains core information about a Viewport.


WindowInstance represents a renderable window surface that manages a Camera, input events, and display properties such as size and device pixel ratio. Subclasses provide platform-specific surface implementations.

Definition at line 55 of file WindowInstance.h.

Constructor & Destructor Documentation

◆ WindowInstance() [1/2]

WindowInstance::WindowInstance ( )

Default constructor.

Initializes the window instance with default values.

◆ WindowInstance() [2/2]

WindowInstance::WindowInstance ( const DynamicPointer< Camera > & camera,
DesignObjectLookup * lookup )

Constructs a WindowInstance with a given camera and design object lookup.

Parameters
[in]cameraThe camera to associate with this window.
[in]lookupThe design object lookup used for scene queries.

References camera().

Member Function Documentation

◆ addKeyboardEvent()

void WindowInstance::addKeyboardEvent ( const std::function< void(KeyEvent)> & key_event)
inline

Registers a callback to be invoked when a keyboard event occurs.

Parameters
[in]key_eventThe callback function to add.

Definition at line 98 of file WindowInstance.h.

References m_key_events.

◆ addMouseEvent()

void WindowInstance::addMouseEvent ( const std::function< void(MouseEvent)> & mouse_event)
inline

Registers a callback to be invoked when a mouse event occurs.

Parameters
[in]mouse_eventThe callback function to add.

Definition at line 95 of file WindowInstance.h.

References m_mouse_events.

◆ camera() [1/2]

virtual const DynamicPointer< Camera > & WindowInstance::camera ( )
inlinevirtual

Returns a reference to the dynamic camera pointer.

Returns
A const reference to the DynamicPointer<Camera>.

Definition at line 128 of file WindowInstance.h.

References m_camera.

◆ camera() [2/2]

virtual ConstPointer< Camera > WindowInstance::camera ( ) const
inlinevirtual

Returns a const pointer to the current camera.

Returns
A ConstPointer to the Camera.

Definition at line 125 of file WindowInstance.h.

References m_camera.

Referenced by WindowInstance(), QModelViewCapture::setCamera(), QTGraphicsWindow::setCamera(), and setCamera().

◆ createEvent() [1/2]

void WindowInstance::createEvent ( const KeyEvent & event)

Dispatches a keyboard event to all registered keyboard event callbacks.

Parameters
[in]eventThe key event to dispatch.

◆ createEvent() [2/2]

void WindowInstance::createEvent ( const MouseEvent & event)

Dispatches a mouse event to all registered mouse event callbacks.

Parameters
[in]eventThe mouse event to dispatch.

◆ devicePixelRatio()

fltp08 WindowInstance::devicePixelRatio ( ) const
inline

Returns the current device pixel ratio.

Returns
The ratio of physical pixels to logical pixels.

Definition at line 143 of file WindowInstance.h.

References m_device_pixel_ratio.

◆ finishFrame()

virtual void WindowInstance::finishFrame ( GraphicsUpdateArguments & args)
inlinevirtual

Called at the end of a frame to perform any finalization work.

Parameters
[in]argsThe graphics update arguments for the current frame.

Reimplemented in GLESGraphicsWindow, QModelViewCapture, and QTGraphicsWindow.

Definition at line 119 of file WindowInstance.h.

◆ getGrabImageSize()

virtual uint04 WindowInstance::getGrabImageSize ( )
inlinevirtual

Returns the size for image grabbing operations.

Returns
The grab image size, or 0 if not supported.
Note
Purpose is unclear – may relate to screenshot or framebuffer capture resolution.

Reimplemented in QModelViewCapture.

Definition at line 116 of file WindowInstance.h.

◆ getKeyController()

KeyController & WindowInstance::getKeyController ( )

Returns the keyboard controller associated with this window.

Returns
A reference to the KeyController.

◆ getMouseController()

MouseController & WindowInstance::getMouseController ( )

Returns the mouse controller associated with this window.

Returns
A reference to the MouseController.

◆ getSurface()

virtual void * WindowInstance::getSurface ( )
pure virtual

Returns a platform-specific pointer to the rendering surface.

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

Implemented in GLESGraphicsWindow, QModelViewCapture, and XRCameraView.

◆ getSurfaceUpdateTime()

Time WindowInstance::getSurfaceUpdateTime ( ) const
inline

Returns the timestamp of the last surface update.

Returns
The Time of the most recent surface update.

Definition at line 112 of file WindowInstance.h.

References m_surface_update_time.

◆ lockptr()

const void * WindowInstance::lockptr ( ) const
inline

Returns a pointer that can be used as a lock identifier for this instance.

Returns
A const void pointer to this object.

Definition at line 131 of file WindowInstance.h.

◆ logicalSize()

virtual Vector< 2, uint04 > WindowInstance::logicalSize ( ) const
inlinevirtual

Returns the logical (device-independent) size of the window.

Returns
The logical dimensions as a 2D vector.

Definition at line 80 of file WindowInstance.h.

References m_size.

◆ pixelSize()

virtual Vector< 2, uint04 > WindowInstance::pixelSize ( ) const
inlinevirtual

Returns the size of the window in physical pixels, accounting for the device pixel ratio.

Returns
The pixel dimensions as a 2D vector.

Definition at line 77 of file WindowInstance.h.

References Vector< t_dims, t_type >::as(), m_device_pixel_ratio, and m_size.

◆ referencePixelSize()

virtual fltp08 WindowInstance::referencePixelSize ( )
inlinevirtual

Returns the reference size in physical pixels, accounting for the device pixel ratio.

Returns
The reference size multiplied by the device pixel ratio.

Definition at line 86 of file WindowInstance.h.

References m_device_pixel_ratio, and m_reference_size.

◆ referenceSize()

virtual fltp08 WindowInstance::referenceSize ( )
inlinevirtual

Returns the reference size used for scaling calculations.

Returns
The reference size in logical units.

Definition at line 83 of file WindowInstance.h.

References m_reference_size.

◆ setCamera()

virtual void WindowInstance::setCamera ( const DynamicPointer< Camera > & camera)
virtual

Sets the camera associated with this window.

Parameters
[in]cameraThe new camera to use for rendering.

Reimplemented in QModelViewCapture, and QTGraphicsWindow.

References camera().

◆ setDevicePixelRatio()

void WindowInstance::setDevicePixelRatio ( const fltp08 ratio)
inline

Sets the device pixel ratio (physical pixels per logical pixel).

Parameters
[in]ratioThe device pixel ratio to set.

Definition at line 140 of file WindowInstance.h.

References m_device_pixel_ratio.

◆ setExposed()

void WindowInstance::setExposed ( bool exposed)
protected

Sets whether the window surface is currently exposed (visible and ready for rendering).

Parameters
[in]exposedTrue if the window is exposed, false otherwise.

◆ setLookup()

void WindowInstance::setLookup ( DesignObjectLookup * lookup)
inline

Sets the design object lookup used for scene queries.

Parameters
[in]lookupThe DesignObjectLookup to associate with this window.

Definition at line 74 of file WindowInstance.h.

References m_lookup.

◆ setReferenceSize()

virtual void WindowInstance::setReferenceSize ( fltp08 size)
virtual

Sets the reference size used for scaling calculations.

Parameters
[in]sizeThe new reference size in logical units.

◆ setSize()

virtual void WindowInstance::setSize ( const Vector< 2, uint04 > & size)
virtual

Sets the logical size of the window.

Parameters
[in]sizeThe new logical dimensions.

Reimplemented in QModelViewCapture, and QTGraphicsWindow.

Referenced by QModelViewCapture::setSize().

◆ shouldExit()

virtual bool WindowInstance::shouldExit ( ) const
inlinevirtual

Returns whether this window should exit or close.

Returns
True if the window should exit, false otherwise.

Reimplemented in QModelViewCapture, and QTGraphicsWindow.

Definition at line 104 of file WindowInstance.h.

◆ updateInstance()

virtual void WindowInstance::updateInstance ( )
inlinevirtual

Called to update the window instance state.

Override to provide custom update logic.

Reimplemented in GLESGraphicsWindow.

Definition at line 109 of file WindowInstance.h.

◆ visible()

virtual bool WindowInstance::visible ( ) const
inlinevirtual

Returns whether this window is currently visible.

Returns
True if the window is visible, false otherwise.

Reimplemented in QTGraphicsWindow.

Definition at line 101 of file WindowInstance.h.


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