summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/shadow-map-qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/shadow-map-qml')
-rw-r--r--examples/qt3d/shadow-map-qml/AdsEffect.qml148
-rw-r--r--examples/qt3d/shadow-map-qml/AdsMaterial.qml54
-rw-r--r--examples/qt3d/shadow-map-qml/GroundPlane.qml63
-rw-r--r--examples/qt3d/shadow-map-qml/Light.qml61
-rw-r--r--examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml102
-rw-r--r--examples/qt3d/shadow-map-qml/Toyplane.qml143
-rw-r--r--examples/qt3d/shadow-map-qml/Trefoil.qml76
-rw-r--r--examples/qt3d/shadow-map-qml/main.cpp72
-rw-r--r--examples/qt3d/shadow-map-qml/main.qml105
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/ads.frag93
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/ads.vert66
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/es3/ads.frag95
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/es3/ads.vert66
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.frag43
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.vert46
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/shadowmap.frag41
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/shadowmap.vert46
-rw-r--r--examples/qt3d/shadow-map-qml/shadow-map-qml.pro21
-rw-r--r--examples/qt3d/shadow-map-qml/shadow-map-qml.qrc23
19 files changed, 1364 insertions, 0 deletions
diff --git a/examples/qt3d/shadow-map-qml/AdsEffect.qml b/examples/qt3d/shadow-map-qml/AdsEffect.qml
new file mode 100644
index 000000000..1ddc58f3b
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/AdsEffect.qml
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+
+Effect {
+ id: root
+
+ property Texture2D shadowTexture
+ property Light light
+
+ // 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: "lightViewProjection"; value: root.light.lightViewProjection },
+ Parameter { name: "lightPosition"; value: root.light.lightPosition },
+ Parameter { name: "lightIntensity"; value: root.light.lightIntensity },
+
+ Parameter { name: "shadowMapTexture"; value: root.shadowTexture }
+ ]
+
+ techniques: [
+ Technique {
+ openGLFilter {
+ api: OpenGLFilter.Desktop
+ profile: OpenGLFilter.Core
+ majorVersion: 3
+ minorVersion: 2
+ }
+
+ renderPasses: [
+ RenderPass {
+ annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/shaders/shadowmap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/shadowmap.frag")
+ }
+
+ renderStates: [
+ PolygonOffset { factor: 4; units: 4 },
+ DepthTest { func: DepthTest.Less }
+ ]
+ },
+
+ RenderPass {
+ annotations: [ Annotation { name : "pass"; value : "forward" } ]
+
+ // 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)
+ ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
+ ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
+ ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
+ ]
+
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/shaders/ads.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/ads.frag")
+ }
+
+ // no special render state set => use the default set of states
+ }
+ ]
+ },
+ Technique {
+ openGLFilter {
+ api: OpenGLFilter.ES
+ majorVersion: 3
+ minorVersion: 0
+ }
+
+ renderPasses: [
+ RenderPass {
+ annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/shaders/es3/shadowmap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es3/shadowmap.frag")
+ }
+
+ renderStates: [
+ PolygonOffset { factor: 4; units: 4 },
+ DepthTest { func: DepthTest.Less }
+ ]
+ },
+
+ RenderPass {
+ annotations: [ Annotation { name : "pass"; value : "forward" } ]
+
+ bindings: [
+ ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
+ ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
+ ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
+ ]
+
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/shaders/es3/ads.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es3/ads.frag")
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/examples/qt3d/shadow-map-qml/AdsMaterial.qml b/examples/qt3d/shadow-map-qml/AdsMaterial.qml
new file mode 100644
index 000000000..322c7b9ac
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/AdsMaterial.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+import QtQuick 2.1
+
+Material {
+ id: root
+ property color ambientColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
+ property color diffuseColor: Qt.rgba(0.7, 0.7, 0.9, 1.0)
+ property color specularColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
+ property real shininess: 150.0
+
+ parameters: [
+ Parameter { name: "ambient"; value: Qt.vector3d(root.ambientColor.r, root.ambientColor.g, root.ambientColor.b) },
+ Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuseColor.r, root.diffuseColor.g, root.diffuseColor.b) },
+ Parameter { name: "specular"; value: Qt.vector3d(root.specularColor.r, root.specularColor.g, root.specularColor.b) },
+ Parameter { name: "shininess"; value: root.shininess }
+ ]
+}
diff --git a/examples/qt3d/shadow-map-qml/GroundPlane.qml b/examples/qt3d/shadow-map-qml/GroundPlane.qml
new file mode 100644
index 000000000..b863da3b5
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/GroundPlane.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+ property Material material
+
+ PlaneMesh {
+ id: groundMesh
+ width: 50
+ height: width
+ meshResolution: Qt.size(2, 2)
+ }
+
+ Transform {
+ id: groundTransform
+ Translate {
+ dy: -5
+ }
+ }
+
+ components: [
+ groundMesh,
+ groundTransform,
+ material
+ ]
+}
diff --git a/examples/qt3d/shadow-map-qml/Light.qml b/examples/qt3d/shadow-map-qml/Light.qml
new file mode 100644
index 000000000..ca03f070f
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/Light.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property vector3d lightPosition: Qt.vector3d(30.0, 30.0, 0.0)
+ property vector3d lightIntensity: Qt.vector3d(1.0, 1.0, 1.0)
+
+ readonly property Camera lightCamera: lightCamera
+ readonly property matrix4x4 lightViewProjection: lightCamera.projectionMatrix.times(lightCamera.matrix)
+
+ Camera {
+ id: lightCamera
+ objectName: "lightCameraLens"
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 1
+ nearPlane : 0.1
+ farPlane : 200.0
+ position: root.lightPosition
+ viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
+ upVector: Qt.vector3d(0.0, 1.0, 0.0)
+ }
+}
diff --git a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml
new file mode 100644
index 000000000..b6932a76d
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+import QtQuick 2.2 as QQ2
+
+FrameGraph {
+ id: root
+
+ property alias viewCamera: viewCameraSelector.camera
+ property alias lightCamera: lightCameraSelector.camera
+ readonly property Texture2D shadowTexture: depthTexture
+
+ activeFrameGraph: Viewport {
+ rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+ clearColor: Qt.rgba(0.0, 0.4, 0.7, 1.0)
+
+ RenderPassFilter {
+ includes: [ Annotation { name: "pass"; value: "shadowmap" } ]
+
+ RenderTargetSelector {
+ target: RenderTarget {
+ attachments: [
+ RenderAttachment {
+ name: "depth"
+ type: RenderAttachment.DepthAttachment
+ texture: Texture2D {
+ id: depthTexture
+ width: 1024
+ height: 1024
+ format: Texture.DepthFormat
+ generateMipMaps: false
+ magnificationFilter: Texture.Linear
+ minificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ comparisonFunction: Texture.CompareLessEqual
+ comparisonMode: Texture.CompareRefToTexture
+ }
+ }
+ ]
+ }
+
+ ClearBuffer {
+ buffers: ClearBuffer.DepthBuffer
+
+ CameraSelector {
+ id: lightCameraSelector
+ }
+ }
+ }
+ }
+
+ RenderPassFilter {
+ includes: [ Annotation { name: "pass"; value: "forward" } ]
+
+ ClearBuffer {
+ buffers: ClearBuffer.ColorDepthBuffer
+
+ CameraSelector {
+ id: viewCameraSelector
+ }
+ }
+ }
+ }
+}
diff --git a/examples/qt3d/shadow-map-qml/Toyplane.qml b/examples/qt3d/shadow-map-qml/Toyplane.qml
new file mode 100644
index 000000000..61c803469
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/Toyplane.qml
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+import QtQuick 2.1 as QQ2
+
+Entity {
+ id: root
+ property Material material
+
+ Mesh {
+ id: toyplaneMesh
+ source: "assets/obj/toyplane.obj"
+ }
+
+ Transform {
+ id: toyplaneTransform
+
+ property real rollAngle : 0
+ property real pitchAngle : 15
+ property real altitude : 5
+ property real angle: 0
+ property real scaleFactor: 10
+
+ QQ2.Behavior on rollAngle { QQ2.SpringAnimation { spring: 2; damping: 0.2} }
+
+ Scale {
+ scale: 1.0 / toyplaneTransform.scaleFactor
+ }
+
+ Rotate { // roll
+ axis : Qt.vector3d(1, 0, 0)
+ angle : toyplaneTransform.rollAngle
+ }
+
+ Rotate { // pitch
+ axis : Qt.vector3d(0, 0, 1)
+ angle : toyplaneTransform.pitchAngle
+ }
+
+ Rotate {
+ id: toyplaneRotation
+ axis: Qt.vector3d(0, 1, 0)
+ angle: toyplaneTransform.angle
+ }
+
+ Translate {
+ property real translation: 1
+
+ dx: Math.sin(toyplaneTransform.angle * Math.PI / 180) * translation * toyplaneTransform.scaleFactor
+ dy: toyplaneTransform.altitude
+ dz: Math.cos(toyplaneTransform.angle * Math.PI / 180) * translation * toyplaneTransform.scaleFactor
+ }
+ }
+
+ QQ2.NumberAnimation {
+ target: toyplaneTransform
+
+ running: true
+ loops: QQ2.Animation.Infinite
+
+ property: "angle"
+ duration: 10000
+ from: 0
+ to: 360
+ }
+
+ // Altitude / Pitch animation
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.ParallelAnimation {
+ QQ2.SequentialAnimation {
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: 0; to: 30; duration: 2000; easing.type: QQ2.Easing.OutQuad }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: 30; to: 0; duration: 2000; easing.type: QQ2.Easing.OutSine }
+ }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "altitude"; to: 5; duration: 4000; easing.type: QQ2.Easing.InOutCubic }
+ }
+ QQ2.PauseAnimation { duration: 1500 }
+ QQ2.ParallelAnimation {
+ QQ2.SequentialAnimation {
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: 0; to: -30; duration: 1000; easing.type: QQ2.Easing.OutQuad }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "pitchAngle"; from: -30; to: 0; duration: 5000; easing.type: QQ2.Easing.OutSine }
+ }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "altitude"; to: 0; duration: 6000; easing.type: QQ2.Easing.InOutCubic}
+ }
+ QQ2.PauseAnimation { duration: 1500 }
+ }
+
+ // Roll Animation
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; to: 360; duration: 1500; easing.type: QQ2.Easing.InOutQuad }
+ QQ2.PauseAnimation { duration: 1000 }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; from: 0; to: 30; duration: 1000; easing.type: QQ2.Easing.OutQuart }
+ QQ2.PauseAnimation { duration: 1500 }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; from: 30; to: -30; duration: 1000; easing.type: QQ2.Easing.OutQuart }
+ QQ2.PauseAnimation { duration: 1500 }
+ QQ2.NumberAnimation { target: toyplaneTransform; property: "rollAngle"; from: -30; to: 0; duration: 750; easing.type: QQ2.Easing.OutQuart }
+ QQ2.PauseAnimation { duration: 2000 }
+ }
+
+ components: [
+ toyplaneMesh,
+ toyplaneTransform,
+ material
+ ]
+}
diff --git a/examples/qt3d/shadow-map-qml/Trefoil.qml b/examples/qt3d/shadow-map-qml/Trefoil.qml
new file mode 100644
index 000000000..341ee6c23
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/Trefoil.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+import QtQuick 2.1 as QQ2
+
+Entity {
+ id: root
+ property Material material
+
+ Mesh {
+ id: trefoilMesh
+ source: "assets/obj/trefoil.obj"
+ }
+
+ Transform {
+ id: trefoilMeshTransform
+
+ Rotate {
+ id: trefoilMeshRotation
+ axis: Qt.vector3d(0, 1, 0)
+ }
+ }
+
+ QQ2.NumberAnimation {
+ target: trefoilMeshRotation
+
+ running: true
+ loops: QQ2.Animation.Infinite
+
+ property: "angle"
+ duration: 5000
+ from: 360
+ to: 0
+ }
+
+ components: [
+ trefoilMesh,
+ trefoilMeshTransform,
+ material
+ ]
+}
diff --git a/examples/qt3d/shadow-map-qml/main.cpp b/examples/qt3d/shadow-map-qml/main.cpp
new file mode 100644
index 000000000..31836bf9d
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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: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 <Qt3DCore/window.h>
+#include <Qt3DRenderer/qrenderaspect.h>
+#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuick/QQmlAspectEngine>
+
+#include <QGuiApplication>
+#include <QQmlContext>
+#include <QQmlEngine>
+
+#include <exampleresources.h>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ initializeAssetResources("../exampleresources/example-assets.qrb");
+
+ Qt3D::Window view;
+ Qt3D::Quick::QQmlAspectEngine engine;
+
+ view.resize(1600, 800);
+ engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect());
+ engine.aspectEngine()->registerAspect(new Qt3D::QInputAspect());
+ engine.aspectEngine()->initialize();
+ QVariantMap data;
+ data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
+ data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
+ engine.aspectEngine()->setData(data);
+ engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ engine.setSource(QUrl("qrc:/main.qml"));
+
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/examples/qt3d/shadow-map-qml/main.qml b/examples/qt3d/shadow-map-qml/main.qml
new file mode 100644
index 000000000..59040c39b
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/main.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** 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: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 Qt3D 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: _window.width / _window.height
+ nearPlane: 0.1
+ farPlane: 1000.0
+ position: Qt.vector3d(0.0, 10.0, 20.0)
+ viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
+ upVector: Qt.vector3d(0.0, 1.0, 0.0)
+ }
+
+ Configuration {
+ controlledCamera: camera
+ }
+
+ Light {
+ id: light
+ }
+
+ components: [
+ ShadowMapFrameGraph {
+ id: framegraph
+ viewCamera: camera
+ lightCamera: light.lightCamera
+ }
+ ]
+
+
+ AdsEffect {
+ id: shadowMapEffect
+
+ shadowTexture: framegraph.shadowTexture
+ light: light
+ }
+
+
+ // Trefoil knot entity
+ Trefoil {
+ material: AdsMaterial {
+ effect: shadowMapEffect
+ specularColor: Qt.rgba(0.5, 0.5, 0.5, 1.0)
+ }
+ }
+
+ // Toyplane entity
+ Toyplane {
+ material: AdsMaterial {
+ effect: shadowMapEffect
+ diffuseColor: Qt.rgba(0.9, 0.5, 0.3, 1.0)
+ shininess: 75
+ }
+ }
+
+ // Plane entity
+ GroundPlane {
+ material: AdsMaterial {
+ effect: shadowMapEffect
+ diffuseColor: Qt.rgba(0.2, 0.5, 0.3, 1.0)
+ specularColor: Qt.rgba(0, 0, 0, 1.0)
+ }
+ }
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/ads.frag b/examples/qt3d/shadow-map-qml/shaders/ads.frag
new file mode 100644
index 000000000..b2b056a3a
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/ads.frag
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** 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: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$
+**
+****************************************************************************/
+
+#version 150 core
+
+uniform mat4 viewMatrix;
+
+uniform vec3 lightPosition;
+uniform vec3 lightIntensity;
+
+uniform vec3 ka; // Ambient reflectivity
+uniform vec3 kd; // Diffuse reflectivity
+uniform vec3 ks; // Specular reflectivity
+uniform float shininess; // Specular shininess factor
+
+uniform sampler2DShadow shadowMapTexture;
+
+in vec4 positionInLightSpace;
+
+in vec3 position;
+in vec3 normal;
+
+out vec4 fragColor;
+
+vec3 dsModel(const in vec3 pos, const in vec3 n)
+{
+ // Calculate the vector from the light to the fragment
+ vec3 s = normalize(vec3(viewMatrix * vec4(lightPosition, 1.0)) - pos);
+
+ // Calculate the vector from the fragment to the eye position
+ // (origin since this is in "eye" or "camera" space)
+ vec3 v = normalize(-pos);
+
+ // Reflect the light beam using the normal at this fragment
+ vec3 r = reflect(-s, n);
+
+ // Calculate the diffuse component
+ float diffuse = max(dot(s, n), 0.0);
+
+ // Calculate the specular component
+ float specular = 0.0;
+ if (dot(s, n) > 0.0)
+ specular = pow(max(dot(r, v), 0.0), shininess);
+
+ // Combine the diffuse and specular contributions (ambient is taken into account by the caller)
+ return lightIntensity * (kd * diffuse + ks * specular);
+}
+
+void main()
+{
+ float shadowMapSample = textureProj(shadowMapTexture, positionInLightSpace);
+
+ vec3 ambient = lightIntensity * ka;
+
+ vec3 result = ambient;
+ if (shadowMapSample > 0)
+ result += dsModel(position, normalize(normal));
+
+ fragColor = vec4(result, 1.0);
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/ads.vert b/examples/qt3d/shadow-map-qml/shaders/ads.vert
new file mode 100644
index 000000000..e77a8f287
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/ads.vert
@@ -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: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$
+**
+****************************************************************************/
+
+#version 150 core
+
+in vec3 vertexPosition;
+in vec3 vertexNormal;
+
+out vec4 positionInLightSpace;
+out vec3 position;
+out vec3 normal;
+
+uniform mat4 lightViewProjection;
+uniform mat4 modelMatrix;
+uniform mat4 modelView;
+uniform mat3 modelViewNormal;
+uniform mat4 mvp;
+
+void main()
+{
+ // positionInLightSpace = lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
+ const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0,
+ 0.0, 0.5, 0.0, 0.0,
+ 0.0, 0.0, 0.5, 0.0,
+ 0.5, 0.5, 0.5, 1.0);
+
+ positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
+
+ normal = normalize(modelViewNormal * vertexNormal);
+ position = vec3(modelView * vec4(vertexPosition, 1.0));
+
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/es3/ads.frag b/examples/qt3d/shadow-map-qml/shaders/es3/ads.frag
new file mode 100644
index 000000000..30977cf1e
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/es3/ads.frag
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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: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$
+**
+****************************************************************************/
+
+#version 300 es
+
+precision highp float;
+
+uniform mat4 viewMatrix;
+
+uniform vec3 lightPosition;
+uniform vec3 lightIntensity;
+
+uniform vec3 ka; // Ambient reflectivity
+uniform vec3 kd; // Diffuse reflectivity
+uniform vec3 ks; // Specular reflectivity
+uniform float shininess; // Specular shininess factor
+
+uniform sampler2DShadow shadowMapTexture;
+
+in vec4 positionInLightSpace;
+
+in vec3 position;
+in vec3 normal;
+
+out vec4 fragColor;
+
+vec3 dsModel(const in vec3 pos, const in vec3 n)
+{
+ // Calculate the vector from the light to the fragment
+ vec3 s = normalize(vec3(viewMatrix * vec4(lightPosition, 1.0)) - pos);
+
+ // Calculate the vector from the fragment to the eye position
+ // (origin since this is in "eye" or "camera" space)
+ vec3 v = normalize(-pos);
+
+ // Reflect the light beam using the normal at this fragment
+ vec3 r = reflect(-s, n);
+
+ // Calculate the diffuse component
+ float diffuse = max(dot(s, n), 0.0);
+
+ // Calculate the specular component
+ float specular = 0.0;
+ if (dot(s, n) > 0.0)
+ specular = pow(max(dot(r, v), 0.0), shininess);
+
+ // Combine the diffuse and specular contributions (ambient is taken into account by the caller)
+ return lightIntensity * (kd * diffuse + ks * specular);
+}
+
+void main()
+{
+ float shadowMapSample = textureProj(shadowMapTexture, positionInLightSpace);
+
+ vec3 ambient = lightIntensity * ka;
+
+ vec3 result = ambient;
+ if (shadowMapSample > 0.0)
+ result += dsModel(position, normalize(normal));
+
+ fragColor = vec4(result, 1.0);
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/es3/ads.vert b/examples/qt3d/shadow-map-qml/shaders/es3/ads.vert
new file mode 100644
index 000000000..c304fbaad
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/es3/ads.vert
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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: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$
+**
+****************************************************************************/
+
+#version 300 es
+
+in vec3 vertexPosition;
+in vec3 vertexNormal;
+
+out vec4 positionInLightSpace;
+out vec3 position;
+out vec3 normal;
+
+uniform mat4 lightViewProjection;
+uniform mat4 modelMatrix;
+uniform mat4 modelView;
+uniform mat3 modelViewNormal;
+uniform mat4 mvp;
+
+void main()
+{
+ // positionInLightSpace = lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
+ const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0,
+ 0.0, 0.5, 0.0, 0.0,
+ 0.0, 0.0, 0.5, 0.0,
+ 0.5, 0.5, 0.5, 1.0);
+
+ positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0);
+
+ normal = normalize(modelViewNormal * vertexNormal);
+ position = vec3(modelView * vec4(vertexPosition, 1.0));
+
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.frag b/examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.frag
new file mode 100644
index 000000000..22fe0431b
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.frag
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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: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$
+**
+****************************************************************************/
+
+#version 300 es
+
+precision highp float;
+
+void main()
+{
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.vert b/examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.vert
new file mode 100644
index 000000000..1fe6b3724
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/es3/shadowmap.vert
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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: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$
+**
+****************************************************************************/
+
+#version 300 es
+
+in vec3 vertexPosition;
+
+uniform mat4 mvp;
+
+void main()
+{
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag b/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
new file mode 100644
index 000000000..becac915e
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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: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$
+**
+****************************************************************************/
+
+#version 150 core
+
+void main()
+{
+}
diff --git a/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert b/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
new file mode 100644
index 000000000..a0b81a846
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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: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$
+**
+****************************************************************************/
+
+#version 150 core
+
+in vec3 vertexPosition;
+
+uniform mat4 mvp;
+
+void main()
+{
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+}
diff --git a/examples/qt3d/shadow-map-qml/shadow-map-qml.pro b/examples/qt3d/shadow-map-qml/shadow-map-qml.pro
new file mode 100644
index 000000000..7d7670022
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shadow-map-qml.pro
@@ -0,0 +1,21 @@
+TEMPLATE = app
+
+QT += 3dcore 3drenderer 3dinput 3dquick qml quick
+
+include("../exampleresources/exampleresources.pri")
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ AdsMaterial.qml \
+ AdsEffect.qml \
+ Light.qml \
+ ShadowMapFrameGraph.qml \
+ Trefoil.qml \
+ Toyplane.qml \
+ GroundPlane.qml
+
+RESOURCES += \
+ shadow-map-qml.qrc
diff --git a/examples/qt3d/shadow-map-qml/shadow-map-qml.qrc b/examples/qt3d/shadow-map-qml/shadow-map-qml.qrc
new file mode 100644
index 000000000..9aa6e2c73
--- /dev/null
+++ b/examples/qt3d/shadow-map-qml/shadow-map-qml.qrc
@@ -0,0 +1,23 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>AdsMaterial.qml</file>
+ <file>AdsEffect.qml</file>
+ <file>Light.qml</file>
+ <file>ShadowMapFrameGraph.qml</file>
+
+ <file>Trefoil.qml</file>
+ <file>Toyplane.qml</file>
+ <file>GroundPlane.qml</file>
+
+ <file>shaders/ads.frag</file>
+ <file>shaders/ads.vert</file>
+ <file>shaders/shadowmap.frag</file>
+ <file>shaders/shadowmap.vert</file>
+ <file>shaders/es3/ads.frag</file>
+ <file>shaders/es3/ads.vert</file>
+ <file>shaders/es3/shadowmap.frag</file>
+ <file>shaders/es3/shadowmap.vert</file>
+ </qresource>
+</RCC>
+