summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2014-07-06 15:11:21 +0100
committerSean Harmer <sean.harmer@kdab.com>2014-07-18 13:27:25 +0200
commit2dc04a6dc47ac1395254ba48eff02c24979f0579 (patch)
treeaebd30f1785c6498feced0ac979ec23b87e91157 /examples
parent9bf4ff388888cbb853a2875a3a5bf02c034f029d (diff)
Add rollerball example to show rendering and physics basics
At present it only exercises the renderer but it will be extended to also cover the physics aspect too. Change-Id: I83217f09eeb3471b8a508fa8a8948410ad1e1d58 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/examples.pro8
-rw-r--r--examples/rollerball/AdsEffect.qml107
-rw-r--r--examples/rollerball/AdsMaterial.qml66
-rw-r--r--examples/rollerball/BallEntity.qml74
-rw-r--r--examples/rollerball/BasicCamera.qml71
-rw-r--r--examples/rollerball/ForwardRenderer.qml75
-rw-r--r--examples/rollerball/main.cpp68
-rw-r--r--examples/rollerball/main.qml113
-rw-r--r--examples/rollerball/rollerball.pro20
-rw-r--r--examples/rollerball/rollerball.qrc10
10 files changed, 612 insertions, 0 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
index 4085dc753..7c363c9a6 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -35,6 +35,10 @@ src_bigmodelqml.subdir = $$PWD/bigmodel-qml
src_bigmodelqml.target = sub-bigmodelqml
src_bigmodelqml.depends = src_exampleresources
+src_rollerball.subdir = $$PWD/rollerball
+src_rollerball.target = sub-rollerball
+src_rollerball.depends = src_exampleresources
+
SUBDIRS += \
src_exampleresources \
@@ -50,3 +54,7 @@ SUBDIRS += \
# TODO Port the old examples to new APIs
#SUBDIRS += qt3d
#qtHaveModule(qml): SUBDIRS += quick3d
+
+qtHaveModule(3dbulletphysics) {
+ SUBDIRS += src_rollerball
+}
diff --git a/examples/rollerball/AdsEffect.qml b/examples/rollerball/AdsEffect.qml
new file mode 100644
index 000000000..c1806e7b7
--- /dev/null
+++ b/examples/rollerball/AdsEffect.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+// For Qt.vector3d() and friends. For some reason this is provided by
+// QQuickValueTypeProvider in QtQuick rather than the default value
+// type provider in QtQml. So we will need to replicate this in Qt3D
+// for the types that we wish to support. Otherwise we'll have to import
+// QtQuick 2.1 all over the place.
+import QtQuick 2.1
+
+Effect {
+ id: root
+
+ // These parameters act as default values for the effect. They take
+ // priority over any parameters specified in the RenderPasses below
+ // (none provided in this example). In turn these parameters can be
+ // overwritten by specifying them in a Material that references this
+ // effect.
+ // The priority order is:
+ //
+ // Material -> Effect -> Technique -> RenderPass -> GLSL default values
+ parameters: [
+ Parameter { name: "ambient"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
+ Parameter { name: "diffuse"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },
+ Parameter { name: "specular"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
+ Parameter { name: "shininess"; value: root.shininess }
+ ]
+
+ techniques: [
+ Technique {
+ criteria : [
+ TechniqueCriterion {
+ criterionType: TechniqueCriterion.RenderingStyle
+ criterionValue : "forward"
+ }
+ ]
+
+ parameters : [
+ Parameter { name: "lightPosition"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },
+ Parameter { name: "lightIntensity"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) }
+ ]
+
+ renderPasses: [
+ RenderPass {
+ criteria: []
+
+ // The bindings property allows us to map from names of parameters (uniforms or vertex attributes)
+ // within a shader to more friendly names in QML. By default the parameter names are exposed from
+ // the shader so we only need to add add mappings where the names differ. E.g. here we map from the
+ // ka uniform name in the shader to a property called ambient
+ bindings: [
+ // Uniforms (those provided by the user)
+ ParameterMapper { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapper.Uniform},
+ ParameterMapper { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapper.Uniform},
+ ParameterMapper { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapper.Uniform}
+ ]
+
+ shaderProgram: ShaderProgram {
+ vertexSourceFile: ":/shaders/phong.vert"
+ fragmentSourceFile: ":/shaders/phong.frag"
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/examples/rollerball/AdsMaterial.qml b/examples/rollerball/AdsMaterial.qml
new file mode 100644
index 000000000..cf8718458
--- /dev/null
+++ b/examples/rollerball/AdsMaterial.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+// For Qt.vector3d() and friends. For some reason this is provided by
+// QQuickValueTypeProvider in QtQuick rather than the default value
+// type provider in QtQml. So we will need to replicate this in Qt3D
+// for the types that we wish to support. Otherwise we'll have to import
+// QtQuick 2.1 all over the place.
+import QtQuick 2.1 as QQ2
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
+ property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )
+ property real shininess: 150.0
+
+ parameters: [
+ Parameter { name: "ambient"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "specular"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess }
+ ]
+}
diff --git a/examples/rollerball/BallEntity.qml b/examples/rollerball/BallEntity.qml
new file mode 100644
index 000000000..458e15b77
--- /dev/null
+++ b/examples/rollerball/BallEntity.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+// For Qt.vector3d() and friends. For some reason this is provided by
+// QQuickValueTypeProvider in QtQuick rather than the default value
+// type provider in QtQml. So we will need to replicate this in Qt3D
+// for the types that we wish to support. Otherwise we'll have to import
+// QtQuick 2.1 all over the place.
+import QtQuick 2.1 as QQ2
+
+Entity {
+ id: root
+
+ property real x: 0.0
+ property real y: 0.0
+ property real z: 0.0
+ property real scale: 1.0
+ property Material material
+
+ components: [ transform, mesh, root.material ]
+
+ Transform {
+ id: transform
+ Translate { dx: root.x; dy: root.y; dz: root.z }
+ Scale { scale: root.scale }
+ }
+
+ SphereMesh {
+ id: mesh
+ rings: 50
+ slices: 100
+ }
+}
diff --git a/examples/rollerball/BasicCamera.qml b/examples/rollerball/BasicCamera.qml
new file mode 100644
index 000000000..1c338e7b4
--- /dev/null
+++ b/examples/rollerball/BasicCamera.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+// For Qt.vector3d() and friends. For some reason this is provided by
+// QQuickValueTypeProvider in QtQuick rather than the default value
+// type provider in QtQml. So we will need to replicate this in Qt3D
+// for the types that we wish to support. Otherwise we'll have to import
+// QtQuick 2.1 all over the place.
+import QtQuick 2.1 as QQ2
+
+Camera {
+ id: mainCamera
+ objectName: "mainCamera"
+
+ lens: CameraLens {
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 22.5
+ aspectRatio: 16 / 9 // TODO: Hook up to window aspect ratio
+ nearPlane: 0.01
+ farPlane: 1000.0
+ }
+
+ transform: Transform {
+ LookAt {
+ position: Qt.vector3d( 0.0, 0.0, 50.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 10.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ }
+ }
+}
diff --git a/examples/rollerball/ForwardRenderer.qml b/examples/rollerball/ForwardRenderer.qml
new file mode 100644
index 000000000..6ab3107e1
--- /dev/null
+++ b/examples/rollerball/ForwardRenderer.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+TechniqueFilter {
+ id: root
+ objectName : "techniqueFilter"
+
+ // Expose camera to allow user to choose which camera to use for rendering
+ property alias camera: cameraSelector.camera
+
+ // Select the forward rendering Technique of any used Effect
+ criteria : [
+ TechniqueCriterion {
+ criterionType: TechniqueCriterion.RenderingStyle;
+ criterionValue : "forward"
+ }
+ ]
+
+ // Use the whole viewport
+ Viewport {
+ id: viewport
+ objectName : "viewport"
+ rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+
+ // Use the specified camera
+ CameraSelector {
+ id : cameraSelector
+ objectName : "cameraSelector"
+
+ // Use a single pass called "lighting" from the selected Technique
+ RenderPassFilter { renderPassName: "lighting" }
+ }
+ }
+}
diff --git a/examples/rollerball/main.cpp b/examples/rollerball/main.cpp
new file mode 100644
index 000000000..7c230ea8a
--- /dev/null
+++ b/examples/rollerball/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuick/quickwindow.h>
+#include <Qt3DRenderer/rendereraspect.h>
+#include <Qt3DBulletPhysics/bulletphysicsaspect.h>
+
+#include <exampleresources.h>
+
+#include <QGuiApplication>
+#include <QtQml>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ initializeAssetResources("../exampleresources/example-assets.qrb");
+
+ Qt3D::Quick::QuickWindow view;
+ view.registerAspect(new Qt3D::RendererAspect());
+ view.registerAspect(new Qt3D::BulletPhysicsAspect());
+ // There should be some synchronising mechanism to make sure
+ // the source is set after all aspects have been completely initialized
+ // Otherwise we might encounter cases where an Aspect's QML elements have
+ // not yet been registered
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/rollerball/main.qml b/examples/rollerball/main.qml
new file mode 100644
index 000000000..c6e56d7f4
--- /dev/null
+++ b/examples/rollerball/main.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 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 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Render 2.0
+
+// For Qt.vector3d() and friends. For some reason this is provided by
+// QQuickValueTypeProvider in QtQuick rather than the default value
+// type provider in QtQml. So we will need to replicate this in Qt3D
+// for the types that we wish to support. Otherwise we'll have to import
+// QtQuick 2.1 all over the place.
+import QtQuick 2.1 as QQ2
+
+Entity {
+ id: root
+ objectName: "root"
+
+ // Use the renderer configuration specified in ForwardRenderer.qml
+ // and render from the mainCamera
+ components: [
+ FrameGraph {
+ activeFrameGraph: ForwardRenderer {
+ id: renderer
+ camera: mainCamera
+ }
+ }
+ ]
+
+ BasicCamera {
+ id: mainCamera
+ }
+
+ Configuration {
+ controlledCamera: mainCamera
+ }
+
+ AdsEffect {
+ id: adsEffect
+ }
+
+ AdsMaterial {
+ id: redMaterial
+ effect: adsEffect
+ ambient: Qt.rgba( 0.5, 0.0, 0.0, 1.0 )
+ }
+
+ AdsMaterial {
+ id: greenMaterial
+ effect: adsEffect
+ ambient: Qt.rgba( 0.0, 0.5, 0.0, 1.0 )
+ }
+
+ AdsMaterial {
+ id: blueMaterial
+ effect: adsEffect
+ ambient: Qt.rgba( 0.0, 0.0, 0.5, 1.0 )
+ }
+
+ BallEntity {
+ id: redBall
+ material: redMaterial
+ x: -5
+ }
+
+ BallEntity {
+ id: greenBall
+ material: greenMaterial
+ }
+
+ BallEntity {
+ id: blueBall
+ material: blueMaterial
+ x: 5
+ }
+}
diff --git a/examples/rollerball/rollerball.pro b/examples/rollerball/rollerball.pro
new file mode 100644
index 000000000..ec3071736
--- /dev/null
+++ b/examples/rollerball/rollerball.pro
@@ -0,0 +1,20 @@
+TEMPLATE = app
+
+QT += 3dcore 3drenderer 3dbulletphysics 3dquick qml quick
+
+include("../exampleresources/exampleresources.pri")
+
+HEADERS += \
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ AdsEffect.qml \
+ Renderable.qml \
+ SimpleEffect.qml \
+ ForwardRenderer.qml
+
+RESOURCES += \
+ rollerball.qrc
diff --git a/examples/rollerball/rollerball.qrc b/examples/rollerball/rollerball.qrc
new file mode 100644
index 000000000..e51927697
--- /dev/null
+++ b/examples/rollerball/rollerball.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>AdsEffect.qml</file>
+ <file>ForwardRenderer.qml</file>
+ <file>BasicCamera.qml</file>
+ <file>AdsMaterial.qml</file>
+ <file>BallEntity.qml</file>
+ </qresource>
+</RCC>