summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/compute-particles/main.qml
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-12-08 09:01:15 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-01-14 21:36:00 +0000
commit4a44b6520ff8add3dd65be6224fd7410e5405939 (patch)
tree13a5a4a3df1cc3f7059afc7f8f55286f434f26e6 /examples/qt3d/compute-particles/main.qml
parent08ad89dde168476c8e7045b84785f26eb8c8bc7a (diff)
Add a compute shader example
Change-Id: I956b647e2218ad3e604bd9e8260b3ea0a90dc84e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/compute-particles/main.qml')
-rw-r--r--examples/qt3d/compute-particles/main.qml132
1 files changed, 132 insertions, 0 deletions
diff --git a/examples/qt3d/compute-particles/main.qml b/examples/qt3d/compute-particles/main.qml
new file mode 100644
index 000000000..a0b43590e
--- /dev/null
+++ b/examples/qt3d/compute-particles/main.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.1
+
+Item {
+
+ Scene3D {
+ anchors.fill: parent
+ aspects: "input"
+ ParticlesScene {
+ id: scene
+ particleStep: stepSlider.value
+ finalCollisionFactor: collisionSlider.value
+ }
+ }
+
+ ColumnLayout {
+ id: colorLayout
+ anchors.left: parent.left
+ anchors.leftMargin: 35
+ anchors.right: parent.right
+ anchors.rightMargin: 35
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 35
+ spacing: 15
+
+ RowLayout {
+ Text {
+ text: "Particles Step:"
+ color: "white"
+ }
+ Slider {
+ height: 35
+ id: stepSlider
+ Layout.fillWidth: true
+ minimumValue: 0.0
+ maximumValue: 2
+ value: 0.4
+ }
+ }
+ RowLayout {
+ Text {
+ text: "Particles Collision:"
+ color: "white"
+ }
+ Slider {
+ height: 35
+ id: collisionSlider
+ Layout.fillWidth: true
+ minimumValue: 0.0
+ maximumValue: 2
+ value: 0.2
+ }
+ }
+ RowLayout {
+ Button {
+ text: "Reset Particles"
+ onClicked: scene.reset()
+ }
+ }
+ RowLayout {
+ Text {
+ text: "Particles Shape:"
+ color: "white"
+ }
+ ExclusiveGroup {
+ id: particlesTypeGroup
+ }
+ CheckBox {
+ text: "Sphere"
+ checked: true
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._SPHERE
+ }
+ CheckBox
+ { text: "Cube"
+ checked: false
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._CUBE
+ }
+ CheckBox {
+ text: "Cylinder"
+ checked: false
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._CYLINDER
+ }
+ CheckBox {
+ text: "Torus"
+ checked: false
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._TORUS
+ }
+ }
+ }
+}