summaryrefslogtreecommitdiffstats
path: root/src/render/frontend
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-08-14 09:23:05 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-08-14 09:41:21 +0100
commit9a18925b63d47a20d7b74cfd508d7ae71f2d4d7c (patch)
tree4d0d0538b9475a9104d56ee3d07f4bab7b0e00b4 /src/render/frontend
parent9a1c0c96246126d2377bd56ed702f47214e3ee0a (diff)
parent71eee85093ba807f5bc2add472b359841faa062d (diff)
Merge branch '5.7' into dev
Diffstat (limited to 'src/render/frontend')
-rw-r--r--src/render/frontend/qboundingvolumedebug.cpp182
-rw-r--r--src/render/frontend/qboundingvolumedebug_p.h98
-rw-r--r--src/render/frontend/qlayer.cpp76
-rw-r--r--src/render/frontend/qrenderaspect.cpp6
-rw-r--r--src/render/frontend/render-frontend.pri2
5 files changed, 77 insertions, 287 deletions
diff --git a/src/render/frontend/qboundingvolumedebug.cpp b/src/render/frontend/qboundingvolumedebug.cpp
deleted file mode 100644
index 4ee6816d6..000000000
--- a/src/render/frontend/qboundingvolumedebug.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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$
-**
-****************************************************************************/
-
-#if 0
-
-#include "qboundingvolumedebug_p.h"
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/private/qcomponent_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DRender/qspheremesh.h>
-#include <Qt3DCore/qtransform.h>
-#include <Qt3DRender/qphongalphamaterial.h>
-#include <Qt3DRender/qlayer.h>
-#include <QThread>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QBoundingVolumeDebugPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QBoundingVolumeDebugPrivate()
- : QComponentPrivate()
- , m_recursive(false)
- , m_debugSubtree(nullptr)
- , m_sphereMesh(nullptr)
- , m_transform(nullptr)
- , m_material(nullptr)
- , m_layer(nullptr)
- , m_bvRadius(0.0f)
- {
- m_shareable = false;
- }
-
- Q_DECLARE_PUBLIC(QBoundingVolumeDebug)
-
- bool m_recursive;
- Qt3DCore::QEntity *m_debugSubtree;
- Qt3DRender::QSphereMesh *m_sphereMesh;
- Qt3DCore::QTransform *m_transform;
- Qt3DRender::QMaterial *m_material;
- Qt3DRender::QLayer *m_layer;
-
- float m_bvRadius;
- QVector3D m_bvCenter;
-
- Qt3DCore::QEntity *findRootEntity(Qt3DCore::QEntity *e);
- void updateSubtree();
-};
-
-QBoundingVolumeDebug::QBoundingVolumeDebug(Qt3DCore::QNode *parent)
- : QComponent(*new QBoundingVolumeDebugPrivate(), parent)
-{
-}
-
-QBoundingVolumeDebug::~QBoundingVolumeDebug()
-{
- QComponent::cleanup();
-}
-
-void QBoundingVolumeDebug::setRecursive(bool recursive)
-{
- Q_D(QBoundingVolumeDebug);
- if (d->m_recursive != recursive) {
- d->m_recursive = recursive;
- emit recursiveChanged(recursive);
- }
-}
-
-bool QBoundingVolumeDebug::recursive() const
-{
- Q_D(const QBoundingVolumeDebug);
- return d->m_recursive;
-}
-
-void QBoundingVolumeDebug::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- Q_D(QBoundingVolumeDebug);
- Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
- if (e->type() == Qt3DCore::PropertyUpdated) {
- if (e->propertyName() == QByteArrayLiteral("center")) {
- d->m_bvCenter = e->value().value<QVector3D>();
- d->updateSubtree();
- } else if (e->propertyName() == QByteArrayLiteral("radius")) {
- d->m_bvRadius = e->value().toFloat();
- d->updateSubtree();
- }
- }
-}
-
-// Executed in the frontend thread
-Qt3DCore::QEntity *QBoundingVolumeDebugPrivate::findRootEntity(Qt3DCore::QEntity *e)
-{
- Qt3DCore::QEntity *tmp = nullptr;
- Qt3DCore::QEntity *parentEntity = nullptr;
- while (e && (tmp = e->parentEntity()) != nullptr) {
- parentEntity = tmp;
- e = parentEntity;
- }
- return parentEntity;
-}
-
-void QBoundingVolumeDebugPrivate::updateSubtree()
-{
- Q_Q(QBoundingVolumeDebug);
- if (m_debugSubtree == nullptr) {
- m_debugSubtree = new Qt3DCore::QEntity();
- m_sphereMesh = new Qt3DRender::QSphereMesh();
- m_transform = new Qt3DCore::QTransform();
- m_material = new Qt3DRender::QPhongAlphaMaterial();
- m_layer = new Qt3DRender::QLayer();
-
- static_cast<QPhongAlphaMaterial *>(m_material)->setAlpha(0.3f);
- static_cast<QPhongAlphaMaterial *>(m_material)->setDiffuse(QColor::fromRgb(255, 153, 0));
-
- m_layer->setNames(QStringList() << QStringLiteral("debug"));
-
- m_debugSubtree->addComponent(m_sphereMesh);
- m_debugSubtree->addComponent(m_transform);
- m_debugSubtree->addComponent(m_material);
- m_debugSubtree->addComponent(m_layer);
-
- m_transform->setTranslation(m_bvCenter);
- m_transform->setScale(m_bvRadius * 2.0f);
- m_sphereMesh->setRadius(0.5f);
- m_sphereMesh->setRings(100);
- m_sphereMesh->setSlices(100);
-
- // Insert into scene
- if (q->entities().size() > 0) {
- Qt3DCore::QEntity *rootEntity = findRootEntity(q->entities().constFirst());
- m_debugSubtree->setParent(rootEntity ? rootEntity : q->entities().constFirst());
- }
- } else {
- // Just update the mesh
- m_transform->setTranslation(m_bvCenter);
- m_transform->setScale(m_bvRadius * 2.0f);
- }
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/render/frontend/qboundingvolumedebug_p.h b/src/render/frontend/qboundingvolumedebug_p.h
deleted file mode 100644
index 8ffe556b5..000000000
--- a/src/render/frontend/qboundingvolumedebug_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 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$
-**
-****************************************************************************/
-
-#if 0
-
-#ifndef QT3DRENDER_QBOUNDINGVOLUMEDEBUG_P_H
-#define QT3DRENDER_QBOUNDINGVOLUMEDEBUG_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 <Qt3DCore/qcomponent.h>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QGeometry;
-class QBoundingVolumeDebugPrivate;
-
-class QT3DRENDERSHARED_EXPORT QBoundingVolumeDebug : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
-
-public:
- explicit QBoundingVolumeDebug(Qt3DCore::QNode *parent = nullptr);
- ~QBoundingVolumeDebug();
-
- bool recursive() const;
-
-public Q_SLOTS:
- void setRecursive(bool recursive);
-
-Q_SIGNALS:
- void recursiveChanged(bool recursive);
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QBoundingVolumeDebug)
-
- // TODO: Handle creation changes
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QBOUNDINGVOLUMEDEBUG_P_H
-
-#endif
diff --git a/src/render/frontend/qlayer.cpp b/src/render/frontend/qlayer.cpp
index e9f23a015..cd7d92caf 100644
--- a/src/render/frontend/qlayer.cpp
+++ b/src/render/frontend/qlayer.cpp
@@ -53,7 +53,38 @@ QLayerPrivate::QLayerPrivate()
\class Qt3DRender::QLayer
\inmodule Qt3DRender
\since 5.5
- \brief The QLayer class provides ...
+ \brief The QLayer class provides a way of filtering which entities will be rendered.
+
+ Qt3DRender::QLayer works in conjunction with the Qt3DRender::QLayerFilter in the FrameGraph.
+ \sa Qt3DRender::QLayerFilter
+
+ Qt3DRender::QLayer doesn't define any new properties but is supposed to only be referenced.
+
+ \code
+ #include <Qt3DCore/QEntity>
+ #include <Qt3DRender/QGeometryRenderer>
+ #include <Qt3DRender/QLayer>
+ #include <Qt3DRender/QLayerFilter>
+ #include <Qt3DRender/QViewport>
+
+ // Scene
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::Qt3DCore::QEntity;
+
+ Qt3DCore::QEntity *renderableEntity = new Qt3DCore::Qt3DCore::QEntity(rootEntity);
+ Qt3DRender::QGeometryRenderer *geometryRenderer = new Qt3DCore::QGeometryRenderer(renderableEntity);
+ Qt3DRender::QLayer *layer1 = new Qt3DCore::QLayer(renderableEntity);
+ renderableEntity->addComponent(geometryRenderer);
+ renderableEntity->addComponent(layer1);
+
+ ...
+
+ // FrameGraph
+ Qt3DRender::QViewport *viewport = new Qt3DRender::QViewport;
+ Qt3DRender::QLayerFilter *layerFilter = new Qt3DRender::QLayerFilter(viewport);
+ layerFilter->addLayer(layer1);
+
+ ...
+ \endcode
*/
/*!
@@ -62,7 +93,48 @@ QLayerPrivate::QLayerPrivate()
\inherits Component3D
\inqmlmodule Qt3D.Render
\since 5.5
- \brief For ...
+ \sa LayerFilter
+ \brief Layer provides a way of filtering which entities will be rendered.
+
+ Layer works in conjunction with the LayerFilter in the FrameGraph.
+
+ Layer doesn't define any new properties but is supposed to only be referenced.
+
+ \code
+ import Qt3D.Core 2.0
+ import Qt3D.Render 2.0
+
+ Entity {
+ id: root
+
+ components: RenderSettings {
+ // FrameGraph
+ Viewport {
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+ CameraSelector {
+ camera: mainCamera
+ LayerFilter {
+ layers: [layer1]
+ }
+ }
+ }
+ }
+ }
+
+ // Scene
+ Camera { id: mainCamera }
+
+ Layer { id: layer1 }
+
+ GeometryRenderer { id: mesh }
+
+ Entity {
+ id: renderableEntity
+ components: [ mesh, layer1 ]
+ }
+ }
+ \endcode
*/
/*! \fn Qt3DRender::QLayer::QLayer(Qt3DCore::QNode *parent)
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp
index 03a939a13..5a8195b64 100644
--- a/src/render/frontend/qrenderaspect.cpp
+++ b/src/render/frontend/qrenderaspect.cpp
@@ -77,7 +77,6 @@
#include <Qt3DRender/qrendersurfaceselector.h>
#include <Qt3DRender/qrendersettings.h>
-#include <Qt3DRender/private/qboundingvolumedebug_p.h>
#include <Qt3DRender/private/cameraselectornode_p.h>
#include <Qt3DRender/private/layerfilternode_p.h>
#include <Qt3DRender/private/filterkey_p.h>
@@ -173,6 +172,9 @@ void QRenderAspectPrivate::registerBackendTypes()
{
Q_Q(QRenderAspect);
+ qRegisterMetaType<Qt3DRender::QBuffer*>();
+ qRegisterMetaType<Qt3DRender::QEffect*>();
+
q->registerBackendType<Qt3DCore::QEntity>(QSharedPointer<Render::RenderEntityFunctor>::create(m_renderer, m_nodeManagers));
q->registerBackendType<Qt3DCore::QTransform>(QSharedPointer<Render::NodeFunctor<Render::Transform, Render::TransformManager> >::create(m_renderer, m_nodeManagers->transformManager()));
@@ -222,7 +224,6 @@ void QRenderAspectPrivate::registerBackendTypes()
q->registerBackendType<QViewport>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ViewportNode, QViewport> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
// Picking
- // q->registerBackendType<QBoundingVolumeDebug>(QSharedPointer<Render::NodeFunctor<Render::BoundingVolumeDebug, Render::BoundingVolumeDebugManager> >::create(m_renderer, m_nodeManagers->boundingVolumeDebugManager()));
q->registerBackendType<QObjectPicker>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer, m_nodeManagers->objectPickerManager()));
}
@@ -278,7 +279,6 @@ void QRenderAspectPrivate::unregisterBackendTypes()
unregisterBackendType<QViewport>();
// Picking
- // unregisterBackendType<QBoundingVolumeDebug>();
unregisterBackendType<QObjectPicker>();
}
diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri
index 5f5246518..829e3d756 100644
--- a/src/render/frontend/render-frontend.pri
+++ b/src/render/frontend/render-frontend.pri
@@ -10,7 +10,6 @@ HEADERS += \
$$PWD/qrendertarget.h \
$$PWD/qrendertarget_p.h \
$$PWD/sphere_p.h \
- $$PWD/qboundingvolumedebug_p.h \
$$PWD/qcamera_p.h \
$$PWD/qcamera.h \
$$PWD/qcameralens.h \
@@ -31,7 +30,6 @@ SOURCES += \
$$PWD/sphere.cpp \
$$PWD/qlayer.cpp \
$$PWD/qrendertarget.cpp \
- $$PWD/qboundingvolumedebug.cpp \
$$PWD/qcamera.cpp \
$$PWD/qcameralens.cpp \
$$PWD/qrendersettings.cpp \