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.qml1
-rw-r--r--examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc78
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/ads.frag48
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/ads.vert48
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/shadowmap.frag52
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/shadowmap.vert52
6 files changed, 170 insertions, 109 deletions
diff --git a/examples/qt3d/shadow-map-qml/AdsEffect.qml b/examples/qt3d/shadow-map-qml/AdsEffect.qml
index 9bc81bf4c..4c63a682c 100644
--- a/examples/qt3d/shadow-map-qml/AdsEffect.qml
+++ b/examples/qt3d/shadow-map-qml/AdsEffect.qml
@@ -69,7 +69,6 @@ Effect {
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 }
]
diff --git a/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc b/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc
index ad6190e95..3b6425b06 100644
--- a/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc
+++ b/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc
@@ -74,7 +74,7 @@
\printuntil }
- This light entity is used by our custom framegraph, ShadowMapFrameGraph,
+ This light entity is used by our custom frame graph, ShadowMapFrameGraph,
and our rendering effect, AdsEffect, whose instances are created just after
the light:
@@ -111,8 +111,8 @@
\section1 Configuring the Framegraph
- In Qt 3D, the framegraph is the data-driven configuration for the rendering.
- We implement the framegraph in the \e ShadowMapFrameGraph.qml file.
+ In Qt 3D, the frame graph is the data-driven configuration for the rendering.
+ We implement the frame graph in the \e ShadowMapFrameGraph.qml file.
In addition to the Qt 3D and Qt 3D Render modules, we also import the
Qt Quick module:
@@ -121,12 +121,16 @@
\skipto import QtQuick
\printuntil Render 2.0
- The code defines a \l RenderSettings entity that has a tree of entities as the
- active framegraph:
+ The code defines a \l RenderSettings node that has a tree of nodes as the
+ active frame graph:
- \printuntil clearColor
+ \badcode
+ RenderSettings {
+ activeFrameGraph: Viewport {...}
+ }
+ \endcode
- Any path from the leaves of this tree to the root is a viable framegraph
+ Any path from the leaves of this tree to the root is a viable frame graph
configuration. Filter entities can enable or disable such paths, and
selector entities can alter the configuration.
@@ -134,25 +138,28 @@
\badcode
Viewport
- RenderPassFilter
- RenderTargetSelector
+ RenderSurfaceSelector
+ RenderPassFilter
+ RenderTargetSelector
+ ClearBuffers
+ CameraSelector
+ RenderPassFilter
ClearBuffers
CameraSelector
- RenderPassFilter
- ClearBuffers
- CameraSelector
\endcode
So we have two paths from the topmost \l Viewport entity. Each path
- corresponds to a pass of the shadow map technique. The paths are enabled and
- disabled using a RenderPassFilter, an entity that can filter depending on
- arbitrary values defined in a given render pass. In this example, it is a
- string:
+ corresponds to a pass, or phase, of the shadow map technique. The paths are
+ enabled and disabled using a RenderPassFilter, a node that can filter
+ depending on arbitrary values defined in a given render pass. In this
+ example, it is a string:
+ \skipto RenderPassFilter
\printuntil ]
- The actual passes are not defined here. The framegraph simply modifies its
- configuration when a given pass is rendered.
+ The actual passes are not defined within the frame graph. Instead the
+ available passes are declared in the Materials used in the scene graph. The
+ frame graph is only used to select which passes are used when rendering.
\section1 Generating the Shadow Map
@@ -176,14 +183,19 @@
\printuntil }
The second pass is more straightforward, because we simply render to the
- screen using the main camera.
+ screen using the main camera:
+
+ \skipto RenderPassFilter
+ \printuntil }
+ \printuntil }
+ \printuntil }
+ \printuntil }
\section1 Using Effects
The bulk of the magic happens in the \e AdsEffect.qml file, where our main
- \l Effect entity is defined. It implements the Ambient, Diffuse and Specular
- (ADS) Lightning Model Phong shading with the addition of shadow mapped
- generated shadows.
+ \l Effect is defined. It implements the Ambient, Diffuse and Specular
+ (ADS) Lighting Model using Phong shading with the addition of shadow mapping.
An effect contains the implementation of a particular rendering strategy. In
this example, shadow mapping using two passes:
@@ -193,24 +205,18 @@
\printuntil Light
The \c parameters list defines some default values for the effect. The
- values will get mapped to OpenGL shader program uniforms, so that in the
- shaders we can access them. In this example, we expose some information from
+ values will get mapped to shader program uniform variables, so that in the
+ shaders we can access their values. In this example, we expose some information from
the Light entity (position, intensity, view or projection matrix defined by
- the internal camera) and the shadow map texture exposed by the framegraph:
+ the internal camera) and the shadow map texture exposed by the frame graph:
\skipto parameters:
\printuntil ]
It is possible to put such parameters all the way down, from a \l Material,
- to its \l Effect, to one of the effect’s \l {Technique}{Techniques}. This allows a
- \l Material instance to override defaults in an \l Effect or \l Technique.
- The bindings array provides the same thing, except that it also allows us to
- rename some parameters. In this example, it renames the \c ambient,
- \c diffuse, and \c specular values defined in the material to the actual
- uniform names used by the shader programs:
-
- \skipto bindings:
- \printuntil ]
+ to its \l Effect, to one of the effect’s \l {Technique}{Techniques} and a
+ \l RenderPass within a \l Technique. This allows a \l Material instance to
+ override defaults in an \l Effect, \l Technique or \l RenderPass.
To adapt the implementation to different hardware or OpenGL versions, we
could use one or more \l Technique elements. In this example, only one
@@ -221,8 +227,8 @@
\printuntil }
Inside the technique, we finally have the definition of our two rendering
- passes. We \e tag each pass with an \l FilterKey entity, matching the ones
- we specified in the framegraph configuration, so that each pass will have
+ passes. We \e tag each pass with a \l FilterKey object, matching the ones
+ we specified in the frame graph configuration, so that each pass will have
different rendering settings:
\printuntil ]
diff --git a/examples/qt3d/shadow-map-qml/shaders/ads.frag b/examples/qt3d/shadow-map-qml/shaders/ads.frag
index 0dbcc57b6..0f7a918ec 100644
--- a/examples/qt3d/shadow-map-qml/shaders/ads.frag
+++ b/examples/qt3d/shadow-map-qml/shaders/ads.frag
@@ -5,30 +5,44 @@
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** 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.
+** 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.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.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** 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.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/shaders/ads.vert b/examples/qt3d/shadow-map-qml/shaders/ads.vert
index 70a32be6d..5f74348ca 100644
--- a/examples/qt3d/shadow-map-qml/shaders/ads.vert
+++ b/examples/qt3d/shadow-map-qml/shaders/ads.vert
@@ -5,30 +5,44 @@
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** 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.
+** 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.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.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** 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.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag b/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
index 894b90b98..77a676a49 100644
--- a/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
+++ b/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
@@ -5,30 +5,44 @@
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert b/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
index ea2cd5cc4..fabd7d774 100644
--- a/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
+++ b/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
@@ -5,30 +5,44 @@
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** 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.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**