VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtQtQuickRenderer Class Reference

Detailed Description

This singleton class manages the loading, rendering, and interaction with QML-based user interfaces. It integrates Qt Quick with OSG rendering to provide seamless UI capabilities within 3D environments.

#include <DtQtQuickRenderer.h>

Public Types

using RenderControlMap = std::map<osg::GraphicsContext*, DtPerWindowQtQuickData*>
 

Public Member Functions

virtual void shutdown ()
 
virtual void loadQMLFile (QObject *owner, const std::string &filepath, const std::function< void(QQuickItem *)> &file_loaded_func)
 
virtual void loadQMLFile (QObject *owner, const std::string &windowName, const std::string &filepath, const std::function< void(QQuickItem *)> &file_loaded_func)
 
virtual void loadQMLFileRTT (QObject *owner, const std::string &filepath, osg::Texture2D *target, const std::function< void(QQuickItem *)> &func)
 
virtual void reloadQMLFile (QObject *owner)
 
virtual void closeUIByRoot (QQuickItem *root)
 
virtual void closeUIByOwner (QObject *owner)
 
virtual QQmlContext * rootContext ()
 
virtual osg::Geode * geodeRtt ()
 
virtual makVrv::DtDe & de ()
 
virtual void setVirtualRealityRenderTarget (osg::Texture2D *texture)
 
virtual void syncVirtualRealityRenderTarget (unsigned int ctxid)
 
virtual void slot_vrRunningChanged (bool running)
 
virtual void slot_vrOverlayChanged ()
 
virtual void addToDebugMap (const std::string &logCat)
 
virtual const int numberOfUIsToLoad () const
 
virtual const QRect & getWindowDimensions (const std::string &windowName) const
 

Static Public Member Functions

static DtQtQuickRendererinstance ()
 
static void install (makVrv::DtDe &de)
 
static QObject * getChildObject (const QObject *parent, const QString &objectName)
 

Protected Member Functions

 DtQtQuickRenderer (makVrv::DtDe &de)
 
virtual ~DtQtQuickRenderer ()
 
virtual void initQtQuickRenderingComponents (osg::RenderInfo &renderInfo)
 
virtual DtPerWindowQtQuickDatagetWindowData (osg::GraphicsContext *gc)
 
virtual void installDefaultProperties ()
 
virtual void updateQuick (osg::RenderInfo &renderInfo)
 
virtual void onWindowToBeDestroyed (makVrv::DtWindow *win)
 
virtual void setDebugConfig ()
 
virtual void debugManagerCallback ()
 
virtual void reloadQMLFile (DtQtQuickFileData *data)
 
virtual void closeUI (DtQtQuickFileData *data)
 
virtual QQuickItem * loadFileNow (osg::GraphicsContext *gc, DtQtQuickFileData *fileData)
 

Protected Attributes

makVrv::DtDe & myDe
 
osg::ref_ptr< osg::Geode > myGeode
 
osg::ref_ptr< osg::Drawable > myDrawable
 
osg::ref_ptr< osg::Geode > myGeodeRTT
 
osg::ref_ptr< osg::Drawable > myDrawableRTT
 
QQmlEngine * myQmlEngine
 
osg::GraphicsContext * myDefaultContext
 
RenderControlMap myRenderControlMap
 
std::vector< DtQtQuickFileData * > myUIsToLoadList
 
std::vector< DtQtQuickFileData * > myUIsLoadedList
 
makVrv::DtSignalConnectionManager myConnections
 
osg::Texture2D * myRenderTargetToSync
 
std::map< std::string, bool > myQmlDebugMap
 

Static Protected Attributes

static DtQtQuickRenderertheQtQuickRenderer
 

Friends

class DtQtQuickRendererDrawable
 
class DtQQuickWindow
 

Member Typedef Documentation

◆ RenderControlMap

using makVre::DtQtQuickRenderer::RenderControlMap = std::map<osg::GraphicsContext*, DtPerWindowQtQuickData*>

Type definition for mapping graphics contexts to Qt Quick data.

Constructor & Destructor Documentation

◆ DtQtQuickRenderer()

makVre::DtQtQuickRenderer::DtQtQuickRenderer ( makVrv::DtDe & de)
protected

Constructor for Qt Quick renderer.

Parameters
deReference to the graphics engine

References de().

Referenced by instance().

◆ ~DtQtQuickRenderer()

virtual makVre::DtQtQuickRenderer::~DtQtQuickRenderer ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

◆ instance()

static DtQtQuickRenderer * makVre::DtQtQuickRenderer::instance ( )
static

Gets the singleton Qt Quick renderer instance.

Returns
Pointer to the singleton renderer instance

References DtQtQuickRenderer().

◆ install()

static void makVre::DtQtQuickRenderer::install ( makVrv::DtDe & de)
static

Installs the Qt Quick renderer system.

Parameters
deReference to the graphics engine

References de().

◆ shutdown()

virtual void makVre::DtQtQuickRenderer::shutdown ( )
virtual

Cleans up and shuts down the Qt Quick renderer system.

Releases all resources and destroys loaded QML interfaces

◆ loadQMLFile() [1/2]

