diff options
-rw-r--r-- | src/extras/defaults/qforwardrenderer.cpp | 9 | ||||
-rw-r--r-- | src/extras/defaults/qt3dwindow.cpp | 9 | ||||
-rw-r--r-- | src/render/framegraph/qrendercapture.cpp | 28 | ||||
-rw-r--r-- | src/render/framegraph/qrendercapture.h | 7 | ||||
-rw-r--r-- | src/render/materialsystem/shaderbuilder.cpp | 8 |
5 files changed, 54 insertions, 7 deletions
diff --git a/src/extras/defaults/qforwardrenderer.cpp b/src/extras/defaults/qforwardrenderer.cpp index f3137ea2d..b02077298 100644 --- a/src/extras/defaults/qforwardrenderer.cpp +++ b/src/extras/defaults/qforwardrenderer.cpp @@ -48,6 +48,13 @@ #include <Qt3DRender/qfrustumculling.h> #include <Qt3DRender/qrendersurfaceselector.h> +static void initResources() +{ +#ifdef QT_STATIC + Q_INIT_RESOURCE(extras); +#endif +} + QT_BEGIN_NAMESPACE using namespace Qt3DRender; @@ -68,6 +75,8 @@ void QForwardRendererPrivate::init() { Q_Q(QForwardRenderer); + initResources(); + m_frustumCulling->setParent(m_clearBuffer); m_clearBuffer->setParent(m_cameraSelector); m_cameraSelector->setParent(m_viewport); diff --git a/src/extras/defaults/qt3dwindow.cpp b/src/extras/defaults/qt3dwindow.cpp index baa2aeddb..12e210f0d 100644 --- a/src/extras/defaults/qt3dwindow.cpp +++ b/src/extras/defaults/qt3dwindow.cpp @@ -62,6 +62,13 @@ #include <Qt3DRender/qcamera.h> #include <QtGui/qopenglcontext.h> +static void initResources() +{ +#ifdef QT_STATIC + Q_INIT_RESOURCE(extras); +#endif +} + QT_BEGIN_NAMESPACE namespace Qt3DExtras { @@ -86,6 +93,8 @@ Qt3DWindow::Qt3DWindow(QScreen *screen) { Q_D(Qt3DWindow); + initResources(); + if (!d->parentWindow) d->connectToScreen(screen ? screen : d->topLevelScreen.data()); diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp index 66c518506..28bc41b91 100644 --- a/src/render/framegraph/qrendercapture.cpp +++ b/src/render/framegraph/qrendercapture.cpp @@ -149,6 +149,15 @@ namespace Qt3DRender { */ /*! + * \qmlmethod RenderCaptureReply Qt3D.Render::RenderCapture::requestCapture(Rect rect) + * + * Used to request render capture from a specified \a rect. Only one render capture + * result is produced per requestCapture call even if the frame graph has multiple leaf nodes. + * The function returns a QRenderCaptureReply object, which receives the captured image + * when it is done. The user is responsible for deallocating the returned object. + */ + +/*! * \internal */ QRenderCaptureReplyPrivate::QRenderCaptureReplyPrivate() @@ -311,7 +320,7 @@ QRenderCapture::QRenderCapture(Qt3DCore::QNode *parent) * The function returns a QRenderCaptureReply object, which receives the captured image * when it is done. The user is responsible for deallocating the returned object. */ -QRenderCaptureReply *QRenderCapture::requestCapture(int captureId, const QRect &rect) +QRenderCaptureReply *QRenderCapture::requestCapture(int captureId) { Q_D(QRenderCapture); QRenderCaptureReply *reply = d->createReply(captureId); @@ -322,7 +331,7 @@ QRenderCaptureReply *QRenderCapture::requestCapture(int captureId, const QRect & Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(id())); change->setPropertyName(QByteArrayLiteral("renderCaptureRequest")); - const QRenderCaptureRequest request = { captureId, rect }; + const QRenderCaptureRequest request = { captureId, QRect() }; change->setValue(QVariant::fromValue(request)); d->notifyObservers(change); @@ -330,8 +339,8 @@ QRenderCaptureReply *QRenderCapture::requestCapture(int captureId, const QRect & } /*! - * Used to request render capture. Only one render capture result is produced per - * requestCapture call even if the frame graph has multiple leaf nodes. + * Used to request render capture from a specified \a rect. Only one render capture result + * is produced per requestCapture call even if the frame graph has multiple leaf nodes. * The function returns a QRenderCaptureReply object, which receives the captured image * when it is done. The user is responsible for deallocating the returned object. */ @@ -357,6 +366,17 @@ QRenderCaptureReply *QRenderCapture::requestCapture(const QRect &rect) } /*! + * Used to request render capture. Only one render capture result is produced per + * requestCapture call even if the frame graph has multiple leaf nodes. + * The function returns a QRenderCaptureReply object, which receives the captured image + * when it is done. The user is responsible for deallocating the returned object. + */ +Qt3DRender::QRenderCaptureReply *QRenderCapture::requestCapture() +{ + return requestCapture(QRect()); +} + +/*! * \internal */ void QRenderCapture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) diff --git a/src/render/framegraph/qrendercapture.h b/src/render/framegraph/qrendercapture.h index c18b16170..b3545a8ec 100644 --- a/src/render/framegraph/qrendercapture.h +++ b/src/render/framegraph/qrendercapture.h @@ -84,9 +84,10 @@ class QT3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode public: explicit QRenderCapture(Qt3DCore::QNode *parent = nullptr); - Q_INVOKABLE Q_DECL_DEPRECATED_X("Use the overload with no parameter") - Qt3DRender::QRenderCaptureReply *requestCapture(int captureId, const QRect &rect = QRect()); - Q_REVISION(9) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(const QRect &rect = QRect()); + Q_INVOKABLE Q_DECL_DEPRECATED_X("Use the overload with no id parameter") + Qt3DRender::QRenderCaptureReply *requestCapture(int captureId); + Q_REVISION(9) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(); + Q_REVISION(10) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(const QRect &rect); protected: void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE; diff --git a/src/render/materialsystem/shaderbuilder.cpp b/src/render/materialsystem/shaderbuilder.cpp index c2b32ce86..da1e6a713 100644 --- a/src/render/materialsystem/shaderbuilder.cpp +++ b/src/render/materialsystem/shaderbuilder.cpp @@ -51,6 +51,13 @@ #include <QFileInfo> #include <QUrl> +static void initResources() +{ +#ifdef QT_STATIC + Q_INIT_RESOURCE(materialsystem); +#endif +} + QT_BEGIN_NAMESPACE class GlobalShaderPrototypes @@ -58,6 +65,7 @@ class GlobalShaderPrototypes public: GlobalShaderPrototypes() { + initResources(); setPrototypesFile(QStringLiteral(":/prototypes/default.json")); } |