NDEVR
API Documentation
QTGraphicsWindow

A Window used to render 3D graphics. More...

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

Public Member Functions

 QTGraphicsWindow (const DynamicPointer< GraphicsDevice > &device, QWindow *parent, Qt::WindowFlags flags)
 Constructs the graphics window.
 ~QTGraphicsWindow ()
 Destructor.
void contextMenu (const QPoint &pos)
 Shows a context menu at the given position.
const DynamicPointer< GraphicsDevice > & device () const
 Returns the graphics device.
void exposeEvent (QExposeEvent *e) override
 Handles expose events to trigger rendering.
void finishFrame (GraphicsUpdateArguments &args) override
 Called after a frame is finished for post-processing.
QImage getImage () const
 Returns the last rendered frame as a QImage.
void hideContextMenuSignal ()
 Emitted to hide the context menu.
virtual void initialize ()
 Initializes the graphics context and renderer.
virtual void makeCurrent ()
 Makes this window's graphics context current (no-op by default).
void mouseInScreenSignal (bool mouse_in_screen)
 Emitted when the mouse enters or leaves the window.
void onClearAll ()
 Handles a clear-all event from the scene.
void onFocusChanged (UUID focus, bool focussed)
 Handles a focus change.
void onSelectedSignal (Buffer< UUID > selected)
 Emitted when objects are selected.
void onSelectionChanged (Buffer< UUID > selection, bool selected)
 Handles a selection change.
void pause (const TimeSpan &span)
 Pauses rendering for a duration.
void renderShowing ()
 Emitted when the render window is first shown.
void renderSlot ()
 Slot that triggers a render pass.
void requestContextMenu (const QPoint &pos)
 Emitted to request a context menu display.
void resizeEvent (QResizeEvent *resize_event) override
 Handles window resize events.
void setAnimating (bool animating)
 Sets whether the window continuously animates.
void setCamera (const DynamicPointer< Camera > &camera) override
 Sets the camera for rendering.
virtual void setModelManager (QTModelManager *manager)
 Sets the model manager for this window.
void setOverrideMaterial (UUID material)
 Sets a material override for the renderer.
void setSize (const Vector< 2, uint04 > &size) final override
 Sets the viewport size.
virtual bool shouldExit () const override
 Checks whether the window should exit.
void updateFallbackStore ()
 Updates the fallback backing store for the window.
void updateSize ()
 Updates the internal size from the window geometry.
virtual bool visible () const override
 Checks whether the window is visible.
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.
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.
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.

Protected Attributes

bool m_animating
 Whether continuous animation is active.
QBackingStore * m_backing_store = nullptr
 Fallback backing store for the window.
DynamicPointer< GraphicsDevicem_device
 The graphics device.
QTimer * m_fps_timer = nullptr
 Timer driving FPS-limited rendering.
bool m_has_valid_khr
 Whether a valid Vulkan surface (KHR) exists.
bool m_initiation_failure
 Whether initialization failed.
bool m_instance_valid = false
 Whether the graphics instance is valid.
bool m_is_init
 Whether the window has been initialized.
bool m_is_size_valid
 Whether the current window size is valid.
QRect m_last_render_size
 The size used for the last render.
QTModelManagerm_manager
 The model manager.
QTResourceListenerm_mouse_manager_listener
 Listener for mouse manager changes.
Rendererm_render
 The renderer for this window.
bool m_touch_alternate = false
 Alternate touch mode flag.
QPointF m_touch_begin_point
 Starting point of a touch gesture.
QTimer * m_touch_context_timer = nullptr
 Timer for long-press touch context menu.
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.

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).

Detailed Description

A Window used to render 3D graphics.


This container allows for a different graphics backend to be used than the rest of the UI.

Definition at line 58 of file QtGraphicsWindow.h.

Constructor & Destructor Documentation

◆ QTGraphicsWindow()

QTGraphicsWindow::QTGraphicsWindow ( const DynamicPointer< GraphicsDevice > & device,
QWindow * parent,
Qt::WindowFlags flags )
explicit