virtual void makVre::DtQtQuickRenderer::loadQMLFile ( QObject * owner,
const std::string & filepath,
const std::function< void(QQuickItem *)> & file_loaded_func )
virtual

Loads a QML file and calls a function when loaded.

Parameters
ownerThe object that owns this QML interface
filepathPath to the QML file to load
file_loaded_funcCallback function called when the file is loaded

◆ loadQMLFile() [2/2]

virtual void makVre::DtQtQuickRenderer::loadQMLFile ( QObject * owner,
const std::string & windowName,
const std::string & filepath,
const std::function< void(QQuickItem *)> & file_loaded_func )
virtual

Loads a QML file to a specific window and calls a function when loaded.

Parameters
ownerThe object that owns this QML interface
windowNameName of the window to load the QML into
filepathPath to the QML file to load
file_loaded_funcCallback function called when the file is loaded

◆ loadQMLFileRTT()

virtual void makVre::DtQtQuickRenderer::loadQMLFileRTT ( QObject * owner,
const std::string & filepath,
osg::Texture2D * target,
const std::function< void(QQuickItem *)> & func )
virtual

Loads a QML file for render-to-texture and calls a function when loaded.

Loads a QML file and renders it to a texture target. The callback function will be called with the "fbo" property set to the OpenGL texture being rendered into.

Parameters
ownerThe object that owns this QML interface
filepathPath to the QML file to load
targetOpenGL texture to render the QML content into
funcCallback function called when the file is loaded

◆ reloadQMLFile() [1/2]

virtual void makVre::DtQtQuickRenderer::reloadQMLFile ( QObject * owner)
virtual

Reloads the QML file associated with the specified owner.

Parameters
ownerThe object that owns the QML interface to reload

◆ closeUIByRoot()

virtual void makVre::DtQtQuickRenderer::closeUIByRoot ( QQuickItem * root)
virtual

Closes the UI associated with the specified root item.

Parameters
rootThe root QQuickItem of the UI to close

◆ closeUIByOwner()

virtual void makVre::DtQtQuickRenderer::closeUIByOwner ( QObject * owner)
virtual

Closes the UI associated with the specified owner.

Parameters
ownerThe object that owns the UI to close

◆ rootContext()

virtual QQmlContext * makVre::DtQtQuickRenderer::rootContext ( )
virtual

Gets the root QML context.

This context is needed to allow C++ to send JavaScript and QML engine objects

Returns
Pointer to the root QML context

◆ geodeRtt()

virtual osg::Geode * makVre::DtQtQuickRenderer::geodeRtt ( )
virtual

Gets the render-to-texture geode.

Returns
Pointer to the OSG geode used for render-to-texture

◆ de()

virtual makVrv::DtDe & makVre::DtQtQuickRenderer::de ( )
inlinevirtual

Gets the graphics engine reference.

Returns
Reference to the graphics engine

References myDe.

Referenced by DtQtQuickRenderer(), and install().

◆ setVirtualRealityRenderTarget()

virtual void makVre::DtQtQuickRenderer::setVirtualRealityRenderTarget ( osg::Texture2D * texture)
virtual

Sets the virtual reality render target.

Parameters
texturePointer to the texture to use as the VR render target

◆ syncVirtualRealityRenderTarget()

virtual void makVre::DtQtQuickRenderer::syncVirtualRealityRenderTarget ( unsigned int ctxid)
virtual

Synchronizes the virtual reality render target with all file data.

Finds any file data using the virtual reality target and updates their render texture

Parameters
ctxidThe context ID to synchronize

◆ slot_vrRunningChanged()

virtual void makVre::DtQtQuickRenderer::slot_vrRunningChanged ( bool running)
virtual

Slot called when VR running state changes.

Parameters
runningTrue if VR is running, false otherwise

◆ slot_vrOverlayChanged()

virtual void makVre::DtQtQuickRenderer::slot_vrOverlayChanged ( )
virtual

Slot called when VR overlay settings change.

◆ addToDebugMap()

virtual void makVre::DtQtQuickRenderer::addToDebugMap ( const std::string & logCat)
virtual

Adds a category to the debug map.

Parameters
logCatThe logging category to add

◆ numberOfUIsToLoad()

virtual const int makVre::DtQtQuickRenderer::numberOfUIsToLoad ( ) const
virtual

Gets the number of UIs that are in queue to load.

Returns
The number of pending UI loads

◆ getChildObject()

static QObject * makVre::DtQtQuickRenderer::getChildObject ( const QObject * parent,
const QString & objectName )
static

Gets a reference to a child QObject in QML.

Parameters
parentThe parent QObject to search in
objectNameThe name of the child object to find
Returns
Pointer to the found child object, or nullptr if not found

◆ getWindowDimensions()

virtual const QRect & makVre::DtQtQuickRenderer::getWindowDimensions ( const std::string & windowName) const
virtual

Gets the dimensions of the specified window.

Parameters
windowNameName of the window to get dimensions for
Returns
Reference to a QRect containing the window dimensions

◆ initQtQuickRenderingComponents()

virtual void makVre::DtQtQuickRenderer::initQtQuickRenderingComponents ( osg::RenderInfo & renderInfo)
protectedvirtual

