summaryrefslogtreecommitdiffstats
path: root/src/render/framegraph
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/framegraph')
-rw-r--r--src/render/framegraph/blitframebuffer.cpp139
-rw-r--r--src/render/framegraph/blitframebuffer_p.h102
-rw-r--r--src/render/framegraph/framegraph.pri14
-rw-r--r--src/render/framegraph/framegraphnode_p.h24
-rw-r--r--src/render/framegraph/layerfilternode.cpp18
-rw-r--r--src/render/framegraph/layerfilternode_p.h6
-rw-r--r--src/render/framegraph/proximityfilter.cpp82
-rw-r--r--src/render/framegraph/proximityfilter_p.h90
-rw-r--r--src/render/framegraph/qblitframebuffer.cpp201
-rw-r--r--src/render/framegraph/qblitframebuffer.h111
-rw-r--r--src/render/framegraph/qblitframebuffer_p.h95
-rw-r--r--src/render/framegraph/qlayerfilter.cpp109
-rw-r--r--src/render/framegraph/qlayerfilter.h17
-rw-r--r--src/render/framegraph/qlayerfilter_p.h4
-rw-r--r--src/render/framegraph/qproximityfilter.cpp196
-rw-r--r--src/render/framegraph/qproximityfilter.h84
-rw-r--r--src/render/framegraph/qproximityfilter_p.h82
-rw-r--r--src/render/framegraph/qrendercapture.cpp32
-rw-r--r--src/render/framegraph/qrendercapture.h3
-rw-r--r--src/render/framegraph/qrendercapture_p.h7
-rw-r--r--src/render/framegraph/rendercapture.cpp19
-rw-r--r--src/render/framegraph/rendercapture_p.h9
-rw-r--r--src/render/framegraph/viewportnode_p.h2
23 files changed, 1392 insertions, 54 deletions
diff --git a/src/render/framegraph/blitframebuffer.cpp b/src/render/framegraph/blitframebuffer.cpp
new file mode 100644
index 000000000..70401e6d1
--- /dev/null
+++ b/src/render/framegraph/blitframebuffer.cpp
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DRender/private/qblitframebuffer_p.h>
+#include <Qt3DRender/private/blitframebuffer_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+BlitFramebuffer::BlitFramebuffer()
+ : FrameGraphNode(FrameGraphNode::BlitFramebuffer)
+ , m_sourceRenderTargetId(Qt3DCore::QNodeId())
+ , m_destinationRenderTargetId(Qt3DCore::QNodeId())
+ , m_sourceRect(QRect())
+ , m_destinationRect(QRect())
+ , m_sourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0)
+ , m_destinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0)
+ , m_interpolationMethod(Qt3DRender::QBlitFramebuffer::Linear)
+{
+}
+
+void BlitFramebuffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("sourceRenderTarget")) {
+ m_sourceRenderTargetId = propertyChange->value().value<QNodeId>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("destinationRenderTarget")) {
+ m_destinationRenderTargetId = propertyChange->value().value<QNodeId>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("sourceRect")) {
+ m_sourceRect = propertyChange->value().value<QRect>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("destinationRect")) {
+ m_destinationRect = propertyChange->value().value<QRect>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("sourceAttachmentPoint")) {
+ m_sourceAttachmentPoint = propertyChange->value().value<Qt3DRender::QRenderTargetOutput::AttachmentPoint>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("destinationAttachmentPoint")) {
+ m_destinationAttachmentPoint = propertyChange->value().value<Qt3DRender::QRenderTargetOutput::AttachmentPoint>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("interpolationMethod")) {
+ m_interpolationMethod = propertyChange->value().value<QBlitFramebuffer::InterpolationMethod>();
+ }
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ FrameGraphNode::sceneChangeEvent(e);
+}
+
+void BlitFramebuffer::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QBlitFramebufferData> >(change);
+ const auto &data = typedChange->data;
+ m_sourceRect = data.m_sourceRect;
+ m_destinationRect = data.m_destinationRect;
+ m_sourceRenderTargetId = data.m_sourceRenderTargetId;
+ m_destinationRenderTargetId = data.m_destinationRenderTargetId;
+ m_sourceAttachmentPoint = data.m_sourceAttachmentPoint;
+ m_destinationAttachmentPoint = data.m_destinationAttachmentPoint;
+ m_interpolationMethod = data.m_interpolationMethod;
+}
+
+Qt3DRender::QRenderTargetOutput::AttachmentPoint BlitFramebuffer::destinationAttachmentPoint() const
+{
+ return m_destinationAttachmentPoint;
+}
+
+QBlitFramebuffer::InterpolationMethod BlitFramebuffer::interpolationMethod() const
+{
+ return m_interpolationMethod;
+}
+
+Qt3DRender::QRenderTargetOutput::AttachmentPoint BlitFramebuffer::sourceAttachmentPoint() const
+{
+ return m_sourceAttachmentPoint;
+}
+
+QRect BlitFramebuffer::destinationRect() const
+{
+ return m_destinationRect;
+}
+
+QRect BlitFramebuffer::sourceRect() const
+{
+ return m_sourceRect;
+}
+
+Qt3DCore::QNodeId BlitFramebuffer::destinationRenderTargetId() const
+{
+ return m_destinationRenderTargetId;
+}
+
+Qt3DCore::QNodeId BlitFramebuffer::sourceRenderTargetId() const
+{
+ return m_sourceRenderTargetId;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/blitframebuffer_p.h b/src/render/framegraph/blitframebuffer_p.h
new file mode 100644
index 000000000..64800d0fa
--- /dev/null
+++ b/src/render/framegraph/blitframebuffer_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_BLITFRAMEBUFFER_P_H
+#define QT3DRENDER_RENDER_BLITFRAMEBUFFER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qblitframebuffer_p.h>
+#include <Qt3DRender/private/framegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Q_AUTOTEST_EXPORT BlitFramebuffer : public FrameGraphNode
+{
+public:
+ BlitFramebuffer();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ Qt3DCore::QNodeId sourceRenderTargetId() const;
+
+ Qt3DCore::QNodeId destinationRenderTargetId() const;
+
+ QRect sourceRect() const;
+
+ QRect destinationRect() const;
+
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint() const;
+
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint() const;
+
+ QBlitFramebuffer::InterpolationMethod interpolationMethod() const;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ Qt3DCore::QNodeId m_sourceRenderTargetId;
+ Qt3DCore::QNodeId m_destinationRenderTargetId;
+ QRect m_sourceRect;
+ QRect m_destinationRect;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint m_sourceAttachmentPoint;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint m_destinationAttachmentPoint;
+ QBlitFramebuffer::InterpolationMethod m_interpolationMethod;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_BLITFRAMEBUFFER_H
diff --git a/src/render/framegraph/framegraph.pri b/src/render/framegraph/framegraph.pri
index 5e9ce68bf..9784a193c 100644
--- a/src/render/framegraph/framegraph.pri
+++ b/src/render/framegraph/framegraph.pri
@@ -52,7 +52,13 @@ HEADERS += \
$$PWD/qframegraphnodecreatedchange_p.h \
$$PWD/qmemorybarrier.h \
$$PWD/qmemorybarrier_p.h \
- $$PWD/memorybarrier_p.h
+ $$PWD/memorybarrier_p.h \
+ $$PWD/qproximityfilter.h \
+ $$PWD/qproximityfilter_p.h \
+ $$PWD/proximityfilter_p.h \
+ $$PWD/qblitframebuffer.h \
+ $$PWD/qblitframebuffer_p.h \
+ $$PWD/blitframebuffer_p.h
SOURCES += \
$$PWD/cameraselectornode.cpp \
@@ -90,4 +96,8 @@ SOURCES += \
$$PWD/buffercapture.cpp \
$$PWD/qframegraphnodecreatedchange.cpp \
$$PWD/qmemorybarrier.cpp \
- $$PWD/memorybarrier.cpp
+ $$PWD/memorybarrier.cpp \
+ $$PWD/qproximityfilter.cpp \
+ $$PWD/proximityfilter.cpp \
+ $$PWD/qblitframebuffer.cpp \
+ $$PWD/blitframebuffer.cpp
diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h
index c7b399f89..843ad63a0 100644
--- a/src/render/framegraph/framegraphnode_p.h
+++ b/src/render/framegraph/framegraphnode_p.h
@@ -99,7 +99,9 @@ public:
Surface,
RenderCapture,
BufferCapture,
- MemoryBarrier
+ MemoryBarrier,
+ ProximityFilter,
+ BlitFramebuffer
};
FrameGraphNodeType nodeType() const { return m_nodeType; }
@@ -157,26 +159,6 @@ public:
}
protected:
- Backend *createBackendFrameGraphNode(Qt3DCore::QNode *n) const
- {
- Frontend *f = qobject_cast<Frontend *>(n);
- if (f != nullptr) {
- if (!m_manager->containsNode(n->id())) {
- Backend *backend = new Backend();
- backend->setFrameGraphManager(m_manager);
- backend->setPeer(f);
- backend->setRenderer(m_renderer);
- QFrameGraphNode *parentFGNode = static_cast<QFrameGraphNode *>(n)->parentFrameGraphNode();
- if (parentFGNode)
- backend->setParentId(parentFGNode->id());
- m_manager->appendNode(backend->peerId(), backend);
- return backend;
- }
- return static_cast<Backend *>(m_manager->lookupNode(n->id()));
- }
- return nullptr;
- }
-
Backend *createBackendFrameGraphNode(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
if (!m_manager->containsNode(change->subjectId())) {
diff --git a/src/render/framegraph/layerfilternode.cpp b/src/render/framegraph/layerfilternode.cpp
index 17693eb83..4b6842015 100644
--- a/src/render/framegraph/layerfilternode.cpp
+++ b/src/render/framegraph/layerfilternode.cpp
@@ -53,6 +53,7 @@ namespace Render {
LayerFilterNode::LayerFilterNode()
: FrameGraphNode(FrameGraphNode::LayerFilter)
+ , m_filterMode(QLayerFilter::AcceptAnyMatchingLayers)
{
}
@@ -62,6 +63,7 @@ void LayerFilterNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBaseP
const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QLayerFilterData>>(change);
const auto &data = typedChange->data;
setLayerIds(data.layerIds);
+ m_filterMode = data.filterMode;
}
void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
@@ -71,6 +73,7 @@ void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
if (change->propertyName() == QByteArrayLiteral("layer"))
m_layerIds.append(change->addedNodeId());
+ markDirty(AbstractRenderer::LayersDirty);
break;
}
@@ -78,13 +81,21 @@ void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
if (change->propertyName() == QByteArrayLiteral("layer"))
m_layerIds.removeOne(change->removedNodeId());
+ markDirty(AbstractRenderer::LayersDirty);
break;
}
+ case PropertyUpdated: {
+ const auto change = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("filterMode")) {
+ m_filterMode = static_cast<QLayerFilter::FilterMode>(change->value().value<int>());
+ break;
+ }
+ }
+
default:
break;
}
- markDirty(AbstractRenderer::AllDirty);
FrameGraphNode::sceneChangeEvent(e);
}
@@ -99,6 +110,11 @@ void LayerFilterNode::setLayerIds(const QNodeIdVector &list)
m_layerIds = list;
}
+QLayerFilter::FilterMode LayerFilterNode::filterMode() const
+{
+ return m_filterMode;
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/framegraph/layerfilternode_p.h b/src/render/framegraph/layerfilternode_p.h
index ef443dfd0..59e16c934 100644
--- a/src/render/framegraph/layerfilternode_p.h
+++ b/src/render/framegraph/layerfilternode_p.h
@@ -52,14 +52,13 @@
//
#include <Qt3DRender/private/framegraphnode_p.h>
+#include <Qt3DRender/QLayerFilter>
#include <QStringList>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QLayerFilter;
-
namespace Render {
class Renderer;
@@ -73,10 +72,13 @@ public:
Qt3DCore::QNodeIdVector layerIds() const;
void setLayerIds(const Qt3DCore::QNodeIdVector &list);
+ QLayerFilter::FilterMode filterMode() const;
+
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
Qt3DCore::QNodeIdVector m_layerIds;
+ QLayerFilter::FilterMode m_filterMode;
};
} // namespace Render
diff --git a/src/render/framegraph/proximityfilter.cpp b/src/render/framegraph/proximityfilter.cpp
new file mode 100644
index 000000000..aed19828b
--- /dev/null
+++ b/src/render/framegraph/proximityfilter.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "proximityfilter_p.h"
+#include <Qt3DRender/private/qproximityfilter_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+ProximityFilter::ProximityFilter()
+ : FrameGraphNode(FrameGraphNode::ProximityFilter)
+ , m_distanceThreshold(0.0f)
+{
+}
+
+void ProximityFilter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QProximityFilterData>>(change);
+ const QProximityFilterData &data = typedChange->data;
+ m_entityId = data.entityId;
+ m_distanceThreshold = data.distanceThreshold;
+}
+
+void ProximityFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ qCDebug(Render::Framegraph) << Q_FUNC_INFO;
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("entity"))
+ m_entityId = propertyChange->value().value<Qt3DCore::QNodeId>();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("distanceThreshold"))
+ m_distanceThreshold = propertyChange->value().toFloat();
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ FrameGraphNode::sceneChangeEvent(e);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/proximityfilter_p.h b/src/render/framegraph/proximityfilter_p.h
new file mode 100644
index 000000000..cfd6af805
--- /dev/null
+++ b/src/render/framegraph/proximityfilter_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_PROXIMITYFILTER_P_H
+#define QT3DRENDER_RENDER_PROXIMITYFILTER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/framegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Q_AUTOTEST_EXPORT ProximityFilter : public FrameGraphNode
+{
+public:
+ ProximityFilter();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ float distanceThreshold() const { return m_distanceThreshold; }
+ Qt3DCore::QNodeId entityId() const { return m_entityId; }
+
+#if defined(QT_BUILD_INTERNAL)
+ // For unit testing
+ void setDistanceThreshold(float distanceThreshold) { m_distanceThreshold = distanceThreshold; }
+ void setEntityId(Qt3DCore::QNodeId entityId) { m_entityId = entityId; }
+#endif
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ float m_distanceThreshold;
+ Qt3DCore::QNodeId m_entityId;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_PROXIMITYFILTER_P_H
diff --git a/src/render/framegraph/qblitframebuffer.cpp b/src/render/framegraph/qblitframebuffer.cpp
new file mode 100644
index 000000000..505bab96c
--- /dev/null
+++ b/src/render/framegraph/qblitframebuffer.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qblitframebuffer.h"
+#include "qblitframebuffer_p.h"
+
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DRender/qframegraphnodecreatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QBlitFramebufferPrivate::QBlitFramebufferPrivate()
+ : QFrameGraphNodePrivate()
+ , m_source(nullptr)
+ , m_destination(nullptr)
+ , m_sourceRect(QRect())
+ , m_destinationRect(QRect())
+ , m_sourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint::Color0)
+ , m_destinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint::Color0)
+ , m_interpolationMethod(QBlitFramebuffer::Linear)
+{
+}
+
+QBlitFramebuffer::QBlitFramebuffer(QNode *parent)
+ : QFrameGraphNode(*new QBlitFramebufferPrivate, parent)
+{
+
+}
+
+QBlitFramebuffer::QBlitFramebuffer(QBlitFramebufferPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+QBlitFramebuffer::~QBlitFramebuffer()
+{
+
+}
+
+QRenderTarget *QBlitFramebuffer::source() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_source;
+}
+
+QRenderTarget *QBlitFramebuffer::destination() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_destination;
+}
+
+QRectF QBlitFramebuffer::sourceRect() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_sourceRect;
+}
+
+QRectF QBlitFramebuffer::destinationRect() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_destinationRect;
+}
+
+Qt3DRender::QRenderTargetOutput::AttachmentPoint QBlitFramebuffer::sourceAttachmentPoint() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_sourceAttachmentPoint;
+}
+
+QRenderTargetOutput::AttachmentPoint QBlitFramebuffer::destinationAttachmentPoint() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_destinationAttachmentPoint;
+}
+
+QBlitFramebuffer::InterpolationMethod QBlitFramebuffer::interpolationMethod() const
+{
+ Q_D(const QBlitFramebuffer);
+ return d->m_interpolationMethod;
+}
+
+void QBlitFramebuffer::setSource(QRenderTarget *source)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_source != source) {
+ d->m_source = source;
+ emit sourceChanged();
+ }
+}
+
+void QBlitFramebuffer::setDestination(QRenderTarget *destination)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_destination != destination) {
+ d->m_destination = destination;
+ emit destinationChanged();
+ }
+}
+
+void QBlitFramebuffer::setSourceRect(const QRectF &inputRect)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_sourceRect != inputRect) {
+ d->m_sourceRect = inputRect.toRect();
+ emit sourceRectChanged();
+ }
+}
+
+void QBlitFramebuffer::setDestinationRect(const QRectF &outputRect)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_destinationRect != outputRect) {
+ d->m_destinationRect = outputRect.toRect();
+ emit destinationRectChanged();
+ }
+}
+
+void QBlitFramebuffer::setSourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_sourceAttachmentPoint != sourceAttachmentPoint) {
+ d->m_sourceAttachmentPoint = sourceAttachmentPoint;
+ emit sourceAttachmentPointChanged();
+ }
+}
+
+void QBlitFramebuffer::setDestinationAttachmentPoint(QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_destinationAttachmentPoint != destinationAttachmentPoint) {
+ d->m_destinationAttachmentPoint = destinationAttachmentPoint;
+ emit destinationAttachmentPointChanged();
+ }
+}
+
+void QBlitFramebuffer::setInterpolationMethod(QBlitFramebuffer::InterpolationMethod interpolationMethod)
+{
+ Q_D(QBlitFramebuffer);
+ if (d->m_interpolationMethod != interpolationMethod) {
+ d->m_interpolationMethod = interpolationMethod;
+ emit interpolationMethodChanged();
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QBlitFramebuffer::createNodeCreationChange() const
+{
+ auto creationChange = QFrameGraphNodeCreatedChangePtr<QBlitFramebufferData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QBlitFramebuffer);
+ data.m_sourceRect = d->m_sourceRect;
+ data.m_destinationRect = d->m_destinationRect;
+ data.m_sourceRenderTargetId = Qt3DCore::qIdForNode(d->m_source);
+ data.m_destinationRenderTargetId = Qt3DCore::qIdForNode(d->m_destination);
+ data.m_sourceAttachmentPoint = d->m_sourceAttachmentPoint;
+ data.m_destinationAttachmentPoint = d->m_destinationAttachmentPoint;
+ data.m_interpolationMethod = d->m_interpolationMethod;
+
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qblitframebuffer.h b/src/render/framegraph/qblitframebuffer.h
new file mode 100644
index 000000000..75ce4c23a
--- /dev/null
+++ b/src/render/framegraph/qblitframebuffer.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBLITFRAMEBUFFER_H
+#define QT3DRENDER_QBLITFRAMEBUFFER_H
+
+#include <Qt3DRender/qframegraphnode.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+#include <QRect>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QBlitFramebufferPrivate;
+class QRenderTarget;
+
+class QT3DRENDERSHARED_EXPORT QBlitFramebuffer : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QRenderTarget *source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(Qt3DRender::QRenderTarget *destination READ destination WRITE setDestination NOTIFY destinationChanged)
+ Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged)
+ Q_PROPERTY(QRectF destinationRect READ destinationRect WRITE setDestinationRect NOTIFY destinationRectChanged)
+ Q_PROPERTY(Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint READ sourceAttachmentPoint WRITE setSourceAttachmentPoint NOTIFY sourceAttachmentPointChanged)
+ Q_PROPERTY(Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint READ destinationAttachmentPoint WRITE setDestinationAttachmentPoint NOTIFY destinationAttachmentPointChanged)
+ Q_PROPERTY(InterpolationMethod interpolationMethod READ interpolationMethod WRITE setInterpolationMethod NOTIFY interpolationMethodChanged)
+public:
+ enum InterpolationMethod {
+ Nearest = 0,
+ Linear,
+ };
+ Q_ENUM(InterpolationMethod) // LCOV_EXCL_LINE
+
+ explicit QBlitFramebuffer(Qt3DCore::QNode *parent = nullptr);
+ ~QBlitFramebuffer();
+
+ QRenderTarget *source() const;
+ QRenderTarget *destination() const;
+ QRectF sourceRect() const;
+ QRectF destinationRect() const;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint() const;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint() const;
+ InterpolationMethod interpolationMethod() const;
+
+ void setSource(QRenderTarget *source);
+ void setDestination(QRenderTarget *destination);
+ void setSourceRect(const QRectF &sourceRect);
+ void setDestinationRect(const QRectF &destinationRect);
+ void setSourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint);
+ void setDestinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint);
+ void setInterpolationMethod(InterpolationMethod interpolationMethod);
+
+Q_SIGNALS:
+ void sourceChanged();
+ void destinationChanged();
+ void sourceRectChanged();
+ void destinationRectChanged();
+ void sourceAttachmentPointChanged();
+ void destinationAttachmentPointChanged();
+ void interpolationMethodChanged();
+
+protected:
+ explicit QBlitFramebuffer(QBlitFramebufferPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QBlitFramebuffer)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBLITFRAMEBUFFER_H
diff --git a/src/render/framegraph/qblitframebuffer_p.h b/src/render/framegraph/qblitframebuffer_p.h
new file mode 100644
index 000000000..8b5dc2165
--- /dev/null
+++ b/src/render/framegraph/qblitframebuffer_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBLITFRAMEBUFFER_P_H
+#define QT3DRENDER_QBLITFRAMEBUFFER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qframegraphnode_p.h>
+#include <Qt3DRender/qblitframebuffer.h>
+
+#include <Qt3DRender/QRenderTarget>
+#include <QRect>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QBlitFramebufferPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QBlitFramebufferPrivate();
+
+ QRenderTarget *m_source;
+ QRenderTarget *m_destination;
+ QRect m_sourceRect;
+ QRect m_destinationRect;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint m_sourceAttachmentPoint;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint m_destinationAttachmentPoint;
+ QBlitFramebuffer::InterpolationMethod m_interpolationMethod;
+
+ Q_DECLARE_PUBLIC(QBlitFramebuffer)
+};
+
+struct QBlitFramebufferData
+{
+ Qt3DCore::QNodeId m_sourceRenderTargetId;
+ Qt3DCore::QNodeId m_destinationRenderTargetId;
+ QRect m_sourceRect;
+ QRect m_destinationRect;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint m_sourceAttachmentPoint;
+ Qt3DRender::QRenderTargetOutput::AttachmentPoint m_destinationAttachmentPoint;
+ QBlitFramebuffer::InterpolationMethod m_interpolationMethod;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBLITFRAMEBUFFER_P_H
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
index 2d4653fcb..04ebca572 100644
--- a/src/render/framegraph/qlayerfilter.cpp
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -51,6 +51,7 @@ namespace Qt3DRender {
QLayerFilterPrivate::QLayerFilterPrivate()
: QFrameGraphNodePrivate()
+ , m_filterMode(QLayerFilter::AcceptAnyMatchingLayers)
{
}
@@ -58,12 +59,55 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\class Qt3DRender::QLayerFilter
\inmodule Qt3DRender
\since 5.5
- \brief Controls layers Drawn in a frame graph branch.
+ \brief Controls layers drawn in a frame graph branch.
- A Qt3DRender::QLayerFilter can be used to instruct the renderer as to which layer(s)
- to draw in that branch of the frame graph. The Qt3DRender::QLayerFilter selects which
- entities to draw based on the Qt3DRender::QLayer instances added to the QLayerFilter
- and as components to the \l Qt3DCore::QEntity.
+ A Qt3DRender::QLayerFilter can be used to instruct the renderer as to
+ which layer(s) to draw in that branch of the frame graph. QLayerFilter
+ selects which entities to draw based on the QLayer instance(s) added to
+ the QLayerFilter and as components to Qt3DCore::QEntity.
+
+ QLayerFilter can be configured to select or discard entities with a
+ specific \l QLayer depending on the filterMode property. By default,
+ entities referencing one of the \l QLayer objects that are also being
+ referenced by the \l QLayerFilter are selected (AcceptAnyMatchingLayers).
+
+ Within the FrameGraph tree, multiple \l QLayerFilter nodes can be nested
+ within a branch going from root to a leaf. In that case the filtering will
+ first operate on all entities of the scene using the filtering method
+ specified by the first declared \l QLayerFilter. Then the filtered subset
+ of entities will be filtered again based on the filtering method set on the
+ second \l QLayerFilter declared. This is then repeated until all \l
+ QLayerFilter nodes of the branch have been consumed.
+*/
+
+/*!
+ \enum QLayerFilter::FilterMode
+
+ Specifies the rules for selecting entities to draw.
+
+ \value AcceptAnyMatchingLayers
+ Accept entities that reference one or more \l QLayer objects added to this
+ QLayerFilter. This is the default
+
+ \value AcceptAllMatchingLayers
+ Accept entities that reference all the \l QLayer objects added to this
+ QLayerFilter
+
+ \value DiscardAnyMatchingLayers
+ Discard entities that reference one or more \l QLayer objects added to this
+ QLayerFilter
+
+ \value DiscardAllMatchingLayers
+ Discard entities that reference all \l QLayer objects added to this
+ QLayerFilter
+*/
+
+/*!
+ \property Qt3DRender::QLayerFilter::filterMode
+
+ Holds the filter mode specifying the entities to select for drawing.
+
+ The default value is AcceptMatchingLayers.
*/
/*!
@@ -72,12 +116,25 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\inherits FrameGraphNode
\inqmlmodule Qt3D.Render
\since 5.5
- \brief Controls layers Drawn in a frame graph branch.
+ \brief Controls layers drawn in a frame graph branch.
A LayerFilter can be used to instruct the renderer as to which layer(s)
to draw in that branch of the frame graph. The LayerFilter selects which
entities to draw based on the \l Layer instances added to the LayerFilter
and as components to the \l Entity.
+
+ The LayerFilter can be configured to select or discard entities with a
+ specific \l Layer depending on the filterMode property. By default,
+ entities referencing one of the \l Layer objects that are also being
+ referenced by the \l LayerFilter are selected (AcceptAnyMatchingLayers).
+
+ Within the FrameGraph tree, multiple \l LayerFilter nodes can be nested
+ within a branch going from root to a leaf. In that case the filtering will
+ first operate on all entities of the scene using the filtering method
+ specified by the first declared \l LayerFilter. Then the filtered subset of
+ entities will be filtered again based on the filtering method set on the
+ second \l LayerFilter declared. This is then repeated until all \l
+ LayerFilter nodes of the branch have been consumed.
*/
/*!
@@ -87,6 +144,30 @@ QLayerFilterPrivate::QLayerFilterPrivate()
*/
/*!
+ \qmlproperty enumeration Qt3DRender::LayerFilter::filterMode
+
+ Holds the filter mode specifying the entities to select for drawing.
+
+ The default value is \c {LayerFilter.AcceptMatchingLayers}.
+
+ \value LayerFilter.AcceptAnyMatchingLayers
+ Accept entities that reference one or more \l Layer objects added to this
+ LayerFilter. This is the default
+
+ \value LayerFilter.AcceptAllMatchingLayers
+ Accept entities that reference all the \l Layer objects added to this
+ LayerFilter
+
+ \value LayerFilter.DiscardAnyMatchingLayers
+ Discard entities that reference one or more \l Layer objects added to this
+ LayerFilter
+
+ \value LayerFilter.DiscardAllMatchingLayers
+ Discard entities that reference all \l Layer objects added to this
+ LayerFilter
+*/
+
+/*!
The constructor creates an instance with the specified \a parent.
*/
QLayerFilter::QLayerFilter(QNode *parent)
@@ -159,12 +240,28 @@ QVector<QLayer *> QLayerFilter::layers() const
return d->m_layers;
}
+QLayerFilter::FilterMode QLayerFilter::filterMode() const
+{
+ Q_D(const QLayerFilter);
+ return d->m_filterMode;
+}
+
+void QLayerFilter::setFilterMode(QLayerFilter::FilterMode filterMode)
+{
+ Q_D(QLayerFilter);
+ if (d->m_filterMode != filterMode) {
+ d->m_filterMode = filterMode;
+ emit filterModeChanged(filterMode);
+ }
+}
+
Qt3DCore::QNodeCreatedChangeBasePtr QLayerFilter::createNodeCreationChange() const
{
auto creationChange = QFrameGraphNodeCreatedChangePtr<QLayerFilterData>::create(this);
auto &data = creationChange->data;
Q_D(const QLayerFilter);
data.layerIds = qIdsForNodes(d->m_layers);
+ data.filterMode = d->m_filterMode;
return creationChange;
}
diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h
index 61eac5773..68854c722 100644
--- a/src/render/framegraph/qlayerfilter.h
+++ b/src/render/framegraph/qlayerfilter.h
@@ -53,7 +53,17 @@ class QLayerFilterPrivate;
class QT3DRENDERSHARED_EXPORT QLayerFilter : public QFrameGraphNode
{
Q_OBJECT
+ Q_PROPERTY(FilterMode filterMode READ filterMode WRITE setFilterMode NOTIFY filterModeChanged)
public:
+ enum FilterMode
+ {
+ AcceptAnyMatchingLayers = 0,
+ AcceptAllMatchingLayers,
+ DiscardAnyMatchingLayers,
+ DiscardAllMatchingLayers,
+ };
+ Q_ENUM(FilterMode) // LOVC_EXLC_LINE
+
explicit QLayerFilter(Qt3DCore::QNode *parent = nullptr);
~QLayerFilter();
@@ -61,6 +71,13 @@ public:
void removeLayer(QLayer *layer);
QVector<QLayer *> layers() const;
+ FilterMode filterMode() const;
+ void setFilterMode(FilterMode filterMode);
+
+Q_SIGNALS:
+ void filterModeChanged(FilterMode filterMode);
+
+
protected:
explicit QLayerFilter(QLayerFilterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
diff --git a/src/render/framegraph/qlayerfilter_p.h b/src/render/framegraph/qlayerfilter_p.h
index 8ad7d3301..97469bda0 100644
--- a/src/render/framegraph/qlayerfilter_p.h
+++ b/src/render/framegraph/qlayerfilter_p.h
@@ -52,13 +52,13 @@
//
#include <private/qframegraphnode_p.h>
+#include <Qt3DRender/qlayerfilter.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QLayer;
-class QLayerFilter;
class QLayerFilterPrivate : public QFrameGraphNodePrivate
{
@@ -67,11 +67,13 @@ public:
Q_DECLARE_PUBLIC(QLayerFilter)
QVector<QLayer*> m_layers;
+ QLayerFilter::FilterMode m_filterMode;
};
struct QLayerFilterData
{
Qt3DCore::QNodeIdVector layerIds;
+ QLayerFilter::FilterMode filterMode;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qproximityfilter.cpp b/src/render/framegraph/qproximityfilter.cpp
new file mode 100644
index 000000000..cd1ecf776
--- /dev/null
+++ b/src/render/framegraph/qproximityfilter.cpp
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qproximityfilter.h"
+#include "qproximityfilter_p.h"
+#include <Qt3DCore/qentity.h>
+#include <Qt3DRender/qframegraphnodecreatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QProximityFilterPrivate::QProximityFilterPrivate()
+ : QFrameGraphNodePrivate()
+ , m_entity(nullptr)
+ , m_distanceThreshold(0.0f)
+{
+}
+
+/*!
+ \class Qt3DRender::QProximityFilter
+ \inmodule Qt3DRender
+ \since 5.10
+
+ \brief Select entities which are within a distance threshold of a target
+ entity.
+
+ A \l Qt3DRender::QProximityFilter can be used to select entities to render
+ when they are placed within a given distance threshold of another entity.
+*/
+
+/*!
+ \property Qt3DRender::QProximityFilter::entity
+
+ Holds the entity against which we should compare the distance to.
+*/
+
+/*!
+ \property Qt3DRender::QProximityFilter::distanceThreshold
+
+ Holds the distance to the target entity above which entities are filtered
+ out.
+*/
+
+/*!
+ \qmltype ProximityFilter
+ \instantiates Qt3DRender::QProximityFilter
+ \inherits FrameGraphNode
+ \inqmlmodule Qt3D.Render
+ \since 5.10
+
+ \brief Select entities which are within a distance threshold of a target
+ entity.
+
+ A \l ProximityFilter can be used to select entities to render
+ when they are placed within a given distance threshold of another entity.
+
+ \badcode
+ import Qt3DRender 2.10
+ ...
+ RenderSetting {
+ Viewport {
+ CameraSelector {
+ camera: mainCamera
+ ProximityFilter {
+ entity: mainCamera
+ distanceThreshold: 50 // select entities within 50m metre radius of mainCamera
+ }
+ }
+ }
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty Entity Qt3D.Render::ProximityFilter::entity
+
+ Holds the entity against which we should compare the distance to.
+ */
+
+/*!
+ \qmlproperty real Qt3D.Render::ProximityFilter::distanceThreshold
+
+ Holds the distance to the target entity above which entities are filtered
+ out.
+ */
+
+
+QProximityFilter::QProximityFilter(Qt3DCore::QNode *parent)
+ : QFrameGraphNode(*new QProximityFilterPrivate, parent)
+{
+
+}
+
+/*! \internal */
+QProximityFilter::QProximityFilter(QProximityFilterPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+/*! \internal */
+QProximityFilter::~QProximityFilter()
+{
+}
+
+Qt3DCore::QEntity *QProximityFilter::entity() const
+{
+ Q_D(const QProximityFilter);
+ return d->m_entity;
+}
+
+float QProximityFilter::distanceThreshold() const
+{
+ Q_D(const QProximityFilter);
+ return d->m_distanceThreshold;
+}
+
+void QProximityFilter::setEntity(Qt3DCore::QEntity *entity)
+{
+ Q_D(QProximityFilter);
+ if (d->m_entity != entity) {
+
+ if (d->m_entity)
+ d->unregisterDestructionHelper(d->m_entity);
+
+ if (entity && !entity->parent())
+ entity->setParent(this);
+
+ d->m_entity = entity;
+
+ if (d->m_entity)
+ d->registerDestructionHelper(d->m_entity, &QProximityFilter::setEntity, d->m_entity);
+
+ emit entityChanged(entity);
+ }
+}
+
+void QProximityFilter::setDistanceThreshold(float distanceThreshold)
+{
+ Q_D(QProximityFilter);
+ if (d->m_distanceThreshold == distanceThreshold)
+ return;
+
+ d->m_distanceThreshold = distanceThreshold;
+ emit distanceThresholdChanged(distanceThreshold);
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QProximityFilter::createNodeCreationChange() const
+{
+ auto creationChange = QFrameGraphNodeCreatedChangePtr<QProximityFilterData>::create(this);
+ QProximityFilterData &data = creationChange->data;
+ Q_D(const QProximityFilter);
+ data.entityId = Qt3DCore::qIdForNode(d->m_entity);
+ data.distanceThreshold = d->m_distanceThreshold;
+ return creationChange;
+}
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qproximityfilter.h b/src/render/framegraph/qproximityfilter.h
new file mode 100644
index 000000000..0fbe624a1
--- /dev/null
+++ b/src/render/framegraph/qproximityfilter.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPROXIMITYFILTER_H
+#define QT3DRENDER_QPROXIMITYFILTER_H
+
+#include <Qt3DRender/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QProximityFilterPrivate;
+
+class QT3DRENDERSHARED_EXPORT QProximityFilter : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DCore::QEntity *entity READ entity WRITE setEntity NOTIFY entityChanged)
+ Q_PROPERTY(float distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
+
+public:
+ explicit QProximityFilter(Qt3DCore::QNode *parent = nullptr);
+ ~QProximityFilter();
+
+ Qt3DCore::QEntity *entity() const;
+ float distanceThreshold() const;
+
+public Q_SLOTS:
+ void setEntity(Qt3DCore::QEntity *entity);
+ void setDistanceThreshold(float distanceThreshold);
+
+Q_SIGNALS:
+ void entityChanged(Qt3DCore::QEntity *entity);
+ void distanceThresholdChanged(float distanceThreshold);
+
+protected:
+ explicit QProximityFilter(QProximityFilterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QProximityFilter)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPROXIMITYFILTER_H
diff --git a/src/render/framegraph/qproximityfilter_p.h b/src/render/framegraph/qproximityfilter_p.h
new file mode 100644
index 000000000..8f8bba800
--- /dev/null
+++ b/src/render/framegraph/qproximityfilter_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPROXIMITYFILTER_P_H
+#define QT3DRENDER_QPROXIMITYFILTER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/qproximityfilter.h>
+#include <Qt3DRender/private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QProximityFilterPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QProximityFilterPrivate();
+
+ Q_DECLARE_PUBLIC(QProximityFilter)
+
+ Qt3DCore::QEntity *m_entity;
+ float m_distanceThreshold;
+};
+
+struct QProximityFilterData
+{
+ Qt3DCore::QNodeId entityId;
+ float distanceThreshold;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPROXIMITYFILTER_P_H
diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp
index 8ae97b8f0..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()
@@ -322,19 +331,20 @@ QRenderCaptureReply *QRenderCapture::requestCapture(int captureId)
Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(id()));
change->setPropertyName(QByteArrayLiteral("renderCaptureRequest"));
- change->setValue(QVariant::fromValue(captureId));
+ const QRenderCaptureRequest request = { captureId, QRect() };
+ change->setValue(QVariant::fromValue(request));
d->notifyObservers(change);
return reply;
}
/*!
- * 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.
*/
-QRenderCaptureReply *QRenderCapture::requestCapture()
+QRenderCaptureReply *QRenderCapture::requestCapture(const QRect &rect)
{
Q_D(QRenderCapture);
static int captureId = 1;
@@ -346,7 +356,8 @@ QRenderCaptureReply *QRenderCapture::requestCapture()
Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(id()));
change->setPropertyName(QByteArrayLiteral("renderCaptureRequest"));
- change->setValue(QVariant::fromValue(captureId));
+ const QRenderCaptureRequest request = { captureId, rect };
+ change->setValue(QVariant::fromValue(request));
d->notifyObservers(change);
captureId++;
@@ -355,6 +366,17 @@ QRenderCaptureReply *QRenderCapture::requestCapture()
}
/*!
+ * 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 5b768b593..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")
+ 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/framegraph/qrendercapture_p.h b/src/render/framegraph/qrendercapture_p.h
index c8253947d..4e509cc59 100644
--- a/src/render/framegraph/qrendercapture_p.h
+++ b/src/render/framegraph/qrendercapture_p.h
@@ -100,10 +100,17 @@ struct RenderCaptureData
typedef QSharedPointer<RenderCaptureData> RenderCaptureDataPtr;
+struct QRenderCaptureRequest
+{
+ int captureId;
+ QRect rect;
+};
+
} // Qt3DRender
QT_END_NAMESPACE
Q_DECLARE_METATYPE(Qt3DRender::RenderCaptureDataPtr) // LCOV_EXCL_LINE
+Q_DECLARE_METATYPE(Qt3DRender::QRenderCaptureRequest); // LCOV_EXCL_LINE
#endif // QRENDERCAPTURE_P_H
diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp
index 52319fa41..d25a01b1f 100644
--- a/src/render/framegraph/rendercapture.cpp
+++ b/src/render/framegraph/rendercapture.cpp
@@ -50,23 +50,24 @@ RenderCapture::RenderCapture()
}
-// called by aspect thread
-void RenderCapture::requestCapture(int captureId)
+void RenderCapture::requestCapture(const QRenderCaptureRequest &request)
{
QMutexLocker lock(&m_mutex);
- m_requestedCaptures.push_back(captureId);
+ m_requestedCaptures.push_back(request);
}
+// called by render view initializer job
bool RenderCapture::wasCaptureRequested() const
{
QMutexLocker lock(&m_mutex);
return m_requestedCaptures.size() > 0 && isEnabled();
}
-void RenderCapture::acknowledgeCaptureRequest()
+// called by render view initializer job
+QRenderCaptureRequest RenderCapture::takeCaptureRequest()
{
- QMutexLocker lock(&m_mutex);
- m_acknowledgedCaptures.push_back(m_requestedCaptures.takeFirst());
+ Q_ASSERT(!m_requestedCaptures.isEmpty());
+ return m_requestedCaptures.takeFirst();
}
void RenderCapture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
@@ -74,18 +75,18 @@ void RenderCapture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
if (e->type() == Qt3DCore::PropertyUpdated) {
Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("renderCaptureRequest")) {
- requestCapture(propertyChange->value().toInt());
+ requestCapture(propertyChange->value().value<QRenderCaptureRequest>());
}
}
FrameGraphNode::sceneChangeEvent(e);
}
// called by render thread
-void RenderCapture::addRenderCapture(const QImage &image)
+void RenderCapture::addRenderCapture(int captureId, const QImage &image)
{
QMutexLocker lock(&m_mutex);
auto data = RenderCaptureDataPtr::create();
- data.data()->captureId = m_acknowledgedCaptures.takeFirst();
+ data.data()->captureId = captureId;
data.data()->image = image;
m_renderCaptureData.push_back(data);
}
diff --git a/src/render/framegraph/rendercapture_p.h b/src/render/framegraph/rendercapture_p.h
index 7a759e5b8..8c9f4a31d 100644
--- a/src/render/framegraph/rendercapture_p.h
+++ b/src/render/framegraph/rendercapture_p.h
@@ -62,10 +62,10 @@ class Q_AUTOTEST_EXPORT RenderCapture : public FrameGraphNode
public:
RenderCapture();
- void requestCapture(int captureId);
+ void requestCapture(const QRenderCaptureRequest &request);
bool wasCaptureRequested() const;
- void acknowledgeCaptureRequest();
- void addRenderCapture(const QImage &image);
+ QRenderCaptureRequest takeCaptureRequest();
+ void addRenderCapture(int captureId, const QImage &image);
void sendRenderCaptures();
protected:
@@ -73,8 +73,7 @@ protected:
private:
- QVector<int> m_requestedCaptures;
- QVector<int> m_acknowledgedCaptures;
+ QVector<QRenderCaptureRequest> m_requestedCaptures;
QVector<RenderCaptureDataPtr> m_renderCaptureData;
mutable QMutex m_mutex;
};
diff --git a/src/render/framegraph/viewportnode_p.h b/src/render/framegraph/viewportnode_p.h
index 85003ff36..18adc3f0c 100644
--- a/src/render/framegraph/viewportnode_p.h
+++ b/src/render/framegraph/viewportnode_p.h
@@ -64,7 +64,7 @@ namespace Render {
class Renderer;
-class ViewportNode : public FrameGraphNode
+class Q_AUTOTEST_EXPORT ViewportNode : public FrameGraphNode
{
public:
ViewportNode();