Constructs the graphics window.

Parameters
[in]deviceThe graphics device.
[in]parentThe parent QWindow.
[in]flagsThe window flags.

References device().

Member Function Documentation

◆ contextMenu()

void QTGraphicsWindow::contextMenu ( const QPoint & pos)

Shows a context menu at the given position.

Parameters
[in]posThe screen position.

◆ device()

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

Returns the graphics device.

Returns
Reference to the device pointer.

Referenced by QTGraphicsWindow().

◆ exposeEvent()

void QTGraphicsWindow::exposeEvent ( QExposeEvent * e)
override

Handles expose events to trigger rendering.

Parameters
[in]eThe expose event.

◆ finishFrame()

void QTGraphicsWindow::finishFrame ( GraphicsUpdateArguments & args)
overridevirtual

Called after a frame is finished for post-processing.

Parameters
[in]argsThe update arguments.

Reimplemented from WindowInstance.

◆ getImage()

QImage QTGraphicsWindow::getImage ( ) const

Returns the last rendered frame as a QImage.

Returns
The captured QImage.

◆ mouseInScreenSignal()

void QTGraphicsWindow::mouseInScreenSignal ( bool mouse_in_screen)

Emitted when the mouse enters or leaves the window.

Parameters
[in]mouse_in_screenWhether the mouse is in the window.

◆ onFocusChanged()

void QTGraphicsWindow::onFocusChanged ( UUID focus,
bool focussed )

Handles a focus change.

Parameters
[in]focusThe focused UUID.
[in]focussedWhether the item gained or lost focus.

◆ onSelectedSignal()

void QTGraphicsWindow::onSelectedSignal ( Buffer< UUID > selected)

Emitted when objects are selected.

Parameters
[in]selectedThe selected UUIDs.

◆ onSelectionChanged()

void QTGraphicsWindow::onSelectionChanged ( Buffer< UUID > selection,
bool selected )

Handles a selection change.

Parameters
[in]selectionThe selected UUIDs.
[in]selectedWhether items were selected or deselected.

◆ pause()

void QTGraphicsWindow::pause ( const TimeSpan & span)

Pauses rendering for a duration.

Parameters
[in]spanThe pause duration.

◆ requestContextMenu()

void QTGraphicsWindow::requestContextMenu ( const QPoint & pos)

Emitted to request a context menu display.

Parameters
[in]posThe screen position.

◆ resizeEvent()

void QTGraphicsWindow::resizeEvent ( QResizeEvent * resize_event)
override

Handles window resize events.

Parameters
[in]resize_eventThe resize event.

◆ setAnimating()

void QTGraphicsWindow::setAnimating ( bool animating)

Sets whether the window continuously animates.

Parameters
[in]animatingWhether to animate.

◆ setCamera()

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

Sets the camera for rendering.

Parameters
[in]cameraThe camera pointer.

Reimplemented from WindowInstance.

References WindowInstance::camera().

◆ setModelManager()

virtual void QTGraphicsWindow::setModelManager ( QTModelManager * manager)
virtual

Sets the model manager for this window.

Parameters
[in]managerThe model manager.

◆ setOverrideMaterial()

void QTGraphicsWindow::setOverrideMaterial ( UUID material)

Sets a material override for the renderer.

Parameters
[in]materialThe override material UUID.

◆ setSize()

void QTGraphicsWindow::setSize ( const Vector< 2, uint04 > & size)
finaloverridevirtual

Sets the viewport size.

Parameters
[in]sizeThe new size in pixels.

Reimplemented from WindowInstance.

◆ shouldExit()

virtual bool QTGraphicsWindow::shouldExit ( ) const
overridevirtual

Checks whether the window should exit.

Returns
True if exit is needed.

Reimplemented from WindowInstance.

◆ visible()

virtual bool QTGraphicsWindow::visible ( ) const
overridevirtual

Checks whether the window is visible.

Returns
True if visible.

Reimplemented from WindowInstance.


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