summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/lights
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2017-01-27 10:35:42 +0100
committerKevin Ottens <kevin.ottens@kdab.com>2017-01-27 14:59:30 +0000
commite6444f7d6626390711c31dd2cb3f3d25eb60c812 (patch)
tree35cda7ca59dd0675563e6bd223de5ac012531875 /examples/qt3d/lights
parent35bbe830ff61677d5de130bfedb2f5301b8a4e0a (diff)
Resurect ForwardRenderer.qml in an example
Could be useful to have it around in an example still, so that people get an idea on how to make their own framegraph in QML from scratch. Some other examples have QML framegraphs too, but this one is simpler. Change-Id: I9065af920b1233d3f06cfee71c59afe98359cb7e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/lights')
-rw-r--r--examples/qt3d/lights/SimpleForwardRenderer.qml77
-rw-r--r--examples/qt3d/lights/lights.qrc1
-rw-r--r--examples/qt3d/lights/main.qml2
3 files changed, 79 insertions, 1 deletions
diff --git a/examples/qt3d/lights/SimpleForwardRenderer.qml b/examples/qt3d/lights/SimpleForwardRenderer.qml
new file mode 100644
index 000000000..b7ad3188c
--- /dev/null
+++ b/examples/qt3d/lights/SimpleForwardRenderer.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+TechniqueFilter {
+ // Expose camera to allow user to choose which camera to use for rendering
+ property alias camera: cameraSelector.camera
+ property alias clearColor: clearBuffer.clearColor
+ property alias viewportRect: viewport.normalizedRect
+ property alias window: surfaceSelector.surface
+ property alias externalRenderTargetSize: surfaceSelector.externalRenderTargetSize
+ property alias frustumCulling: frustumCulling.enabled
+
+ // Select the forward rendering Technique of any used Effect
+ matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
+
+ RenderSurfaceSelector {
+ id: surfaceSelector
+
+ // Use the whole viewport
+ Viewport {
+ id: viewport
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+
+ // Use the specified camera
+ CameraSelector {
+ id : cameraSelector
+ FrustumCulling {
+ id: frustumCulling
+ ClearBuffers {
+ id: clearBuffer
+ clearColor: "white"
+ buffers : ClearBuffers.ColorDepthBuffer
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/qt3d/lights/lights.qrc b/examples/qt3d/lights/lights.qrc
index caa3f2d28..278abe5ae 100644
--- a/examples/qt3d/lights/lights.qrc
+++ b/examples/qt3d/lights/lights.qrc
@@ -2,5 +2,6 @@
<qresource prefix="/">
<file>main.qml</file>
<file>PlaneEntity.qml</file>
+ <file>SimpleForwardRenderer.qml</file>
</qresource>
</RCC>
diff --git a/examples/qt3d/lights/main.qml b/examples/qt3d/lights/main.qml
index 69250da13..c676335c4 100644
--- a/examples/qt3d/lights/main.qml
+++ b/examples/qt3d/lights/main.qml
@@ -58,7 +58,7 @@ Entity
{
components: [
RenderSettings {
- activeFrameGraph: ForwardRenderer {
+ activeFrameGraph: SimpleForwardRenderer {
clearColor: Qt.rgba(0, 0, 0, 1)
camera: camera
}