summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-11-23 15:27:48 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-11-26 17:36:04 +0000
commit653fdeb073a525a676bf0c12511c3f74bad2095e (patch)
tree9c4e2f2f29e63a12a0a0f7799235cad9b71c738e
parent1324668b1b77c865c90a1352a61b0b3da3da39b1 (diff)
Lights phase 1: infrastructure
QAbstractLight becomes QLight and gets its own backend node. This way we can easily gather all lights for the scene and filter them when building render commands. Both the frontend and backend remain a subclass of (Q)ShaderData but will not be part of the ordinary ShaderData component list. This prevents mixing up ShaderDatas and Lights but allows reusing the same underlying infrastructure so that properties can automatically be transformed for example. It is worth noting that the position property for lights is now removed: the position is determined by the entity's (to which the light component belongs) position. A number of changes are made to ShaderData itself as backend subclassing with different managers is not straightforward. For now the distance between the rendered entity and the entity with the light component is calculated and lights will be chosen based on this distance. A framegraph node for controlling this will be added in future patches. No uniform setting or shader changes are included here. Task-number: QTBUG-48834 Change-Id: I43a6c5f9420d4254d798c558bd58680b2b09eceb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--examples/qt3d/lights/lights.pro16
-rw-r--r--examples/qt3d/lights/lights.qrc5
-rw-r--r--examples/qt3d/lights/main.cpp61
-rw-r--r--examples/qt3d/lights/main.qml91
-rw-r--r--examples/qt3d/qt3d.pro3
-rw-r--r--src/quick3d/imports/render/qt3dquick3drenderplugin.cpp4
-rw-r--r--src/render/backend/entity.cpp29
-rw-r--r--src/render/backend/entity_p.h10
-rw-r--r--src/render/backend/handle_types_p.h2
-rw-r--r--src/render/backend/managers_p.h12
-rw-r--r--src/render/backend/nodemanagers.cpp7
-rw-r--r--src/render/backend/nodemanagers_p.h6
-rw-r--r--src/render/backend/renderview.cpp56
-rw-r--r--src/render/backend/renderview_p.h14
-rw-r--r--src/render/frontend/qrenderaspect.cpp4
-rw-r--r--src/render/jobs/framecleanupjob.cpp9
-rw-r--r--src/render/jobs/framepreparationjob.cpp14
-rw-r--r--src/render/jobs/renderviewjob.cpp1
-rw-r--r--src/render/lights/light.cpp79
-rw-r--r--src/render/lights/light_p.h88
-rw-r--r--src/render/lights/lights.pri13
-rw-r--r--src/render/lights/qdirectionallight.cpp7
-rw-r--r--src/render/lights/qdirectionallight.h4
-rw-r--r--src/render/lights/qdirectionallight_p.h4
-rw-r--r--src/render/lights/qlight.cpp (renamed from src/render/lights/qabstractlight.cpp)91
-rw-r--r--src/render/lights/qlight.h (renamed from src/render/lights/qabstractlight.h)28
-rw-r--r--src/render/lights/qlight_p.h (renamed from src/render/lights/qabstractlight_p.h)15
-rw-r--r--src/render/lights/qpointlight.cpp5
-rw-r--r--src/render/lights/qpointlight.h4
-rw-r--r--src/render/lights/qpointlight_p.h4
-rw-r--r--src/render/lights/qspotlight.cpp11
-rw-r--r--src/render/lights/qspotlight.h4
-rw-r--r--src/render/lights/qspotlight_p.h4
-rw-r--r--src/render/materialsystem/shaderdata.cpp81
-rw-r--r--src/render/materialsystem/shaderdata_p.h36
35 files changed, 640 insertions, 182 deletions
diff --git a/examples/qt3d/lights/lights.pro b/examples/qt3d/lights/lights.pro
new file mode 100644
index 000000000..d1a2c4fea
--- /dev/null
+++ b/examples/qt3d/lights/lights.pro
@@ -0,0 +1,16 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+SOURCE += main.cpp
+
+QT += qml quick 3dcore 3drender 3dinput 3dquick
+
+OTHER_FILES += main.qml
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ lights.qrc \
+ ../exampleresources/obj.qrc
diff --git a/examples/qt3d/lights/lights.qrc b/examples/qt3d/lights/lights.qrc
new file mode 100644
index 000000000..5f6483ac3
--- /dev/null
+++ b/examples/qt3d/lights/lights.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/qt3d/lights/main.cpp b/examples/qt3d/lights/main.cpp
new file mode 100644
index 000000000..51857b171
--- /dev/null
+++ b/examples/qt3d/lights/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <window.h>
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ Window view;
+ Qt3DCore::Quick::QQmlAspectEngine engine;
+
+ engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
+ engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
+ QVariantMap data;
+ data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
+ data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
+ engine.aspectEngine()->setData(data);
+ engine.aspectEngine()->initialize();
+ engine.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/qt3d/lights/main.qml b/examples/qt3d/lights/main.qml
new file mode 100644
index 000000000..eb28fc1a5
--- /dev/null
+++ b/examples/qt3d/lights/main.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0 as Quick
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Entity
+{
+ components: FrameGraph {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0, 0, 1)
+ camera: camera
+ }
+ }
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 50.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, -1.0 )
+ }
+
+ Configuration {
+ controlledCamera: camera
+ }
+
+ Entity {
+ components: [
+ Transform { translation: Qt.vector3d(2.0, 1.0, 1.0); },
+ PointLight {
+ color: Qt.rgba(1, 0, 0, 1)
+ }
+ ]
+ }
+
+ Entity {
+ components: [
+ Transform { translation: Qt.vector3d(2.0, 3.0, 4.0); },
+ PointLight {
+ color: Qt.rgba(1, 0, 0, 1)
+ }
+ ]
+ }
+
+ Entity {
+ components: [
+ Mesh {
+ source: "assets/obj/toyplane.obj"
+ }
+ ]
+ }
+}
diff --git a/examples/qt3d/qt3d.pro b/examples/qt3d/qt3d.pro
index 4de448259..afa4cce79 100644
--- a/examples/qt3d/qt3d.pro
+++ b/examples/qt3d/qt3d.pro
@@ -44,7 +44,8 @@ SUBDIRS += \
instanced-arrays-qml \
picking-qml \
transforms-qml \
- qgltf
+ qgltf \
+ lights
# TODO Port the old examples to new APIs
#SUBDIRS += qt3d
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
index 16613f5d3..04999c9c8 100644
--- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
+++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
@@ -60,7 +60,7 @@
#include <Qt3DRender/qtorusmesh.h>
#include <Qt3DRender/qlayer.h>
#include <Qt3DRender/qlayerfilter.h>
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
#include <Qt3DRender/qspotlight.h>
#include <Qt3DRender/qdirectionallight.h>
#include <Qt3DRender/qpointlight.h>
@@ -237,7 +237,7 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DRender::QLayerFilter>(uri, 2, 0, "LayerFilter");
// Lights
- qmlRegisterUncreatableType<Qt3DRender::QAbstractLight>(uri, 2, 0, "QAbstractLight", QStringLiteral("QAbstractLight is abstract"));
+ qmlRegisterType<Qt3DRender::QLight>(uri, 2, 0, "Light");
qmlRegisterType<Qt3DRender::QPointLight>(uri, 2, 0, "PointLight");
qmlRegisterType<Qt3DRender::QDirectionalLight>(uri, 2, 0, "DirectionalLight");
qmlRegisterType<Qt3DRender::QSpotLight>(uri, 2, 0, "SpotLight");
diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp
index c635c4e51..f14a285a7 100644
--- a/src/render/backend/entity.cpp
+++ b/src/render/backend/entity.cpp
@@ -37,7 +37,7 @@
#include "entity_p.h"
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
#include <Qt3DRender/qlayer.h>
#include <Qt3DRender/qmaterial.h>
#include <Qt3DRender/qmesh.h>
@@ -104,6 +104,7 @@ void Entity::cleanup()
m_boundingVolumeDebugComponent = QNodeId();
m_layerComponents.clear();
m_shaderDataComponents.clear();
+ m_lightComponents.clear();
m_localBoundingVolume.reset();
m_worldBoundingVolume.reset();
m_worldBoundingVolumeWithChildren.reset();
@@ -151,6 +152,7 @@ void Entity::updateFromPeer(Qt3DCore::QNode *peer)
m_boundingVolumeDebugComponent = QNodeId();
m_layerComponents.clear();
m_shaderDataComponents.clear();
+ m_lightComponents.clear();
m_localBoundingVolume.reset(new Sphere(peerUuid()));
m_worldBoundingVolume.reset(new Sphere(peerUuid()));
m_worldBoundingVolumeWithChildren.reset(new Sphere(peerUuid()));
@@ -266,6 +268,8 @@ void Entity::addComponent(Qt3DCore::QComponent *component)
m_layerComponents.append(component->id());
} else if (qobject_cast<QMaterial *>(component) != Q_NULLPTR) {
m_materialComponent = component->id();
+ } else if (qobject_cast<QLight *>(component) != Q_NULLPTR) { // QLight subclasses QShaderData
+ m_lightComponents.append(component->id());
} else if (qobject_cast<QShaderData *>(component) != Q_NULLPTR) {
m_shaderDataComponents.append(component->id());
} else if (qobject_cast<QGeometryRenderer *>(component) != Q_NULLPTR) {
@@ -297,6 +301,8 @@ void Entity::removeComponent(const Qt3DCore::QNodeId &nodeId)
m_objectPickerComponent = QNodeId();
} else if (m_boundingVolumeDebugComponent == nodeId) {
m_boundingVolumeDebugComponent = QNodeId();
+ } else if (m_lightComponents.contains(nodeId)) {
+ m_lightComponents.removeAll(nodeId);
}
}
@@ -376,6 +382,15 @@ HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDebug>() const
return m_nodeManagers->boundingVolumeDebugManager()->lookupHandle(m_boundingVolumeDebugComponent);
}
+template<>
+QList<HLight> Entity::componentsHandle<Light>() const
+{
+ QList<HLight> lightHandles;
+ Q_FOREACH (const QNodeId &id, m_lightComponents)
+ lightHandles.append(m_nodeManagers->lightManager()->lookupHandle(id));
+ return lightHandles;
+}
+
// Render components
template<>
@@ -427,6 +442,15 @@ QList<ShaderData *> Entity::renderComponents<ShaderData>() const
}
template<>
+QList<Light *> Entity::renderComponents<Light>() const
+{
+ QList<Light *> lights;
+ Q_FOREACH (const QNodeId &id, m_lightComponents)
+ lights.append(m_nodeManagers->lightManager()->lookupResource(id));
+ return lights;
+}
+
+template<>
BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const
{
return m_nodeManagers->boundingVolumeDebugManager()->lookupResource(m_boundingVolumeDebugComponent);
@@ -458,6 +482,9 @@ QNodeId Entity::componentUuid<ObjectPicker>() const { return m_objectPickerCompo
template<>
QNodeId Entity::componentUuid<BoundingVolumeDebug>() const { return m_boundingVolumeDebugComponent; }
+template<>
+QList<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const { return m_lightComponents; }
+
RenderEntityFunctor::RenderEntityFunctor(NodeManagers *manager)
: m_nodeManagers(manager)
{
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index 9aaca6cf7..2cd0ee743 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -169,6 +169,7 @@ private:
Qt3DCore::QNodeId m_cameraComponent;
QList<Qt3DCore::QNodeId> m_layerComponents;
QList<Qt3DCore::QNodeId> m_shaderDataComponents;
+ QList<Qt3DCore::QNodeId> m_lightComponents;
Qt3DCore::QNodeId m_geometryRendererComponent;
Qt3DCore::QNodeId m_objectPickerComponent;
Qt3DCore::QNodeId m_boundingVolumeDebugComponent;
@@ -203,6 +204,9 @@ QList<HShaderData> Entity::componentsHandle<ShaderData>() const;
template<>
Q_AUTOTEST_EXPORT HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDebug>() const;
+template<>
+QList<HLight> Entity::componentsHandle<Light>() const;
+
// Render components
template<>
Material *Entity::renderComponent<Material>() const;
@@ -228,6 +232,9 @@ QList<ShaderData *> Entity::renderComponents<ShaderData>() const;
template<>
Q_AUTOTEST_EXPORT BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const;
+template<>
+QList<Light *> Entity::renderComponents<Light>() const;
+
// UUid
template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<Transform>() const;
@@ -253,6 +260,9 @@ Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<ObjectPicker>() const;
template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<BoundingVolumeDebug>() const;
+template<>
+Q_AUTOTEST_EXPORT QList<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const;
+
class RenderEntityFunctor : public Qt3DCore::QBackendNodeFunctor
{
public:
diff --git a/src/render/backend/handle_types_p.h b/src/render/backend/handle_types_p.h
index c84578bc4..5e9c8fe85 100644
--- a/src/render/backend/handle_types_p.h
+++ b/src/render/backend/handle_types_p.h
@@ -86,6 +86,7 @@ class GeometryRenderer;
class ObjectPicker;
class BoundingVolumeDebug;
class OpenGLVertexArrayObject;
+class Light;
typedef Qt3DCore::QHandle<RenderAttachment, 16> HAttachment;
typedef Qt3DCore::QHandle<CameraLens, 8> HCamera;
@@ -114,6 +115,7 @@ typedef Qt3DCore::QHandle<Geometry, 16> HGeometry;
typedef Qt3DCore::QHandle<GeometryRenderer, 16> HGeometryRenderer;
typedef Qt3DCore::QHandle<ObjectPicker, 16> HObjectPicker;
typedef Qt3DCore::QHandle<BoundingVolumeDebug, 16> HBoundingVolumeDebug;
+typedef Qt3DCore::QHandle<Light, 16> HLight;
} // namespace Render
diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h
index e1d4b2d4e..ca2d3e264 100644
--- a/src/render/backend/managers_p.h
+++ b/src/render/backend/managers_p.h
@@ -73,6 +73,7 @@
#include <Qt3DRender/private/objectpicker_p.h>
#include <Qt3DRender/private/boundingvolumedebug_p.h>
#include <Qt3DRender/private/openglvertexarrayobject_p.h>
+#include <Qt3DRender/private/light_p.h>
QT_BEGIN_NAMESPACE
@@ -334,6 +335,17 @@ class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager<
{
};
+class LightManager : public Qt3DCore::QResourceManager<
+ Light,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy,
+ Qt3DCore::ObjectLevelLockingPolicy>
+{
+public:
+ LightManager() {}
+};
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/backend/nodemanagers.cpp b/src/render/backend/nodemanagers.cpp
index 747ddc8b0..578cd1c82 100644
--- a/src/render/backend/nodemanagers.cpp
+++ b/src/render/backend/nodemanagers.cpp
@@ -80,6 +80,7 @@ NodeManagers::NodeManagers()
, m_geometryRendererManager(new GeometryRendererManager)
, m_objectPickerManager(new ObjectPickerManager())
, m_boundingVolumeDebugManager(new BoundingVolumeDebugManager())
+ , m_lightManager(new LightManager())
{
}
@@ -257,6 +258,12 @@ BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q
return m_boundingVolumeDebugManager;
}
+template<>
+LightManager *NodeManagers::manager<Light>() const Q_DECL_NOEXCEPT
+{
+ return m_lightManager;
+}
+
} // Render
} // Qt3DRender
diff --git a/src/render/backend/nodemanagers_p.h b/src/render/backend/nodemanagers_p.h
index a67d7a518..9fb4074e1 100644
--- a/src/render/backend/nodemanagers_p.h
+++ b/src/render/backend/nodemanagers_p.h
@@ -121,6 +121,7 @@ class Geometry;
class GeometryRenderer;
class ObjectPicker;
class BoundingVolumeDebug;
+class Light;
class QT3DRENDERSHARED_PRIVATE_EXPORT NodeManagers
{
@@ -190,6 +191,7 @@ public:
inline GeometryRendererManager *geometryRendererManager() const Q_DECL_NOEXCEPT { return m_geometryRendererManager; }
inline ObjectPickerManager *objectPickerManager() const Q_DECL_NOEXCEPT { return m_objectPickerManager; }
inline BoundingVolumeDebugManager *boundingVolumeDebugManager() const Q_DECL_NOEXCEPT { return m_boundingVolumeDebugManager; }
+ inline LightManager *lightManager() const Q_DECL_NOEXCEPT { return m_lightManager; }
private:
CameraManager *m_cameraManager;
@@ -221,6 +223,7 @@ private:
GeometryRendererManager *m_geometryRendererManager;
ObjectPickerManager *m_objectPickerManager;
BoundingVolumeDebugManager *m_boundingVolumeDebugManager;
+ LightManager *m_lightManager;
};
// Specializations
@@ -312,6 +315,9 @@ QT3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<Objec
template<>
QT3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT;
+template<>
+LightManager *NodeManagers::manager<Light>() const Q_DECL_NOEXCEPT;
+
} // Render
} // Qt3DRender
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp
index 9bc54d793..6903cb3c3 100644
--- a/src/render/backend/renderview.cpp
+++ b/src/render/backend/renderview.cpp
@@ -75,6 +75,8 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
+static const int MAX_LIGHTS = 8;
+
namespace {
// TODO: Should we treat lack of layer data as implicitly meaning that an
@@ -378,6 +380,35 @@ void RenderView::setRenderer(Renderer *renderer)
m_data->m_uniformBlockBuilder.shaderDataManager = m_manager->shaderDataManager();
}
+void RenderView::gatherLights(Entity *node)
+{
+ QList<Light *> lights = node->renderComponents<Light>();
+ if (!lights.isEmpty()) {
+ if (lights.count() == 1)
+ m_lightSources.append(LightSource(node, lights.first()));
+ else
+ qWarning("Light source entity with more than one lights found. Only the first light component is used.");
+ }
+
+ // Traverse children
+ Q_FOREACH (Entity *child, node->children())
+ gatherLights(child);
+}
+
+class LightSourceCompare
+{
+public:
+ LightSourceCompare(Entity *node) { p = node->worldBoundingVolume()->center(); }
+ bool operator()(const RenderView::LightSource &a, const RenderView::LightSource &b) const {
+ const float distA = p.distanceToPoint(a.entity->worldBoundingVolume()->center());
+ const float distB = p.distanceToPoint(b.entity->worldBoundingVolume()->center());
+ return distA < distB;
+ }
+
+private:
+ QVector3D p;
+};
+
// Tries to order renderCommand by shader so as to minimize shader changes
void RenderView::buildRenderCommands(Entity *node, const Plane *planes)
{
@@ -467,7 +498,17 @@ void RenderView::buildRenderCommands(Entity *node, const Plane *planes)
command->m_stateSet->merge(m_stateSet);
command->m_changeCost = m_renderer->defaultRenderState()->changeCost(command->m_stateSet);
}
- setShaderAndUniforms(command, pass, globalParameters, *(node->worldTransform()));
+
+ // Pick which lights to take in to account.
+ // For now decide based on the distance by taking the MAX_LIGHTS closest lights.
+ // Replace with more sophisticated mechanisms later.
+ std::sort(m_lightSources.begin(), m_lightSources.end(), LightSourceCompare(node));
+ QVector<LightSource> activeLightSources;
+ for (int i = 0; i < m_lightSources.count() && i < MAX_LIGHTS; ++i)
+ activeLightSources.append(m_lightSources[i]);
+
+ setShaderAndUniforms(command, pass, globalParameters, *(node->worldTransform()), activeLightSources);
+
buildSortingKey(command);
m_commands.append(command);
}
@@ -540,7 +581,7 @@ void RenderView::setUniformBlockValue(QUniformPack &uniformPack, Shader *shader,
// If shaderData has been updated (property has changed or one of the nested properties has changed)
// foreach property defined in the QShaderData, we try to fill the value of the corresponding active uniform(s)
// for all the updated properties (all the properties if the UBO was just created)
- if (shaderData->needsUpdate(*m_data->m_viewMatrix) || uboNeedsUpdate) {
+ if (shaderData->updateViewTransform(*m_data->m_viewMatrix) || uboNeedsUpdate) {
// Clear previous values remaining in the hash
m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear();
// Update only update properties if uboNeedsUpdate is true, otherwise update the whole block
@@ -550,7 +591,7 @@ void RenderView::setUniformBlockValue(QUniformPack &uniformPack, Shader *shader,
// Builds the name-value map for the block
m_data->m_uniformBlockBuilder.buildActiveUniformNameValueMapStructHelper(shaderData, block.m_name);
if (!uboNeedsUpdate)
- shaderData->addToClearUpdateList();
+ shaderData->markDirty();
// copy the name-value map into the BlockToUBO
uniformBlockUBO.m_updatedProperties = m_data->m_uniformBlockBuilder.activeUniformNamesToValue;
uboNeedsUpdate = true;
@@ -566,7 +607,7 @@ void RenderView::setDefaultUniformBlockShaderDataValue(QUniformPack &uniformPack
m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear();
// updates transformed properties;
- shaderData->needsUpdate(*m_data->m_viewMatrix);
+ shaderData->updateViewTransform(*m_data->m_viewMatrix);
// Force to update the whole block
m_data->m_uniformBlockBuilder.updatedPropertiesOnly = false;
// Retrieve names and description of each active uniforms in the uniform block
@@ -610,7 +651,8 @@ void RenderView::buildSortingKey(RenderCommand *command)
}
}
-void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass, ParameterInfoList &parameters, const QMatrix4x4 &worldTransform)
+void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass, ParameterInfoList &parameters, const QMatrix4x4 &worldTransform,
+ const QVector<LightSource> &activeLightSources)
{
// The VAO Handle is set directly in the renderer thread so as to avoid having to use a mutex here
// Set shader, technique, and effect by basically doing :
@@ -713,6 +755,10 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
}
}
}
+
+ // TODO
+ Q_UNUSED(activeLightSources);
+
}
// Set frag outputs in the shaders if hash not empty
if (!fragOutputs.isEmpty())
diff --git a/src/render/backend/renderview_p.h b/src/render/backend/renderview_p.h
index bb324baf5..874b22b83 100644
--- a/src/render/backend/renderview_p.h
+++ b/src/render/backend/renderview_p.h
@@ -210,6 +210,7 @@ public:
void buildRenderCommands(Entity *preprocessedTreeRoot, const Plane *planes);
QVector<RenderCommand *> commands() const { return m_commands; }
+ void gatherLights(Entity *preprocessedTreeRoot);
void addRenderAttachment(Attachment attachment) { m_attachmentPack.addAttachment(attachment); }
void setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &drawBuffers) { m_attachmentPack.setDrawBuffers(drawBuffers); }
@@ -242,8 +243,17 @@ public:
UniformBlockValueBuilder m_uniformBlockBuilder;
};
+ struct LightSource {
+ LightSource() : entity(Q_NULLPTR), light(Q_NULLPTR) { }
+ LightSource(Entity *entity, Light *light)
+ : entity(entity), light(light) { }
+ Entity *entity;
+ Light *light;
+ };
+
private:
- void setShaderAndUniforms(RenderCommand *command, RenderPass *pass, ParameterInfoList &parameters, const QMatrix4x4 &worldTransform);
+ void setShaderAndUniforms(RenderCommand *command, RenderPass *pass, ParameterInfoList &parameters, const QMatrix4x4 &worldTransform,
+ const QVector<LightSource> &activeLightSources);
Renderer *m_renderer;
NodeManagers *m_manager;
@@ -266,6 +276,8 @@ private:
// the render thread is submitting these commands.
QVector<RenderCommand *> m_commands;
+ QVector<LightSource> m_lightSources;
+
typedef QHash<QString, QUniformValue* (RenderView::*)(const QMatrix4x4& model) const> StandardUniformsPFuncsHash;
static StandardUniformsPFuncsHash ms_standardUniformSetters;
static StandardUniformsPFuncsHash initializeStandardUniformSetters();
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp
index 50c265237..ea2acaa17 100644
--- a/src/render/frontend/qrenderaspect.cpp
+++ b/src/render/frontend/qrenderaspect.cpp
@@ -71,6 +71,7 @@
#include <Qt3DRender/qobjectpicker.h>
#include <Qt3DRender/qboundingvolumedebug.h>
#include <Qt3DRender/qfrustumculling.h>
+#include <Qt3DRender/qlight.h>
#include <Qt3DRender/private/cameraselectornode_p.h>
#include <Qt3DRender/private/layerfilternode_p.h>
@@ -262,7 +263,7 @@ void QRenderAspect::registerBackendTypes()
registerBackendType<QFrameGraphSelector>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::FrameGraphSubtreeSelector, QFrameGraphSelector>(d->m_nodeManagers->frameGraphManager())));
registerBackendType<QFrameGraph>(QBackendNodeFunctorPtr(new Render::FrameGraphComponentFunctor(d->m_renderer)));
registerBackendType<QParameter>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Parameter, Render::ParameterManager>(d->m_nodeManagers->parameterManager())));
- registerBackendType<QShaderData>(QBackendNodeFunctorPtr(new Render::RenderShaderDataFunctor(d->m_nodeManagers->shaderDataManager())));
+ registerBackendType<QShaderData>(QBackendNodeFunctorPtr(new Render::RenderShaderDataFunctor(d->m_nodeManagers)));
registerBackendType<QAbstractTextureImage>(QBackendNodeFunctorPtr(new Render::TextureImageFunctor(d->m_nodeManagers->textureManager(), d->m_nodeManagers->textureImageManager(), d->m_nodeManagers->textureDataManager())));
registerBackendType<QStateSet>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::StateSetNode, QStateSet>(d->m_nodeManagers->frameGraphManager())));
registerBackendType<QNoDraw>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::NoDraw, QNoDraw>(d->m_nodeManagers->frameGraphManager())));
@@ -273,6 +274,7 @@ void QRenderAspect::registerBackendTypes()
registerBackendType<QObjectPicker>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager>(d->m_nodeManagers->objectPickerManager())));
registerBackendType<QBoundingVolumeDebug>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::BoundingVolumeDebug, Render::BoundingVolumeDebugManager>(d->m_nodeManagers->boundingVolumeDebugManager())));
registerBackendType<QFrustumCulling>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::FrustumCulling, QFrustumCulling>(d->m_nodeManagers->frameGraphManager())));
+ registerBackendType<QLight>(QBackendNodeFunctorPtr(new Render::RenderLightFunctor(d->m_nodeManagers)));
}
void QRenderAspect::renderInitialize(QOpenGLContext *context)
diff --git a/src/render/jobs/framecleanupjob.cpp b/src/render/jobs/framecleanupjob.cpp
index 150626a5b..f4a7756bc 100644
--- a/src/render/jobs/framecleanupjob.cpp
+++ b/src/render/jobs/framecleanupjob.cpp
@@ -65,13 +65,8 @@ void FrameCleanupJob::setRoot(Entity *root)
void FrameCleanupJob::run()
{
- // set each ShaderData to not need an update
- Q_FOREACH (const Qt3DCore::QNodeId &id, ShaderData::updatedShaderDataList()) {
- ShaderData *shaderData = m_managers->shaderDataManager()->lookupResource(id);
- if (shaderData != Q_NULLPTR)
- shaderData->clearUpdate();
- }
- ShaderData::clearShaderDataList();
+ // mark each ShaderData clean
+ ShaderData::cleanup(m_managers);
// Cleanup texture handles
TextureDataManager *textureDataManager = m_managers->textureDataManager();
diff --git a/src/render/jobs/framepreparationjob.cpp b/src/render/jobs/framepreparationjob.cpp
index 02fbe98ae..87eba1b3c 100644
--- a/src/render/jobs/framepreparationjob.cpp
+++ b/src/render/jobs/framepreparationjob.cpp
@@ -38,6 +38,7 @@
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/shaderdata_p.h>
+#include <Qt3DRender/private/light_p.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/attribute_p.h>
#include <Qt3DRender/private/geometryrenderer_p.h>
@@ -75,11 +76,14 @@ void FramePreparationJob::run()
void FramePreparationJob::parseNodeTree(Entity *node)
{
- // Update transform properties in ShaderData
- QList<ShaderData *> shadersData = node->renderComponents<ShaderData>();
- Q_FOREACH (ShaderData *r, shadersData) {
- r->updateTransformedProperties(*node->worldTransform());
- }
+ // Update transform properties in ShaderDatas and Lights
+ QList<ShaderData *> shaderDatas = node->renderComponents<ShaderData>();
+ Q_FOREACH (ShaderData *r, shaderDatas)
+ r->updateWorldTransform(*node->worldTransform());
+
+ QList<Light *> lights = node->renderComponents<Light>();
+ Q_FOREACH (Light *light, lights)
+ light->updateWorldTransform(*node->worldTransform());
// Look if for the GeometryRender/Geometry the attributes and or buffers are dirty
// in which case we need to recompute the triangle list
diff --git a/src/render/jobs/renderviewjob.cpp b/src/render/jobs/renderviewjob.cpp
index 81439e99c..8482c672b 100644
--- a/src/render/jobs/renderviewjob.cpp
+++ b/src/render/jobs/renderviewjob.cpp
@@ -78,6 +78,7 @@ void RenderViewJob::run()
Plane(viewProjectionMatrix.row(3) - viewProjectionMatrix.row(2)), // Back
};
+ renderView->gatherLights(m_renderer->sceneRoot());
renderView->buildRenderCommands(m_renderer->sceneRoot(), planes);
}
diff --git a/src/render/lights/light.cpp b/src/render/lights/light.cpp
new file mode 100644
index 000000000..de28349e6
--- /dev/null
+++ b/src/render/lights/light.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "light_p.h"
+#include "qlight.h"
+#include <Qt3DCore/qscenepropertychange.h>
+#include <private/abstractrenderer_p.h>
+#include <private/nodemanagers_p.h>
+#include <private/qbackendnode_p.h>
+#include <private/managers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderLightFunctor::RenderLightFunctor(NodeManagers *managers)
+ : m_managers(managers)
+{
+}
+
+Qt3DCore::QBackendNode *RenderLightFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+{
+ Light *backend = m_managers->lightManager()->getOrCreateResource(frontend->id());
+ backend->setFactory(factory);
+ backend->setManagers(m_managers);
+ backend->setPeer(frontend);
+ return backend;
+}
+
+Qt3DCore::QBackendNode *RenderLightFunctor::get(const Qt3DCore::QNodeId &id) const
+{
+ return m_managers->lightManager()->lookupResource(id);
+}
+
+void RenderLightFunctor::destroy(const Qt3DCore::QNodeId &id) const
+{
+ m_managers->lightManager()->releaseResource(id);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/lights/light_p.h b/src/render/lights/light_p.h
new file mode 100644
index 000000000..3059a6917
--- /dev/null
+++ b/src/render/lights/light_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_LIGHT_P_H
+#define QT3DRENDER_RENDER_LIGHT_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/shaderdata_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class NodeManagers;
+
+class Q_AUTOTEST_EXPORT Light : public ShaderData
+{
+public:
+
+};
+
+class RenderLightFunctor : public Qt3DCore::QBackendNodeFunctor
+{
+public:
+ explicit RenderLightFunctor(NodeManagers *managers);
+
+ Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+
+private:
+ NodeManagers *m_managers;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::Render::Light*)
+
+#endif // QT3DRENDER_RENDER_LIGHT_P_H
diff --git a/src/render/lights/lights.pri b/src/render/lights/lights.pri
index e12428e9d..ade6d29d7 100644
--- a/src/render/lights/lights.pri
+++ b/src/render/lights/lights.pri
@@ -1,18 +1,19 @@
INCLUDEPATH += $$PWD
HEADERS += \
- $$PWD/qabstractlight.h \
- $$PWD/qabstractlight_p.h \
+ $$PWD/qlight.h \
+ $$PWD/qlight_p.h \
$$PWD/qdirectionallight.h \
$$PWD/qdirectionallight_p.h \
$$PWD/qpointlight.h \
$$PWD/qpointlight_p.h \
$$PWD/qspotlight.h \
- $$PWD/qspotlight_p.h
-
+ $$PWD/qspotlight_p.h \
+ $$PWD/light_p.h
SOURCES += \
- $$PWD/qabstractlight.cpp \
+ $$PWD/qlight.cpp \
$$PWD/qdirectionallight.cpp \
$$PWD/qpointlight.cpp \
- $$PWD/qspotlight.cpp
+ $$PWD/qspotlight.cpp \
+ $$PWD/light.cpp
diff --git a/src/render/lights/qdirectionallight.cpp b/src/render/lights/qdirectionallight.cpp
index 2e3f91714..80e0bc5f1 100644
--- a/src/render/lights/qdirectionallight.cpp
+++ b/src/render/lights/qdirectionallight.cpp
@@ -66,7 +66,6 @@ namespace Qt3DRender {
\internal
*/
QDirectionalLightPrivate::QDirectionalLightPrivate()
- : QAbstractLightPrivate()
{
}
@@ -76,17 +75,17 @@ void QDirectionalLight::copy(const QNode *ref)
d_func()->m_direction = light->d_func()->m_direction;
// This needs to be last otherwise, properties value won't be copied
// as we use shader introspection in QShaderData::copy
- QAbstractLight::copy(ref);
+ QLight::copy(ref);
}
QDirectionalLight::QDirectionalLight(QNode *parent)
- : QAbstractLight(*new QDirectionalLightPrivate, parent)
+ : QLight(*new QDirectionalLightPrivate, parent)
{
}
/*! \internal */
QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, QNode *parent)
- : QAbstractLight(dd, parent)
+ : QLight(dd, parent)
{
}
diff --git a/src/render/lights/qdirectionallight.h b/src/render/lights/qdirectionallight.h
index 6acc28721..c2af37ea5 100644
--- a/src/render/lights/qdirectionallight.h
+++ b/src/render/lights/qdirectionallight.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QDIRECTIONALLIGHT_H
#define QT3DRENDER_QDIRECTIONALLIGHT_H
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +45,7 @@ namespace Qt3DRender {
class QDirectionalLightPrivate;
-class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QAbstractLight
+class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QLight
{
Q_OBJECT
Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
diff --git a/src/render/lights/qdirectionallight_p.h b/src/render/lights/qdirectionallight_p.h
index 0798cf9fd..c197c527d 100644
--- a/src/render/lights/qdirectionallight_p.h
+++ b/src/render/lights/qdirectionallight_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <private/qabstractlight_p.h>
+#include <private/qlight_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +56,7 @@ namespace Qt3DRender {
class QDirectionalLight;
-class QDirectionalLightPrivate : QAbstractLightPrivate
+class QDirectionalLightPrivate : QLightPrivate
{
public:
QDirectionalLightPrivate();
diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qlight.cpp
index b0132e43a..eeb6e7463 100644
--- a/src/render/lights/qabstractlight.cpp
+++ b/src/render/lights/qlight.cpp
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#include "qabstractlight.h"
-#include "qabstractlight_p.h"
+#include "qlight.h"
+#include "qlight_p.h"
QT_BEGIN_NAMESPACE
@@ -43,68 +43,70 @@ namespace Qt3DRender
{
/*!
- * \qmltype AbstractLight
+ * \qmltype Light
* \inqmlmodule Qt3D.Render
- * \instantiates Qt3DRender::QAbstractLight
- * \brief Encapsulate a QAbstractLight object in a Qt 3D scene.
- * \since 5.3
+ * \instantiates QLight
+ * \brief Encapsulate a QLight object in a Qt 3D scene.
+ * \since 5.6
*/
/*!
- \class Qt3DRender::QAbstractLightPrivate
+ \class Qt3DRender::QLightPrivate
\internal
*/
-QAbstractLightPrivate::QAbstractLightPrivate()
- : QShaderDataPrivate()
- , m_color(QColor(255, 255, 255))
+QLightPrivate::QLightPrivate()
+ : m_color(QColor(255, 255, 255))
, m_intensity(1.0f)
-{}
+{
+}
-void QAbstractLight::copy(const QNode *ref)
+void QLight::copy(const QNode *ref)
{
- const QAbstractLight *light = static_cast<const QAbstractLight*>(ref);
+ const QLight *light = static_cast<const QLight*>(ref);
d_func()->m_color = light->d_func()->m_color;
d_func()->m_intensity = light->d_func()->m_intensity;
- // This needs to be last otherwise, properties value won't be copied
- // as we use shader introspection in QShaderData::copy
QShaderData::copy(ref);
}
/*!
- \class Qt3DRender::QAbstractLight
+ \class Qt3DRender::QLight
\inmodule Qt3DRender
*/
/*!
- * Constructs a new QAbstractLight with the given \a parent.
+ * Constructs a new QLight with the given \a parent.
*/
-QAbstractLight::QAbstractLight(Qt3DCore::QNode *parent) :
- QShaderData(*new QAbstractLightPrivate, parent)
+QLight::QLight(Qt3DCore::QNode *parent) :
+ QShaderData(*new QLightPrivate, parent)
{
}
/*! \internal */
-QAbstractLight::QAbstractLight(QAbstractLightPrivate &dd, QNode *parent)
+QLight::QLight(QLightPrivate &dd, QNode *parent)
: QShaderData(dd, parent)
{
}
+QLight::~QLight()
+{
+ cleanup();
+}
/*!
- * \property Qt3DRender::QAbstractLight::color
+ * \property Qt3DRender::QLight::color
*
- * Holds the current QAbstractLight color.
+ * Holds the current QLight color.
*/
-QColor QAbstractLight::color() const
+QColor QLight::color() const
{
- Q_D(const QAbstractLight);
+ Q_D(const QLight);
return d->m_color;
}
-void QAbstractLight::setColor(const QColor &color)
+void QLight::setColor(const QColor &color)
{
- Q_D(QAbstractLight);
+ Q_D(QLight);
if (d->m_color != color) {
d->m_color = color;
emit colorChanged();
@@ -112,50 +114,25 @@ void QAbstractLight::setColor(const QColor &color)
}
/*!
- \property Qt3DRender::QAbstractLight::intensity
+ \property Qt3DRender::QLight::intensity
- Holds the current QAbstractLight intensity.
+ Holds the current QLight intensity.
*/
-float QAbstractLight::intensity() const
+float QLight::intensity() const
{
- Q_D(const QAbstractLight);
+ Q_D(const QLight);
return d->m_intensity;
}
-void QAbstractLight::setIntensity(float intensity)
+void QLight::setIntensity(float intensity)
{
- Q_D(QAbstractLight);
+ Q_D(QLight);
if (d->m_intensity != intensity) {
d->m_intensity = intensity;
emit intensityChanged();
}
}
-/*!
- \property Qt3DRender::QAbstractLight::position
-
- Holds the current QAbstractLight position.
-*/
-void QAbstractLight::setPosition(const QVector3D &position)
-{
- Q_D(QAbstractLight);
- if (d->m_position != position) {
- d->m_position = position;
- emit positionChanged();
- }
-}
-
-QVector3D QAbstractLight::position() const
-{
- Q_D(const QAbstractLight);
- return d->m_position;
-}
-
-QShaderData::TransformType QAbstractLight::positionTransformed() const
-{
- return QShaderData::ModelToEye;
-}
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qlight.h
index 4379f6aa6..4ed279e34 100644
--- a/src/render/lights/qabstractlight.h
+++ b/src/render/lights/qlight.h
@@ -34,11 +34,11 @@
**
****************************************************************************/
-#ifndef QT3DRENDER_QABSTRACTLIGHT_H
-#define QT3DRENDER_QABSTRACTLIGHT_H
+#ifndef QT3DRENDER_QLIGHT_H
+#define QT3DRENDER_QLIGHT_H
-#include <Qt3DRender/qshaderdata.h>
#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/qshaderdata.h>
#include <QVector3D>
#include <QColor>
@@ -47,18 +47,17 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractLightPrivate;
+class QLightPrivate;
-class QT3DRENDERSHARED_EXPORT QAbstractLight : public QShaderData
+class QT3DRENDERSHARED_EXPORT QLight : public QShaderData
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(float intensity READ intensity WRITE setIntensity NOTIFY intensityChanged)
- Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(TransformType positionTransformed READ positionTransformed CONSTANT)
public :
- explicit QAbstractLight(Qt3DCore::QNode *parent = 0);
+ explicit QLight(Qt3DCore::QNode *parent = 0);
+ ~QLight();
QColor color() const;
void setColor(const QColor &color);
@@ -66,26 +65,21 @@ public :
float intensity() const;
void setIntensity(float intensity);
- void setPosition(const QVector3D &position);
- QVector3D position() const;
-
- TransformType positionTransformed() const;
-
protected :
- QAbstractLight(QAbstractLightPrivate &dd, Qt3DCore::QNode *parent = 0);
+ QLight(QLightPrivate &dd, Qt3DCore::QNode *parent = 0);
void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
Q_SIGNALS:
void colorChanged();
void intensityChanged();
- void positionChanged();
private:
- Q_DECLARE_PRIVATE(QAbstractLight)
+ Q_DECLARE_PRIVATE(QLight)
+ QT3D_CLONEABLE(QLight)
};
} // namespace Qt3DRender
QT_END_NAMESPACE
-#endif // QT3DRENDER_LIGHT_H
+#endif // QT3DRENDER_QLIGHT_H
diff --git a/src/render/lights/qabstractlight_p.h b/src/render/lights/qlight_p.h
index cb81a712c..6f8229505 100644
--- a/src/render/lights/qabstractlight_p.h
+++ b/src/render/lights/qlight_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QT3DRENDER_QABSTRACTLIGHT_P_H
-#define QT3DRENDER_QABSTRACTLIGHT_P_H
+#ifndef QT3DRENDER_QLIGHT_P_H
+#define QT3DRENDER_QLIGHT_P_H
//
// W A R N I N G
@@ -54,21 +54,20 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractLight;
+class QLight;
-class QAbstractLightPrivate : public QShaderDataPrivate
+class QLightPrivate : public QShaderDataPrivate
{
public:
- QAbstractLightPrivate();
+ QLightPrivate();
- Q_DECLARE_PUBLIC(QAbstractLight)
+ Q_DECLARE_PUBLIC(QLight)
QColor m_color;
float m_intensity;
- QVector3D m_position;
};
}
QT_END_NAMESPACE
-#endif // QT3DRENDER_QABSTRACTLIGHT_P_H
+#endif // QT3DRENDER_QLIGHT_P_H
diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp
index 21ff60aa0..539e99b00 100644
--- a/src/render/lights/qpointlight.cpp
+++ b/src/render/lights/qpointlight.cpp
@@ -63,7 +63,6 @@ namespace Qt3DRender {
\internal
*/
QPointLightPrivate::QPointLightPrivate()
- : QAbstractLightPrivate()
{
}
@@ -88,13 +87,13 @@ QPointLightPrivate::QPointLightPrivate()
Constructs a new QPointLight with the specified \a parent.
*/
QPointLight::QPointLight(QNode *parent)
- : QAbstractLight(*new QPointLightPrivate, parent)
+ : QLight(*new QPointLightPrivate, parent)
{
}
/*! \internal */
QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent)
- : QAbstractLight(dd, parent)
+ : QLight(dd, parent)
{
}
diff --git a/src/render/lights/qpointlight.h b/src/render/lights/qpointlight.h
index 2f3711459..eb8b447d7 100644
--- a/src/render/lights/qpointlight.h
+++ b/src/render/lights/qpointlight.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QPOINTLIGHT_H
#define QT3DRENDER_QPOINTLIGHT_H
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +45,7 @@ namespace Qt3DRender {
class QPointLightPrivate;
-class QT3DRENDERSHARED_EXPORT QPointLight : public QAbstractLight
+class QT3DRENDERSHARED_EXPORT QPointLight : public QLight
{
Q_OBJECT
diff --git a/src/render/lights/qpointlight_p.h b/src/render/lights/qpointlight_p.h
index 67396b943..2e2cd652e 100644
--- a/src/render/lights/qpointlight_p.h
+++ b/src/render/lights/qpointlight_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <private/qabstractlight_p.h>
+#include <private/qlight_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +56,7 @@ namespace Qt3DRender {
class QPointLight;
-class QPointLightPrivate : public QAbstractLightPrivate
+class QPointLightPrivate : public QLightPrivate
{
public:
QPointLightPrivate();
diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp
index ab0d822e7..b666ef1e1 100644
--- a/src/render/lights/qspotlight.cpp
+++ b/src/render/lights/qspotlight.cpp
@@ -67,8 +67,7 @@ namespace Qt3DRender {
\internal
*/
QSpotLightPrivate::QSpotLightPrivate()
- : QAbstractLightPrivate()
- , m_cutOffAngle(45.0f)
+ : m_cutOffAngle(45.0f)
{
}
@@ -97,9 +96,7 @@ void QSpotLight::copy(const QNode *ref)
const QSpotLight *light = static_cast<const QSpotLight*>(ref);
d_func()->m_direction = light->d_func()->m_direction;
d_func()->m_cutOffAngle = light->d_func()->m_cutOffAngle;
- // This needs to be last otherwise, properties value won't be copied
- // as we use shader introspection in QShaderData::copy
- QAbstractLight::copy(ref);
+ QLight::copy(ref);
}
@@ -108,13 +105,13 @@ void QSpotLight::copy(const QNode *ref)
Constructs a new QSpotLight with the specified \a parent.
*/
QSpotLight::QSpotLight(QNode *parent)
- : QAbstractLight(*new QSpotLightPrivate, parent)
+ : QLight(*new QSpotLightPrivate, parent)
{
}
/*! \internal */
QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent)
- : QAbstractLight(dd, parent)
+ : QLight(dd, parent)
{
}
diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h
index 6f8d2bbd6..9a04b7925 100644
--- a/src/render/lights/qspotlight.h
+++ b/src/render/lights/qspotlight.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QSPOTLIGHT_H
#define QT3DRENDER_QSPOTLIGHT_H
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +45,7 @@ namespace Qt3DRender {
class QSpotLightPrivate;
-class QT3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight
+class QT3DRENDERSHARED_EXPORT QSpotLight : public QLight
{
Q_OBJECT
Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
diff --git a/src/render/lights/qspotlight_p.h b/src/render/lights/qspotlight_p.h
index 05f916083..66d5dfa6d 100644
--- a/src/render/lights/qspotlight_p.h
+++ b/src/render/lights/qspotlight_p.h
@@ -48,13 +48,13 @@
// We mean it.
//
-#include <private/qabstractlight_p.h>
+#include <private/qlight_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QSpotLightPrivate : public QAbstractLightPrivate
+class QSpotLightPrivate : public QLightPrivate
{
public:
QSpotLightPrivate();
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index c030225c4..9e07c5810 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -44,6 +44,7 @@
#include <private/qbackendnode_p.h>
#include <private/uniformbuffer_p.h>
#include <private/managers_p.h>
+#include <private/nodemanagers_p.h>
QT_BEGIN_NAMESPACE
@@ -55,9 +56,8 @@ namespace Render {
QList<Qt3DCore::QNodeId> ShaderData::m_updatedShaderData;
ShaderData::ShaderData()
- : QBackendNode()
- , m_manager(Q_NULLPTR)
- , m_mutex(new QMutex())
+ : m_mutex(new QMutex)
+ , m_managers(Q_NULLPTR)
{
}
@@ -66,6 +66,25 @@ ShaderData::~ShaderData()
delete m_mutex;
}
+void ShaderData::setManagers(NodeManagers *managers)
+{
+ m_managers = managers;
+}
+
+ShaderData *ShaderData::lookupResource(NodeManagers *managers, const QNodeId &id)
+{
+ ShaderData *shaderData = managers->shaderDataManager()->lookupResource(id);
+ if (!shaderData)
+ shaderData = managers->lightManager()->lookupResource(id);
+
+ return shaderData;
+}
+
+ShaderData *ShaderData::lookupResource(const QNodeId &id)
+{
+ return ShaderData::lookupResource(m_managers, id);
+}
+
void ShaderData::updateFromPeer(Qt3DCore::QNode *peer)
{
m_properties.clear();
@@ -76,7 +95,7 @@ void ShaderData::updateFromPeer(Qt3DCore::QNode *peer)
}
// Call by cleanup job (single thread)
-void ShaderData::clearUpdate()
+void ShaderData::clearUpdatedProperties()
{
m_updatedProperties.clear();
const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
@@ -85,19 +104,29 @@ void ShaderData::clearUpdate()
while (it != end) {
if (it.value().userType() == QMetaType::QVariantList) {
Q_FOREACH (const QVariant &v, it.value().value<QVariantList>()) {
- ShaderData *nested = m_manager->lookupResource(v.value<QNodeId>());
+ ShaderData *nested = lookupResource(v.value<QNodeId>());
if (nested != Q_NULLPTR)
- nested->clearUpdate();
+ nested->clearUpdatedProperties();
}
} else {
- ShaderData *nested = m_manager->lookupResource(it.value().value<QNodeId>());
+ ShaderData *nested = lookupResource(it.value().value<QNodeId>());
if (nested != Q_NULLPTR)
- nested->clearUpdate();
+ nested->clearUpdatedProperties();
}
++it;
}
}
+void ShaderData::cleanup(NodeManagers *managers)
+{
+ Q_FOREACH (const Qt3DCore::QNodeId &id, m_updatedShaderData) {
+ ShaderData *shaderData = ShaderData::lookupResource(managers, id);
+ if (shaderData)
+ shaderData->clearUpdatedProperties();
+ }
+ m_updatedShaderData.clear();
+}
+
// Called by renderview jobs (several concurrent threads)
/*!
\internal
@@ -108,7 +137,7 @@ void ShaderData::clearUpdate()
\note This needs to be performed for every top level ShaderData every time it is used.
As we don't know if the transformed properties use the same viewMatrix for all RenderViews.
*/
-bool ShaderData::needsUpdate(const QMatrix4x4 &viewMatrix)
+bool ShaderData::updateViewTransform(const QMatrix4x4 &viewMatrix)
{
// We can't perform this only once as we don't know if we would be call as the root or a
// nested ShaderData
@@ -137,13 +166,13 @@ bool ShaderData::needsUpdate(const QMatrix4x4 &viewMatrix)
QVariantList updatedNodes;
bool nestedNeedsUpdate = false;
Q_FOREACH (const QVariant &v, it.value().value<QVariantList>()) {
- ShaderData *nested = m_manager->lookupResource(v.value<QNodeId>());
+ ShaderData *nested = lookupResource(v.value<QNodeId>());
if (nested != Q_NULLPTR) {
// We need to add the nested nodes to the updated property list
// as we need to maintain order
// if node[0] doesn't need update but node[1] does,
// if we only have a single element, the renderer would update element [0]
- nestedNeedsUpdate |= nested->needsUpdate(viewMatrix);
+ nestedNeedsUpdate |= nested->updateViewTransform(viewMatrix);
updatedNodes << v;
}
}
@@ -151,8 +180,8 @@ bool ShaderData::needsUpdate(const QMatrix4x4 &viewMatrix)
if (nestedNeedsUpdate && !updatedNodes.empty())
m_updatedProperties.insert(it.key(), updatedNodes);
} else {
- ShaderData *nested = m_manager->lookupResource(it.value().value<QNodeId>());
- if (nested != Q_NULLPTR && nested->needsUpdate(viewMatrix))
+ ShaderData *nested = lookupResource(it.value().value<QNodeId>());
+ if (nested != Q_NULLPTR && nested->updateViewTransform(viewMatrix))
m_updatedProperties.insert(it.key(), it.value());
}
++it;
@@ -160,10 +189,10 @@ bool ShaderData::needsUpdate(const QMatrix4x4 &viewMatrix)
return m_updatedProperties.size() > 0;
}
-void ShaderData::updateTransformedProperties(const QMatrix4x4 &nodeWorldMatrix)
+bool ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
{
- if (m_worldMatrix != nodeWorldMatrix) {
- m_worldMatrix = nodeWorldMatrix;
+ if (m_worldMatrix != worldMatrix) {
+ m_worldMatrix = worldMatrix;
const QHash<QString, QShaderData::TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
QHash<QString, QShaderData::TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
@@ -179,12 +208,13 @@ void ShaderData::updateTransformedProperties(const QMatrix4x4 &nodeWorldMatrix)
++transformedIt;
}
}
+ return m_updatedProperties.size() > 0;
}
// This will add the ShaderData to be cleared from updates at the end of the frame
// by the cleanup job
// Called by renderview jobs (several concurrent threads)
-void ShaderData::addToClearUpdateList()
+void ShaderData::markDirty()
{
QMutexLocker lock(m_mutex);
if (!ShaderData::m_updatedShaderData.contains(peerUuid()))
@@ -236,11 +266,6 @@ void ShaderData::readPeerProperties(QShaderData *shaderData)
}
}
-void ShaderData::setManager(ShaderDataManager *manager)
-{
- m_manager = manager;
-}
-
void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
if (!m_propertyReader.isNull()) {
@@ -286,28 +311,28 @@ void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
}
}
-RenderShaderDataFunctor::RenderShaderDataFunctor(ShaderDataManager *manager)
- : m_manager(manager)
+RenderShaderDataFunctor::RenderShaderDataFunctor(NodeManagers *managers)
+ : m_managers(managers)
{
}
Qt3DCore::QBackendNode *RenderShaderDataFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
{
- ShaderData *backend = m_manager->getOrCreateResource(frontend->id());
+ ShaderData *backend = m_managers->shaderDataManager()->getOrCreateResource(frontend->id());
backend->setFactory(factory);
- backend->setManager(m_manager);
+ backend->setManagers(m_managers);
backend->setPeer(frontend);
return backend;
}
Qt3DCore::QBackendNode *RenderShaderDataFunctor::get(const Qt3DCore::QNodeId &id) const
{
- return m_manager->lookupResource(id);
+ return m_managers->shaderDataManager()->lookupResource(id);
}
void RenderShaderDataFunctor::destroy(const Qt3DCore::QNodeId &id) const
{
- m_manager->releaseResource(id);
+ m_managers->shaderDataManager()->releaseResource(id);
}
} // namespace Render
diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h
index b45395f07..d87ae8644 100644
--- a/src/render/materialsystem/shaderdata_p.h
+++ b/src/render/materialsystem/shaderdata_p.h
@@ -62,7 +62,7 @@ namespace Render {
class GraphicsContext;
class UniformBuffer;
-class ShaderDataManager;
+class NodeManagers;
class Q_AUTOTEST_EXPORT ShaderData : public Qt3DCore::QBackendNode
{
@@ -70,25 +70,25 @@ public:
ShaderData();
~ShaderData();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- inline QHash<QString, QVariant> properties() const { return m_properties; }
- inline QHash<QString, QVariant> updatedProperties() const { return m_updatedProperties; }
+ QHash<QString, QVariant> properties() const { return m_properties; }
+ QHash<QString, QVariant> updatedProperties() const { return m_updatedProperties; }
+
+ // Called by FramePreparationJob
+ bool updateWorldTransform(const QMatrix4x4 &worldMatrix);
- // Called by cleanup job
- inline static QList<Qt3DCore::QNodeId> updatedShaderDataList() { return m_updatedShaderData; }
- inline static void clearShaderDataList() { return m_updatedShaderData.clear(); }
- void clearUpdate();
+ // Call by RenderViewJob
+ void markDirty();
+ bool updateViewTransform(const QMatrix4x4 &viewMatrix);
- // Call by RenderViewJobs
- void addToClearUpdateList();
- bool needsUpdate(const QMatrix4x4 &viewMatrix);
+ // Called by FrameCleanupJob
+ static void cleanup(NodeManagers *managers);
- void updateTransformedProperties(const QMatrix4x4 &nodeWordlTransform);
+ void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
+ void setManagers(NodeManagers *managers);
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-private:
// 1 to 1 match with frontend properties, modified only by sceneChangeEvent
QHash<QString, QVariant> m_originalProperties;
// 1 to 1 match with frontend properties apart from Transformed
@@ -100,14 +100,16 @@ private:
PropertyReaderInterfacePtr m_propertyReader;
QHash<QString, QVariant> m_nestedShaderDataProperties;
QHash<QString, QShaderData::TransformType> m_transformedProperties;
- ShaderDataManager *m_manager;
QMutex *m_mutex;
static QList<Qt3DCore::QNodeId> m_updatedShaderData;
QMatrix4x4 m_worldMatrix;
QMatrix4x4 m_viewMatrix;
+ NodeManagers *m_managers;
void readPeerProperties(QShaderData *peer);
- void setManager(ShaderDataManager *manager);
+ void clearUpdatedProperties();
+ static ShaderData *lookupResource(NodeManagers *managers, const Qt3DCore::QNodeId &id);
+ ShaderData *lookupResource(const Qt3DCore::QNodeId &id);
friend class RenderShaderDataFunctor;
};
@@ -115,14 +117,14 @@ private:
class RenderShaderDataFunctor : public Qt3DCore::QBackendNodeFunctor
{
public:
- explicit RenderShaderDataFunctor(ShaderDataManager *manager);
+ explicit RenderShaderDataFunctor(NodeManagers *managers);
Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
private:
- ShaderDataManager *m_manager;
+ NodeManagers *m_managers;
};
} // namespace Render