summaryrefslogtreecommitdiffstats
path: root/examples/sensors/cubehouse
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sensors/cubehouse')
-rw-r--r--examples/sensors/cubehouse/Cube.qml81
-rw-r--r--examples/sensors/cubehouse/Room.qml288
-rw-r--r--examples/sensors/cubehouse/Table.qml50
-rw-r--r--examples/sensors/cubehouse/content/ground.jpgbin0 -> 3077 bytes
-rw-r--r--examples/sensors/cubehouse/content/qtlogo.pngbin0 -> 13923 bytes
-rw-r--r--examples/sensors/cubehouse/content/roof.jpgbin0 -> 3866 bytes
-rw-r--r--examples/sensors/cubehouse/content/wall.jpgbin0 -> 6195 bytes
-rw-r--r--examples/sensors/cubehouse/cubehouse.pro16
-rw-r--r--examples/sensors/cubehouse/cubehouse.qml113
-rw-r--r--examples/sensors/cubehouse/icon.pngbin0 -> 7607 bytes
-rw-r--r--examples/sensors/cubehouse/info.json14
-rw-r--r--examples/sensors/cubehouse/mesh/table.3dsbin0 -> 9149 bytes
12 files changed, 562 insertions, 0 deletions
diff --git a/examples/sensors/cubehouse/Cube.qml b/examples/sensors/cubehouse/Cube.qml
new file mode 100644
index 00000000..b8afe81f
--- /dev/null
+++ b/examples/sensors/cubehouse/Cube.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt3D 1.0
+import Qt3D.Shapes 1.0
+
+Cube {
+ objectName: "cube"
+
+ transform: [
+ Rotation3D {
+ angle: 45.0
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: 45.0
+ axis: Qt.vector3d(0, 0, 1)
+ },
+ Rotation3D {
+ id: yRT
+ angle: 0
+ axis: Qt.vector3d(0, -1, 0)
+ }
+ ]
+
+ SequentialAnimation {
+ running: true
+ loops: Animation.Infinite
+ NumberAnimation {
+ target: yRT
+ property: "angle"
+ from: 0
+ to: 360
+ duration: 1000
+ }
+ }
+
+ effect: Effect {
+ color: "#aaca00"
+ texture: "content/qtlogo.png"
+ decal: true
+ }
+}
diff --git a/examples/sensors/cubehouse/Room.qml b/examples/sensors/cubehouse/Room.qml
new file mode 100644
index 00000000..848735b7
--- /dev/null
+++ b/examples/sensors/cubehouse/Room.qml
@@ -0,0 +1,288 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt3D 1.0
+import Qt3D.Shapes 1.0
+import "."
+
+Item3D{
+ id: room
+ property double scale: 1.0
+ property bool yspin: false
+ property bool xspin: false
+ property int yrot: 0
+ property int xrot: 0
+ property double distanceCorrection: 3.7
+
+ transform: [
+ Rotation3D {
+ id: yRT
+ angle: 0
+ axis: Qt.vector3d(0, -1, 0)
+ },
+ Rotation3D {
+ id: xRT
+ angle: 0
+ axis: Qt.vector3d(-1, 0, 0)
+ }
+ ]
+
+ SequentialAnimation {
+ running: yspin
+ NumberAnimation {
+ target: yRT
+ property: "angle"
+ to: yrot
+ easing.type:"Linear"
+ duration: 50
+ }
+ onCompleted: yspin = false
+ }
+
+ SequentialAnimation {
+ running: xspin
+ NumberAnimation {
+ target: xRT
+ property: "angle"
+ to: xrot
+ easing.type:"Linear"
+ duration: 50
+ }
+ onCompleted: xspin = false
+ }
+
+ function rotateY(y)
+ {
+ room.yrot=y;
+ room.yspin = true;
+ }
+
+ function rotateX(x)
+ {
+ room.xrot=x;
+ room.xspin = true;
+ }
+
+ Quad {
+ id: frontWall
+ scale: room.scale
+ effect: Effect {
+ texture: "content/wall.jpg"
+ }
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -frontWall.scale + room.distanceCorrection, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: 0
+ axis: Qt.vector3d(0, 1, 0)
+ },
+ Rotation3D {
+ angle: 0
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ ]
+ }
+
+ Quad {
+ id: ground
+ scale: room.scale
+ effect: Effect {
+ texture: "content/ground.jpg"
+ }
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -ground.scale + room.distanceCorrection, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 1, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ ]
+ }
+
+ Quad {
+ id: leftWall
+ scale: room.scale
+ effect: Effect {
+ texture: "content/wall.jpg"
+ }
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -leftWall.scale + room.distanceCorrection, 0)
+ },
+ Rotation3D {
+ angle: 0
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 1, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ ]
+ }
+
+ Quad {
+ id: rightWall
+ scale: room.scale
+ effect: Effect {
+ texture: "content/wall.jpg"
+ }
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -rightWall.scale + room.distanceCorrection, 0)
+ },
+ Rotation3D {
+ angle: 180
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 1, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ ]
+ }
+
+ Quad {
+ id: roof
+ scale: room.scale
+ effect: Effect {
+ texture: "content/roof.jpg"
+ }
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -roof.scale + room.distanceCorrection, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: -90
+ axis: Qt.vector3d(0, 1, 0)
+ },
+ Rotation3D {
+ angle: 90
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ ]
+ }
+
+ Quad {
+ id: backWall
+ scale: room.scale
+ effect: Effect {
+ texture: "content/wall.jpg"
+ }
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -backWall.scale + room.distanceCorrection, 0)
+ },
+ Rotation3D {
+ angle: -90
+ axis: Qt.vector3d(1, 0, 0)
+ },
+ Rotation3D {
+ angle: 0
+ axis: Qt.vector3d(0, 1, 0)
+ },
+ Rotation3D {
+ angle: 0
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ ]
+ }
+
+ Cube {
+ id: cube
+ scale: 0.5
+
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0.0, 0.0, 0.0)
+ }
+ ]
+ }
+
+ Table {
+ scale: 0.025
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0, -7 + room.distanceCorrection, 0)
+ }
+ ]
+ }
+
+ Teapot {
+ scale: 0.5
+
+ effect: Effect {
+ color: "#ffffaa"
+ decal: true
+ }
+
+ transform: [
+ Translation3D {
+ translate: Qt.vector3d(0.0, -4.50 + room.distanceCorrection, 0.0)
+ }
+ ]
+ }
+}
diff --git a/examples/sensors/cubehouse/Table.qml b/examples/sensors/cubehouse/Table.qml
new file mode 100644
index 00000000..683d28de
--- /dev/null
+++ b/examples/sensors/cubehouse/Table.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt3D 1.0
+import Qt3D.Shapes 1.0
+import "."
+
+Item3D {
+ id: table
+ scale: 1
+ mesh: Mesh { source: "mesh/table.3ds" }
+}
diff --git a/examples/sensors/cubehouse/content/ground.jpg b/examples/sensors/cubehouse/content/ground.jpg
new file mode 100644
index 00000000..2664b99e
--- /dev/null
+++ b/examples/sensors/cubehouse/content/ground.jpg
Binary files differ
diff --git a/examples/sensors/cubehouse/content/qtlogo.png b/examples/sensors/cubehouse/content/qtlogo.png
new file mode 100644
index 00000000..7d3e97eb
--- /dev/null
+++ b/examples/sensors/cubehouse/content/qtlogo.png
Binary files differ
diff --git a/examples/sensors/cubehouse/content/roof.jpg b/examples/sensors/cubehouse/content/roof.jpg
new file mode 100644
index 00000000..53a35d64
--- /dev/null
+++ b/examples/sensors/cubehouse/content/roof.jpg
Binary files differ
diff --git a/examples/sensors/cubehouse/content/wall.jpg b/examples/sensors/cubehouse/content/wall.jpg
new file mode 100644
index 00000000..7c56e23f
--- /dev/null
+++ b/examples/sensors/cubehouse/content/wall.jpg
Binary files differ
diff --git a/examples/sensors/cubehouse/cubehouse.pro b/examples/sensors/cubehouse/cubehouse.pro
new file mode 100644
index 00000000..995446c0
--- /dev/null
+++ b/examples/sensors/cubehouse/cubehouse.pro
@@ -0,0 +1,16 @@
+TEMPLATE = aux
+
+app.files = \
+ $$files(*.qml) \
+ icon.png \
+ images \
+ info.json \
+ mesh
+
+MT_SYSROOT=$$(MT_SYSROOT)
+!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications
+!isEmpty(EXAMPLES_PREFIX) {
+ app.path = $$EXAMPLES_PREFIX/com.nokia.mt.cubehouse
+ INSTALLS = app
+}
+
diff --git a/examples/sensors/cubehouse/cubehouse.qml b/examples/sensors/cubehouse/cubehouse.qml
new file mode 100644
index 00000000..5a1b91f8
--- /dev/null
+++ b/examples/sensors/cubehouse/cubehouse.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt3D 1.0
+import Qt3D.Shapes 1.0
+
+//! [0]
+import QtMobility.sensors 1.3
+//! [0]
+
+import "."
+
+Item {
+ id: mainWindow
+ width: 320
+ height: 480
+
+ Viewport {
+ id: view
+ anchors.top: parent.top
+ width: parent.width
+ height: parent.height
+ fillColor: "darkblue"
+ objectName: "cube viewport"
+ camera: Camera { eye: Qt.vector3d(0, 3, 1.6 * room.scale - 4)}
+
+ Room{
+ id: room
+ scale: 7.0
+ }
+
+ function rotateY(y)
+ {
+ room.rotateY(y);
+ }
+
+ function rotateX(x)
+ {
+ room.rotateX(x);
+ }
+ }
+
+//! [1]
+ Accelerometer {
+ id: accel
+ active: true
+ dataRate: 20
+//! [1]
+
+//! [2]
+ property double pitch: 0.0
+ property double roll: 0.0
+//! [2]
+
+//! [3]
+ onReadingChanged: {
+ pitch = -(Math.atan2(reading.x, Math.sqrt(reading.y * reading.y + reading.z * reading.z)) * 180) / Math.PI;
+ roll = (Math.atan2(reading.y, Math.sqrt(reading.x * reading.x + reading.z * reading.z)) * 180) / Math.PI;
+ }
+ }
+//! [3]
+
+
+ //Timer to read out the x and y rotation of the TiltSensor
+//! [4]
+ Timer {
+ interval: 50; running: true; repeat: true
+
+ onTriggered: {
+ view.rotateY(accel.pitch);
+ view.rotateX(accel.roll);
+ }
+ }
+//! [4]
+}
diff --git a/examples/sensors/cubehouse/icon.png b/examples/sensors/cubehouse/icon.png
new file mode 100644
index 00000000..193ad561
--- /dev/null
+++ b/examples/sensors/cubehouse/icon.png
Binary files differ
diff --git a/examples/sensors/cubehouse/info.json b/examples/sensors/cubehouse/info.json
new file mode 100644
index 00000000..7b1c5af3
--- /dev/null
+++ b/examples/sensors/cubehouse/info.json
@@ -0,0 +1,14 @@
+{
+ "info-version": "1.0",
+ "dict": {
+ "displayName": {
+ "en_US": "Cubehouse"
+ },
+ "identifier": "com.nokia.mt.cubehouse",
+ "runtime": "qml",
+ "main": "QtSensors_cubehouse.qml",
+ "version": "1.0.0",
+ "category": "application",
+ "subcategory": "utility"
+ }
+}
diff --git a/examples/sensors/cubehouse/mesh/table.3ds b/examples/sensors/cubehouse/mesh/table.3ds
new file mode 100644
index 00000000..3e576bd1
--- /dev/null
+++ b/examples/sensors/cubehouse/mesh/table.3ds
Binary files differ