VR-Engage  2.2
Loading...
Searching...
No Matches
vreQtQuickFileData.h
Go to the documentation of this file.
1/*********************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*********************************************************************************/
5
6#pragma once
7
8//! \file vreQtQuickFileData.h
9//! \ingroup vreQtQuickRenderer
10//! \brief Class for storing information about QML files in the render pipeline
11//!
12//! This class maintains data about QML files that are currently being rendered or
13//! are scheduled to be rendered. It tracks file paths, owners, target windows,
14//! render textures, and callback functions for QML loading.
15
17
18#include <functional>
19#include <string>
20
21#include <osg/Texture2D>
22
23class QObject;
24class QQuickItem;
25
26namespace makVre
27{
29
30//! \brief Container for QML file rendering data
31//!
32//! This class stores all the necessary information about a QML file to be rendered,
33//! including its target window, initialization function, file path, root item,
34//! and render-to-texture settings.
36{
37public:
38 //! \brief Default constructor
40
41 //! \brief Destructor
43
44 //! \brief Sets the target window name for rendering
45 //! \param windowName Name of the target window
46 virtual void setTargetWindow(const std::string& windowName);
47
48 //! \brief Gets the target window name
49 //! \return Reference to the target window name
50 virtual const std::string& getTargetWindow();
51
52 //! \brief Sets the document initialization function
53 //! \param func Callback function to be called when the QML file is loaded
54 virtual void setDocInitFunction(const std::function<void(QQuickItem*)>& func);
55
56 //! \brief Gets the document initialization function
57 //! \return Reference to the initialization function
58 virtual const std::function<void(QQuickItem*)>& getDocInitFunction();
59
60 //! \brief Sets the path of the QML file to load
61 //! \param filePath Path to the QML file
62 virtual void setFileToLoad(const std::string& filePath);
63
64 //! \brief Gets the path of the QML file to load
65 //! \return Reference to the file path
66 virtual const std::string& getFileToLoad();
67
68 //! \brief Sets the root QML item
69 //! \param root Pointer to the root QML item
70 virtual void setRoot(QQuickItem* root);
71
72 //! \brief Gets the root QML item
73 //! \return Pointer to the root QML item
74 virtual QQuickItem* getRoot();
75
76 //! \brief Sets the owner object
77 //! \param owner Pointer to the owner object
78 virtual void setOwner(QObject* owner);
79
80 //! \brief Gets the owner object
81 //! \return Pointer to the owner object
82 virtual QObject* getOwner();
83
84 //! \brief Sets the render-to-texture data
85 //! \param data Pointer to the per-window Qt Quick data
87
88 //! \brief Gets the render-to-texture data
89 //! \return Pointer to the per-window Qt Quick data
91
92 //! \brief Sets whether this is a render-to-texture target
93 //! \param isRTT True if this is a render-to-texture target, false otherwise
94 virtual void setRTTtarget(bool isRTT);
95
96 //! \brief Checks if this is a render-to-texture target
97 //! \return True if this is a render-to-texture target, false otherwise
98 virtual bool getRTTtarget();
99
100 //! \brief Sets the framebuffer size
101 //! \param w Width of the framebuffer in pixels
102 //! \param h Height of the framebuffer in pixels
103 virtual void setFboSize(int w, int h);
104
105 //! \brief Gets the framebuffer size
106 //! \param w Output parameter for the framebuffer width
107 //! \param h Output parameter for the framebuffer height
108 virtual void getFboSize(int& w, int& h);
109
110 //! \brief Gets the framebuffer width
111 //! \return Width of the framebuffer in pixels
112 virtual int getFboWidth();
113
114 //! \brief Gets the framebuffer height
115 //! \return Height of the framebuffer in pixels
116 virtual int getFboHeight();
117
118 //! \brief Sets the number of framebuffer samples for multisampling
119 //! \param samples Number of samples
120 virtual void setFboSamples(int samples);
121
122 //! \brief Gets the number of framebuffer samples
123 //! \return Number of samples for multisampling
124 virtual int getFboSamples();
125
126 //! \brief Sets the OSG render texture
127 //! \param texture Pointer to the OSG texture for rendering
128 virtual void setOsgRenderTexture(osg::Texture2D* texture);
129
130 //! \brief Gets the OSG render texture
131 //! \return Pointer to the OSG texture for rendering
132 virtual osg::Texture2D* getOsgRenderTexture();
133
134protected:
135 //! \brief Render-to-texture data for this file
137 //! \brief Owner object for this QML file
138 QObject* myOwner;
139 //! \brief Root QML item
140 QQuickItem* myRoot;
141 //! \brief Flag indicating if this is a render-to-texture target
143 //! \brief Number of samples for framebuffer multisampling
145 //! \brief Width of the framebuffer in pixels
147 //! \brief Height of the framebuffer in pixels
149 //! \brief OSG texture for rendering
150 osg::ref_ptr<osg::Texture2D> myOsgTarget;
151 //! \brief Document initialization function
152 std::function<void(QQuickItem*)> myDocInitFunction;
153
154 //! \brief Current warning messages
155 std::string myCurrentWarnings;
156 //! \brief Path to the QML file to load
157 std::string myFileToLoad;
158 //! \brief Name of the target window
159 std::string myTargetWindow;
160};
161
162} // namespace makVre
Container for per-window Qt Quick rendering data.
Definition vrePerWindowQtQuickData.h:41
int myFboSamples
Number of samples for framebuffer multisampling.
Definition vreQtQuickFileData.h:144
DtQtQuickFileData()
Default constructor.
virtual osg::Texture2D * getOsgRenderTexture()
Gets the OSG render texture.
virtual DtPerWindowQtQuickData * getRTTdata()
Gets the render-to-texture data.
bool myRTTtarget
Flag indicating if this is a render-to-texture target.
Definition vreQtQuickFileData.h:142
std::string myFileToLoad
Path to the QML file to load.
Definition vreQtQuickFileData.h:157
virtual void setOwner(QObject *owner)
Sets the owner object.
osg::ref_ptr< osg::Texture2D > myOsgTarget
OSG texture for rendering.
Definition vreQtQuickFileData.h:150
virtual void setFboSize(int w, int h)
Sets the framebuffer size.
QObject * myOwner
Owner object for this QML file.
Definition vreQtQuickFileData.h:138
virtual bool getRTTtarget()
Checks if this is a render-to-texture target.
virtual void setTargetWindow(const std::string &windowName)
Sets the target window name for rendering.
virtual int getFboHeight()
Gets the framebuffer height.
virtual void setRTTdata(DtPerWindowQtQuickData *data)
Sets the render-to-texture data.
virtual void setRTTtarget(bool isRTT)
Sets whether this is a render-to-texture target.
virtual int getFboWidth()
Gets the framebuffer width.
std::string myCurrentWarnings
Current warning messages.
Definition vreQtQuickFileData.h:155
virtual QObject * getOwner()
Gets the owner object.
virtual void getFboSize(int &w, int &h)
Gets the framebuffer size.
std::function< void(QQuickItem *)> myDocInitFunction
Document initialization function.
Definition vreQtQuickFileData.h:152
~DtQtQuickFileData()
Destructor.
virtual void setFboSamples(int samples)
Sets the number of framebuffer samples for multisampling.
virtual void setDocInitFunction(const std::function< void(QQuickItem *)> &func)
Sets the document initialization function.
virtual void setFileToLoad(const std::string &filePath)
Sets the path of the QML file to load.
int myFboHeight
Height of the framebuffer in pixels.
Definition vreQtQuickFileData.h:148
virtual int getFboSamples()
Gets the number of framebuffer samples.
virtual void setOsgRenderTexture(osg::Texture2D *texture)
Sets the OSG render texture.
DtPerWindowQtQuickData * myRTTdata
Render-to-texture data for this file.
Definition vreQtQuickFileData.h:136
virtual const std::function< void(QQuickItem *)> & getDocInitFunction()
Gets the document initialization function.
virtual QQuickItem * getRoot()
Gets the root QML item.
int myFboWidth
Width of the framebuffer in pixels.
Definition vreQtQuickFileData.h:146
virtual const std::string & getTargetWindow()
Gets the target window name.
std::string myTargetWindow
Name of the target window.
Definition vreQtQuickFileData.h:159
virtual const std::string & getFileToLoad()
Gets the path of the QML file to load.
virtual void setRoot(QQuickItem *root)
Sets the root QML item.
QQuickItem * myRoot
Root QML item.
Definition vreQtQuickFileData.h:140
Defines export macros for the VREngage Qt Quick Renderer library.
#define QTQUICKRENDERER_DLL
Export/import macro for non-Windows platforms.
Definition export.h:40
Include export definitions for this library.
Definition glsVreMessageUtil.h:49