summaryrefslogtreecommitdiffstats
path: root/examples/wave
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-04 16:05:02 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-04 15:21:01 +0000
commitc82207d54c76d8b66be010bfa63e45f9507891fa (patch)
tree8d112e96bc1fa42dbc49907f53d71fa5b893869a /examples/wave
parent8bff6813ee2e7a59d27bd8639dc9a6e23287a0c8 (diff)
Move the examples under a qt3d subdir
Modules cannot have their examples in the top-level examples directory because in the pre-built packages all modules' examples are merged together. Change-Id: I80fdbb8f1ec6f3d8fd793e4d856e705000237127 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples/wave')
-rw-r--r--examples/wave/Background.qml90
-rw-r--r--examples/wave/BackgroundEffect.qml64
-rw-r--r--examples/wave/BasicCamera.qml49
-rw-r--r--examples/wave/Wave.qml80
-rw-r--r--examples/wave/WaveEffect.qml111
-rw-r--r--examples/wave/WaveForwardRenderer.qml66
-rw-r--r--examples/wave/WaveMaterial.qml57
-rw-r--r--examples/wave/main.cpp71
-rw-r--r--examples/wave/main.qml85
-rw-r--r--examples/wave/shaders/background.frag13
-rw-r--r--examples/wave/shaders/background.vert14
-rw-r--r--examples/wave/shaders/ribbon.frag49
-rw-r--r--examples/wave/shaders/ribbon.vert149
-rw-r--r--examples/wave/shaders/ribbonwireframe.frag98
-rw-r--r--examples/wave/shaders/robustwireframe.geom131
-rw-r--r--examples/wave/wave.pro25
-rw-r--r--examples/wave/wave.qrc18
17 files changed, 0 insertions, 1170 deletions
diff --git a/examples/wave/Background.qml b/examples/wave/Background.qml
deleted file mode 100644
index d25edfabf..000000000
--- a/examples/wave/Background.qml
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** 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 real hue: 0.0
- property alias animateColors: hueAnim.running
-
- QQ2.NumberAnimation {
- id: hueAnim
- target: root
- property: "hue"
- from: 0.0; to: 1.0
- duration: 200000
- running: false
- loops: QQ2.Animation.Infinite
- }
-
- Entity {
- id: _private
- property color color1: Qt.hsla( (hue + 0.59) % 1, 0.53, 0.59 )
- property color color2: Qt.hsla( (hue + 0.59) % 1, 1.0, 0.15 )
- }
-
- components: [
- Layer {
- names: "background"
- },
-
- PlaneMesh {
- width: 2.0
- height: 2.0
- meshResolution: Qt.size( 2, 2 )
- },
-
- Transform {
- // Rotate the plane so that it faces us
- Rotate {
- axis: Qt.vector3d( 1.0, 0.0, 0.0 )
- angle: 90
- }
- },
-
- Material {
- effect: BackgroundEffect {}
- parameters: [
- Parameter { name: "color1"; value: Qt.vector3d( _private.color1.r, _private.color1.g, _private.color1.b ) },
- Parameter { name: "color2"; value: Qt.vector3d( _private.color2.r, _private.color2.g, _private.color2.b ) }
- ]
- }
- ]
-
-}
diff --git a/examples/wave/BackgroundEffect.qml b/examples/wave/BackgroundEffect.qml
deleted file mode 100644
index be02664f7..000000000
--- a/examples/wave/BackgroundEffect.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** 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
-
- techniques: [
- Technique {
- openGLFilter {
- api: OpenGLFilter.Desktop
- profile: OpenGLFilter.Core
- majorVersion: 3
- minorVersion: 1
- }
-
- annotations: Annotation { name: "renderingStyle"; value: "forward" }
-
- renderPasses: [
- RenderPass {
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource( "qrc:/shaders/background.vert" )
- fragmentShaderCode: loadSource( "qrc:/shaders/background.frag" )
- }
- }
- ]
- }
- ]
-}
diff --git a/examples/wave/BasicCamera.qml b/examples/wave/BasicCamera.qml
deleted file mode 100644
index 740dd54ce..000000000
--- a/examples/wave/BasicCamera.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Camera {
- id: mainCamera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 22.5
- aspectRatio: _window.width / _window.height
- nearPlane: 0.01
- farPlane: 1000.0
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
-}
diff --git a/examples/wave/Wave.qml b/examples/wave/Wave.qml
deleted file mode 100644
index 023631b9e..000000000
--- a/examples/wave/Wave.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** 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 real x: 0.0
- property real y: 0.0
- property real z: 0.0
- property real scale: 1.0
- property real theta: 0.0
- property real phi: 0.0
- property color tint: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
- property real intensity: 0.3
- property alias wireframe: material.wireframe
-
- components: [ transform, mesh, material, layer ]
-
- Layer {
- id: layer
- names: "wave"
- }
-
- Transform {
- id: transform
- Translate { dx: root.x; dy: root.y; dz: root.z }
- Scale { scale: root.scale }
- Rotate{ angle: root.theta; axis: Qt.vector3d(1.0, 0.0, 0.0) }
- Rotate{ angle: root.phi; axis: Qt.vector3d(0.0, 1.0, 0.0) }
- }
-
- WaveMaterial {
- id: material
- ambient: Qt.rgba( root.tint.r, root.tint.g, root.tint.b, 1.0 ) // Set color tint
- diffuse: Qt.rgba( root.intensity, root.intensity, root.intensity, 1.0 ) // Set how bright the wave is
- }
-
- PlaneMesh {
- id: mesh
- width: 25.0
- height: 5.0
- meshResolution: Qt.size( 125, 50 )
- }
-}
diff --git a/examples/wave/WaveEffect.qml b/examples/wave/WaveEffect.qml
deleted file mode 100644
index bca3737b8..000000000
--- a/examples/wave/WaveEffect.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** 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 bool wireframe: false
-
- // 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 ) }
- ]
-
- techniques: [
- Technique {
- openGLFilter {
- api: OpenGLFilter.Desktop
- profile: OpenGLFilter.Core
- majorVersion: 3
- minorVersion: 2
- }
-
- annotations: [ Annotation { name: "renderingStyle"; value: "forward" } ]
-
- parameters: [
- Parameter { name: "light.position"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },
- Parameter { name: "light.intensity"; value: Qt.vector3d( 1.0, 1.0, 1.0 ) },
- Parameter { name: "line.width"; value: 0.8 },
- Parameter { name: "line.color"; value: Qt.vector4d( 1.0, 1.0, 1.0, 1.0 ) }
- ]
-
- renderPasses: [
- RenderPass {
- bindings: [
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform }
- ]
-
- shaderProgram: wireframe ? wireframeShader : standardShader
-
- // Disable depth testing and use simple additive blending
- renderStates: [
- DepthTest { func: DepthTest.Always },
- DepthMask { mask: true },
- BlendState {
- srcRGB: BlendState.One
- dstRGB: BlendState.OneMinusSrcColor
- }
- ]
-
- ShaderProgram {
- id: standardShader
- vertexShaderCode: loadSource("qrc:/shaders/ribbon.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/ribbon.frag")
- }
-
- ShaderProgram {
- id: wireframeShader
- vertexShaderCode: loadSource("qrc:/shaders/ribbon.vert")
- geometryShaderCode: loadSource("qrc:/shaders/robustwireframe.geom")
- fragmentShaderCode: loadSource("qrc:/shaders/ribbonwireframe.frag")
- }
- }
- ]
- }
- ]
-}
diff --git a/examples/wave/WaveForwardRenderer.qml b/examples/wave/WaveForwardRenderer.qml
deleted file mode 100644
index 9f8031668..000000000
--- a/examples/wave/WaveForwardRenderer.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-TechniqueFilter {
- id: root
-
- // 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
- requires: [ Annotation { name: "renderingStyle"; value: "forward" } ]
-
- // Use the whole viewport
- Viewport {
- id: viewport
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
-
- // Use the specified camera
- CameraSelector {
- id: cameraSelector
-
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
- LayerFilter { layers: "background" }
- }
-
- LayerFilter { layers: "wave" }
- }
- }
-}
diff --git a/examples/wave/WaveMaterial.qml b/examples/wave/WaveMaterial.qml
deleted file mode 100644
index 1417b54cb..000000000
--- a/examples/wave/WaveMaterial.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-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 real lineWidth: 1.0
- property color lineColor: Qt.rgba( 1.0, 1.0, 1.0, 1.0 )
- property alias wireframe: effect.wireframe
-
- effect: WaveEffect { id: effect }
-
- 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: "line.width"; value: root.lineWidth },
- Parameter { name: "line.color"; value: root.lineColor }
- ]
-}
diff --git a/examples/wave/main.cpp b/examples/wave/main.cpp
deleted file mode 100644
index 6130cc708..000000000
--- a/examples/wave/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** 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.h>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <exampleresources.h>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- initializeAssetResources("../exampleresources/example-assets.qrb");
-
- Qt3D::Window view;
- Qt3D::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3D::QInputAspect());
-
- // Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.aspectEngine()->initialize();
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/wave/main.qml b/examples/wave/main.qml
deleted file mode 100644
index b2e0c1bff..000000000
--- a/examples/wave/main.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** 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 Qt3D.Input 2.0
-
-Entity {
- id: root
-
- KeyboardController { id: keyboard1 }
-
- KeyboardInput {
- id: input
- controller: keyboard1
- focus: true
-
- onTabPressed: {
- background.animateColors = !background.animateColors
- }
-
- onSpacePressed: {
- wave.wireframe = !wave.wireframe
- }
- }
-
- FrameGraph {
- id: frameGraph
- activeFrameGraph: WaveForwardRenderer {
- camera: mainCamera
- }
- }
-
- components: [ frameGraph, input ]
-
- BasicCamera {
- id: mainCamera
- position: Qt.vector3d( 0.0, 10.0, 25.0 )
- }
-
- Configuration {
- controlledCamera: mainCamera
- }
-
- Background {
- id: background
- }
-
- Wave {
- id: wave
- }
-}
diff --git a/examples/wave/shaders/background.frag b/examples/wave/shaders/background.frag
deleted file mode 100644
index 01c062189..000000000
--- a/examples/wave/shaders/background.frag
+++ /dev/null
@@ -1,13 +0,0 @@
-#version 150 core
-
-in vec2 texCoord;
-
-out vec4 fragColor;
-
-uniform vec3 color1;
-uniform vec3 color2;
-
-void main()
-{
- fragColor = vec4( mix( color1, color2, texCoord.t ), 1.0 );
-}
diff --git a/examples/wave/shaders/background.vert b/examples/wave/shaders/background.vert
deleted file mode 100644
index 58fadebe5..000000000
--- a/examples/wave/shaders/background.vert
+++ /dev/null
@@ -1,14 +0,0 @@
-#version 150 core
-
-in vec4 vertexPosition;
-in vec2 vertexTexCoord;
-
-out vec2 texCoord;
-
-uniform mat4 modelMatrix;
-
-void main()
-{
- texCoord = vertexTexCoord;
- gl_Position = modelMatrix * vertexPosition;
-}
diff --git a/examples/wave/shaders/ribbon.frag b/examples/wave/shaders/ribbon.frag
deleted file mode 100644
index 09ad78871..000000000
--- a/examples/wave/shaders/ribbon.frag
+++ /dev/null
@@ -1,49 +0,0 @@
-#version 330 core
-
-in EyeSpaceVertex {
- vec3 position;
- vec3 normal;
-} fs_in;
-
-out vec4 fragColor;
-
-uniform struct LightInfo {
- vec4 position;
- vec3 intensity;
-} light;
-
-uniform struct LineInfo {
- float width;
- vec4 color;
-} line;
-
-uniform vec3 ka; // Ambient reflectivity
-uniform vec3 kd; // Diffuse reflectivity
-
-vec3 rimLightModel( const in vec3 pos, const in vec3 n )
-{
- // Calculate the vector from the light to the fragment
- vec3 s = normalize( vec3( light.position ) - pos );
-
- // Calculate the vector from the fragment to the eye position (the
- // origin since this is in "eye" or "camera" space
- vec3 v = normalize( -pos );
-
- // Refleft the light beam using the normal at this fragment
- vec3 r = reflect( -s, n );
-
- // Calculate the diffuse component, which for rim lighting it 1 minus s dot n
- // rather than s dot n as for standard diffuse lighting
- float sDotN = dot( s, n );
- vec3 diffuse = vec3( 1.0 - max( sDotN, 0.0 ) );
-
- // Combine the ambient, diffuse and specular contributions
- return light.intensity * ( ka + kd * diffuse );
-}
-
-void main()
-{
- vec3 n = gl_FrontFacing ? fs_in.normal : -fs_in.normal;
- vec4 color = vec4( rimLightModel( fs_in.position, normalize( n ) ), 1.0 );
- fragColor = color;
-}
diff --git a/examples/wave/shaders/ribbon.vert b/examples/wave/shaders/ribbon.vert
deleted file mode 100644
index e099d53c8..000000000
--- a/examples/wave/shaders/ribbon.vert
+++ /dev/null
@@ -1,149 +0,0 @@
-#version 330 core
-
-in vec3 vertexPosition;
-in vec3 vertexNormal;
-
-out EyeSpaceVertex {
- vec3 position;
- vec3 normal;
-} vs_out;
-
-uniform mat4 modelView;
-uniform mat3 modelViewNormal;
-uniform mat4 mvp;
-
-uniform float time;
-uniform float amplitude = 1.0;
-uniform float lambda = 20.0;
-uniform float period = 15.0;
-
-//
-// Description : Array and textureless GLSL 3D simplex noise function.
-// Author : Ian McEwan, Ashima Arts.
-// Maintainer : ijm
-// Lastmod : 20110409 (stegu)
-// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
-// Distributed under the MIT License. See LICENSE file.
-//
-
-vec4 permute( vec4 x )
-{
- return mod(((x*34.0)+1.0)*x, 289.0);
-}
-
-vec4 taylorInvSqrt( vec4 r )
-{
- return 1.79284291400159 - 0.85373472095314 * r;
-}
-
-float snoise(vec3 v)
-{
- const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
- const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
-
- // First corner
- vec3 i = floor(v + dot(v, C.yyy) );
- vec3 x0 = v - i + dot(i, C.xxx) ;
-
- // Other corners
- vec3 g = step(x0.yzx, x0.xyz);
- vec3 l = 1.0 - g;
- vec3 i1 = min( g.xyz, l.zxy );
- vec3 i2 = max( g.xyz, l.zxy );
-
- // x0 = x0 - 0. + 0.0 * C
- vec3 x1 = x0 - i1 + 1.0 * C.xxx;
- vec3 x2 = x0 - i2 + 2.0 * C.xxx;
- vec3 x3 = x0 - 1. + 3.0 * C.xxx;
-
- // Permutations
- i = mod(i, 289.0 );
- vec4 p = permute( permute( permute(
- i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
- + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
- + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
-
- // Gradients
- // ( N*N points uniformly over a square, mapped onto an octahedron.)
- float n_ = 1.0/7.0; // N=7
- vec3 ns = n_ * D.wyz - D.xzx;
-
- vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
-
- vec4 x_ = floor(j * ns.z);
- vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
-
- vec4 x = x_ *ns.x + ns.yyyy;
- vec4 y = y_ *ns.x + ns.yyyy;
- vec4 h = 1.0 - abs(x) - abs(y);
-
- vec4 b0 = vec4( x.xy, y.xy );
- vec4 b1 = vec4( x.zw, y.zw );
-
- //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
- //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
- vec4 s0 = floor(b0)*2.0 + 1.0;
- vec4 s1 = floor(b1)*2.0 + 1.0;
- vec4 sh = -step(h, vec4(0.0));
-
- vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
- vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
-
- vec3 p0 = vec3(a0.xy,h.x);
- vec3 p1 = vec3(a0.zw,h.y);
- vec3 p2 = vec3(a1.xy,h.z);
- vec3 p3 = vec3(a1.zw,h.w);
-
- //Normalise gradients
- vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
- p0 *= norm.x;
- p1 *= norm.y;
- p2 *= norm.z;
- p3 *= norm.w;
-
- // Mix final noise value
- vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
- m = m * m;
- return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
- dot(p2,x2), dot(p3,x3) ) );
-}
-
-float height( const in vec3 pos )
-{
- // Perturb the y position by a wave function in (x, t)
- const float twoPi = 2.0 * 3.14159;
- float k = twoPi / lambda;
- float omega = twoPi / period;
-
- float y = amplitude * sin( k * pos.x - omega * time );
-
- // Further perturb by a noise function
- y += snoise( 0.27 * vec3( 0.4 * pos.x, 3.0, 2.0 * pos.z - 0.5 * time ) );
-
- return y;
-}
-
-void main()
-{
- // Calculate y value based upon input coordinates and time
- vec3 pos = vertexPosition;
- pos.y = height( pos );
-
- // Estimate normal vector by calculating the y value at small offsets
- // and then taking the cross product of the differences
- float offset = 0.5;
- vec3 posOffsetX = vertexPosition + vec3( offset, 0.0, 0.0 );
- posOffsetX.y = height( posOffsetX );
- vec3 posOffsetZ = vertexPosition + vec3( 0.0, 0.0, offset );
- posOffsetZ.y = height( posOffsetZ );
-
- vec3 dydx = posOffsetX - pos;
- vec3 dydz = posOffsetZ - pos;
- vec3 normal = cross( dydz, dydx );
-
- // Transform the position and normal to eye space for lighting
- vs_out.normal = normalize( modelViewNormal * normal );
- vs_out.position = vec3( modelView * vec4( pos, 1.0 ) );
-
- gl_Position = mvp * vec4( pos, 1.0 );
-}
diff --git a/examples/wave/shaders/ribbonwireframe.frag b/examples/wave/shaders/ribbonwireframe.frag
deleted file mode 100644
index 659f00a8a..000000000
--- a/examples/wave/shaders/ribbonwireframe.frag
+++ /dev/null
@@ -1,98 +0,0 @@
-#version 330 core
-
-in WireframeVertex {
- vec3 position;
- vec3 normal;
- noperspective vec4 edgeA;
- noperspective vec4 edgeB;
- flat int configuration;
-} fs_in;
-
-out vec4 fragColor;
-
-uniform struct LightInfo {
- vec4 position;
- vec3 intensity;
-} light;
-
-uniform struct LineInfo {
- float width;
- vec4 color;
-} line;
-
-uniform vec3 ka; // Ambient reflectivity
-uniform vec3 kd; // Diffuse reflectivity
-
-vec3 rimLightModel( const in vec3 pos, const in vec3 n )
-{
- // Calculate the vector from the light to the fragment
- vec3 s = normalize( vec3( light.position ) - pos );
-
- // Calculate the vector from the fragment to the eye position (the
- // origin since this is in "eye" or "camera" space
- vec3 v = normalize( -pos );
-
- // Refleft the light beam using the normal at this fragment
- vec3 r = reflect( -s, n );
-
- // Calculate the diffuse component, which for rim lighting it 1 minus s dot n
- // rather than s dot n as for standard diffuse lighting
- float sDotN = dot( s, n );
- vec3 diffuse = vec3( 1.0 - max( sDotN, 0.0 ) );
-
- // Combine the ambient, diffuse and specular contributions
- return light.intensity * ( ka + kd * diffuse );
-}
-
-vec4 shadeLine( const in vec4 color )
-{
- // Find the smallest distance between the fragment and a triangle edge
- float d;
- if ( fs_in.configuration == 0 ) {
- // Common configuration
- d = min( fs_in.edgeA.x, fs_in.edgeA.y );
- d = min( d, fs_in.edgeA.z );
- } else {
- // Handle configuration where screen space projection breaks down
- // Compute and compare the squared distances
- vec2 AF = gl_FragCoord.xy - fs_in.edgeA.xy;
- float sqAF = dot( AF, AF );
- float AFcosA = dot( AF, fs_in.edgeA.zw );
- d = abs( sqAF - AFcosA * AFcosA );
-
- vec2 BF = gl_FragCoord.xy - fs_in.edgeB.xy;
- float sqBF = dot( BF, BF );
- float BFcosB = dot( BF, fs_in.edgeB.zw );
- d = min( d, abs( sqBF - BFcosB * BFcosB ) );
-
- // Only need to care about the 3rd edge for some configurations.
- if ( fs_in.configuration == 1 ||
- fs_in.configuration == 2 ||
- fs_in.configuration == 4 ) {
- float AFcosA0 = dot( AF, normalize( fs_in.edgeB.xy - fs_in.edgeA.xy ) );
- d = min( d, abs( sqAF - AFcosA0 * AFcosA0 ) );
- }
-
- d = sqrt( d );
- }
-
- // Blend between line color and shaded color
- float mixVal;
- if ( d < line.width - 1.0 ) {
- mixVal = 1.0;
- } else if ( d > line.width + 1.0 ) {
- mixVal = 0.0;
- } else {
- float x = d - ( line.width - 1.0 );
- mixVal = exp2( -2.0 * ( x * x ) );
- }
-
- return mix( color, line.color, mixVal );
-}
-
-void main()
-{
- vec3 n = gl_FrontFacing ? fs_in.normal : -fs_in.normal;
- vec4 color = vec4( rimLightModel( fs_in.position, normalize( n ) ), 1.0 );
- fragColor = shadeLine( color );
-}
diff --git a/examples/wave/shaders/robustwireframe.geom b/examples/wave/shaders/robustwireframe.geom
deleted file mode 100644
index 6eb0ecc76..000000000
--- a/examples/wave/shaders/robustwireframe.geom
+++ /dev/null
@@ -1,131 +0,0 @@
-#version 330 core
-
-layout( triangles ) in;
-layout( triangle_strip, max_vertices = 3 ) out;
-
-in EyeSpaceVertex {
- vec3 position;
- vec3 normal;
-} gs_in[];
-
-out WireframeVertex {
- vec3 position;
- vec3 normal;
- noperspective vec4 edgeA;
- noperspective vec4 edgeB;
- flat int configuration;
-} gs_out;
-
-uniform mat4 viewportMatrix;
-
-const int infoA[] = int[]( 0, 0, 0, 0, 1, 1, 2 );
-const int infoB[] = int[]( 1, 1, 2, 0, 2, 1, 2 );
-const int infoAd[] = int[]( 2, 2, 1, 1, 0, 0, 0 );
-const int infoBd[] = int[]( 2, 2, 1, 2, 0, 2, 1 );
-
-vec2 transformToViewport( const in vec4 p )
-{
- return vec2( viewportMatrix * ( p / p.w ) );
-}
-
-void main()
-{
- gs_out.configuration = int(gl_in[0].gl_Position.z < 0) * int(4)
- + int(gl_in[1].gl_Position.z < 0) * int(2)
- + int(gl_in[2].gl_Position.z < 0);
-
- // If all vertices are behind us, cull the primitive
- if (gs_out.configuration == 7)
- return;
-
- // Transform each vertex into viewport space
- vec2 p[3];
- p[0] = transformToViewport( gl_in[0].gl_Position );
- p[1] = transformToViewport( gl_in[1].gl_Position );
- p[2] = transformToViewport( gl_in[2].gl_Position );
-
- if (gs_out.configuration == 0)
- {
- // Common configuration where all vertices are within the viewport
- gs_out.edgeA = vec4(0.0);
- gs_out.edgeB = vec4(0.0);
-
- // Calculate lengths of 3 edges of triangle
- float a = length( p[1] - p[2] );
- float b = length( p[2] - p[0] );
- float c = length( p[1] - p[0] );
-
- // Calculate internal angles using the cosine rule
- float alpha = acos( ( b * b + c * c - a * a ) / ( 2.0 * b * c ) );
- float beta = acos( ( a * a + c * c - b * b ) / ( 2.0 * a * c ) );
-
- // Calculate the perpendicular distance of each vertex from the opposing edge
- float ha = abs( c * sin( beta ) );
- float hb = abs( c * sin( alpha ) );
- float hc = abs( b * sin( alpha ) );
-
- // Now add this perpendicular distance as a per-vertex property in addition to
- // the position and normal calculated in the vertex shader.
-
- // Vertex 0 (a)
- gs_out.edgeA = vec4( ha, 0.0, 0.0, 0.0 );
- gs_out.normal = gs_in[0].normal;
- gs_out.position = gs_in[0].position;
- gl_Position = gl_in[0].gl_Position;
- EmitVertex();
-
- // Vertex 1 (b)
- gs_out.edgeA = vec4( 0.0, hb, 0.0, 0.0 );
- gs_out.normal = gs_in[1].normal;
- gs_out.position = gs_in[1].position;
- gl_Position = gl_in[1].gl_Position;
- EmitVertex();
-
- // Vertex 2 (c)
- gs_out.edgeA = vec4( 0.0, 0.0, hc, 0.0 );
- gs_out.normal = gs_in[2].normal;
- gs_out.position = gs_in[2].position;
- gl_Position = gl_in[2].gl_Position;
- EmitVertex();
-
- // Finish the primitive off
- EndPrimitive();
- }
- else
- {
- // Viewport projection breaks down for one or two vertices.
- // Caclulate what we can here and defer rest to fragment shader.
- // Since this is coherent for the entire primitive the conditional
- // in the fragment shader is still cheap as all concurrent
- // fragment shader invocations will take the same code path.
-
- // Copy across the viewport-space points for the (up to) two vertices
- // in the viewport
- gs_out.edgeA.xy = p[infoA[gs_out.configuration]];
- gs_out.edgeB.xy = p[infoB[gs_out.configuration]];
-
- // Copy across the viewport-space edge vectors for the (up to) two vertices
- // in the viewport
- gs_out.edgeA.zw = normalize( gs_out.edgeA.xy - p[ infoAd[gs_out.configuration] ] );
- gs_out.edgeB.zw = normalize( gs_out.edgeB.xy - p[ infoBd[gs_out.configuration] ] );
-
- // Pass through the other vertex attributes
- gs_out.normal = gs_in[0].normal;
- gs_out.position = gs_in[0].position;
- gl_Position = gl_in[0].gl_Position;
- EmitVertex();
-
- gs_out.normal = gs_in[1].normal;
- gs_out.position = gs_in[1].position;
- gl_Position = gl_in[1].gl_Position;
- EmitVertex();
-
- gs_out.normal = gs_in[2].normal;
- gs_out.position = gs_in[2].position;
- gl_Position = gl_in[2].gl_Position;
- EmitVertex();
-
- // Finish the primitive off
- EndPrimitive();
- }
-}
diff --git a/examples/wave/wave.pro b/examples/wave/wave.pro
deleted file mode 100644
index 05c937cb6..000000000
--- a/examples/wave/wave.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-TEMPLATE = app
-
-QT += 3dcore 3drenderer 3dquick 3dinput qml quick
-
-include("../exampleresources/exampleresources.pri")
-
-HEADERS += \
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- shaders/* \
- main.qml \
- BasicCamera.qml \
- WaveForwardRenderer.qml \
- Wave.qml \
- WaveEffect.qml \
- WaveMaterial.qml \
- Background.qml \
- shaders/background.vert \
- shaders/background.frag
-
-RESOURCES += \
- wave.qrc
diff --git a/examples/wave/wave.qrc b/examples/wave/wave.qrc
deleted file mode 100644
index 2ce77a45f..000000000
--- a/examples/wave/wave.qrc
+++ /dev/null
@@ -1,18 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>BasicCamera.qml</file>
- <file>WaveEffect.qml</file>
- <file>WaveMaterial.qml</file>
- <file>Wave.qml</file>
- <file>Background.qml</file>
- <file>BackgroundEffect.qml</file>
- <file>shaders/background.vert</file>
- <file>shaders/background.frag</file>
- <file>shaders/ribbon.frag</file>
- <file>shaders/ribbon.vert</file>
- <file>shaders/ribbonwireframe.frag</file>
- <file>shaders/robustwireframe.geom</file>
- <file>WaveForwardRenderer.qml</file>
- </qresource>
-</RCC>