Initializes Qt Quick rendering components.

Parameters
renderInfoRender information from OSG

◆ getWindowData()

virtual DtPerWindowQtQuickData * makVre::DtQtQuickRenderer::getWindowData ( osg::GraphicsContext * gc)
protectedvirtual

Gets Qt Quick data for the specified graphics context.

Parameters
gcThe graphics context to get data for
Returns
Pointer to the Qt Quick data for the context

◆ installDefaultProperties()

virtual void makVre::DtQtQuickRenderer::installDefaultProperties ( )
protectedvirtual

Installs default properties for all root QML objects.

Sets up properties that every root QML object should have

◆ updateQuick()

virtual void makVre::DtQtQuickRenderer::updateQuick ( osg::RenderInfo & renderInfo)
protectedvirtual

Updates the Qt Quick rendering in OSG.

Parameters
renderInfoRender information from OSG

◆ onWindowToBeDestroyed()

virtual void makVre::DtQtQuickRenderer::onWindowToBeDestroyed ( makVrv::DtWindow * win)
protectedvirtual

Handles a window being destroyed.

Parameters
winPointer to the window being destroyed

◆ setDebugConfig()

virtual void makVre::DtQtQuickRenderer::setDebugConfig ( )
protectedvirtual

Sets up the debug configuration.

◆ debugManagerCallback()

virtual void makVre::DtQtQuickRenderer::debugManagerCallback ( )
protectedvirtual

Callback for debug manager.

◆ reloadQMLFile() [2/2]

virtual void makVre::DtQtQuickRenderer::reloadQMLFile ( DtQtQuickFileData * data)
protectedvirtual

Reloads a QML file from file data.

Parameters
dataThe file data to reload

◆ closeUI()

virtual void makVre::DtQtQuickRenderer::closeUI ( DtQtQuickFileData * data)
protectedvirtual

Closes a UI from file data.

Parameters
dataThe file data for the UI to close

◆ loadFileNow()

virtual QQuickItem * makVre::DtQtQuickRenderer::loadFileNow ( osg::GraphicsContext * gc,
DtQtQuickFileData * fileData )
protectedvirtual

Loads a QML file immediately.

Parameters
gcThe graphics context to load into
fileDataThe file data to load
Returns
Pointer to the root QML item

Friends And Related Symbol Documentation

◆ DtQtQuickRendererDrawable

friend class DtQtQuickRendererDrawable
friend

Friends that need access to protected members.

References DtQtQuickRendererDrawable.

Referenced by DtQtQuickRendererDrawable.

◆ DtQQuickWindow

friend class DtQQuickWindow
friend

References DtQQuickWindow.

Referenced by DtQQuickWindow.

Member Data Documentation

◆ theQtQuickRenderer

DtQtQuickRenderer* makVre::DtQtQuickRenderer::theQtQuickRenderer
staticprotected

Singleton instance of the Qt Quick renderer.

◆ myDe

makVrv::DtDe& makVre::DtQtQuickRenderer::myDe
protected

Reference to the graphics engine.

Referenced by de().

◆ myGeode

osg::ref_ptr<osg::Geode> makVre::DtQtQuickRenderer::myGeode
protected

Standard OSG geode for Qt Quick rendering.

◆ myDrawable

osg::ref_ptr<osg::Drawable> makVre::DtQtQuickRenderer::myDrawable
protected

Standard OSG drawable for Qt Quick rendering.

◆ myGeodeRTT

osg::ref_ptr<osg::Geode> makVre::DtQtQuickRenderer::myGeodeRTT
protected

Render-to-texture OSG geode.

◆ myDrawableRTT

osg::ref_ptr<osg::Drawable> makVre::DtQtQuickRenderer::myDrawableRTT
protected

Render-to-texture OSG drawable.

◆ myQmlEngine

QQmlEngine* makVre::DtQtQuickRenderer::myQmlEngine
protected

QML engine for loading and rendering QML.

◆ myDefaultContext

osg::GraphicsContext* makVre::DtQtQuickRenderer::myDefaultContext
protected

Default graphics context.

◆ myRenderControlMap

RenderControlMap makVre::DtQtQuickRenderer::myRenderControlMap
protected

Map of graphics contexts to Qt Quick data.

◆ myUIsToLoadList

std::vector<DtQtQuickFileData*> makVre::DtQtQuickRenderer::myUIsToLoadList
protected

List of UIs waiting to be loaded.

◆ myUIsLoadedList

std::vector<DtQtQuickFileData*> makVre::DtQtQuickRenderer::myUIsLoadedList
protected

List of UIs that have been loaded.

◆ myConnections

makVrv::DtSignalConnectionManager makVre::DtQtQuickRenderer::myConnections
protected

Signal connection manager for Qt signals.

◆ myRenderTargetToSync

osg::Texture2D* makVre::DtQtQuickRenderer::myRenderTargetToSync
protected

Texture to synchronize for VR rendering.

◆ myQmlDebugMap

std::map<std::string, bool> makVre::DtQtQuickRenderer::myQmlDebugMap
protected

Debug map for QML event debugging.


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