summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-05-18 09:01:02 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-05-18 09:01:02 +0200
commit07c56ca4fb8240bea18cf8e941e3c61b48d7e7ed (patch)
treeea346024bf42a7cf6a603693877bf34031ecfbbb
SceneGraph demo
-rw-r--r--AnimatedPresentation.qml85
-rw-r--r--BackgroundSwirls.qml82
-rw-r--r--CodeSection.qml37
-rw-r--r--EffectSampleSlide.qml33
-rw-r--r--EffectSlide/EffectSlide.qml12
-rw-r--r--EffectSlide/ShaderDemo.qml298
-rw-r--r--EffectSlide/Slider.qml93
-rw-r--r--EffectSlide/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--EffectSlide/qmldir1
-rw-r--r--EffectSlide/qt-logo.pngbin0 -> 13923 bytes
-rw-r--r--GLIntegrationSlide.qml31
-rw-r--r--SlideDeck.qml93
-rw-r--r--Swirl.qml66
-rw-r--r--TextSlide.qml50
-rw-r--r--ThreadingSlide.qml44
-rw-r--r--VSyncSlide.qml42
16 files changed, 967 insertions, 0 deletions
diff --git a/AnimatedPresentation.qml b/AnimatedPresentation.qml
new file mode 100644
index 0000000..0b1462b
--- /dev/null
+++ b/AnimatedPresentation.qml
@@ -0,0 +1,85 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+Presentation {
+
+ id: deck
+
+ width: 600
+ height: 400
+
+
+ property bool inTransition: false;
+
+ property variant fromSlide;
+ property variant toSlide;
+
+ property int transitionTime: 2000;
+
+ BackgroundSwirls {}
+
+ ShaderEffectItem {
+ id: effect
+ anchors.fill: parent
+ visible: deck.inTransition
+ property variant source: ShaderEffectSource {
+ sourceItem: fromSlide;
+ smooth: true
+ sourceRect: Qt.rect(-fromSlide.x, -fromSlide.y, parent.width, parent.height);
+ }
+ property real ratio: 0
+ property real alpha: Math.pow(1 - ratio, 5);
+ property real amplitude: 0.1 * ratio
+ property real frequency: 20
+ property real time: 0
+ NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 3000 }
+ fragmentShader:
+ "uniform highp float amplitude;" +
+ "uniform highp float frequency;" +
+ "uniform highp float time;" +
+ "uniform lowp float ratio;" +
+ "uniform lowp float alpha;" +
+ "uniform sampler2D source;" +
+ "varying highp vec2 qt_TexCoord0;" +
+ "void main() {" +
+ " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
+ " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * alpha;" +
+ "}"
+ }
+
+ SequentialAnimation {
+ id: transition
+ ScriptAction { script: {
+ deck.inTransition = true
+ fromSlide.opacity = 0
+ toSlide.visible = true
+ }
+ }
+
+ ParallelAnimation {
+ NumberAnimation { target: effect; property: "ratio"; from: 0; to: 1; duration: deck.transitionTime; easing.type: Easing.InQuad }
+ NumberAnimation { target: toSlide; property: "opacity"; from: 0; to: 1; duration: deck.transitionTime; easing.type: Easing.InQuart }
+ }
+
+ ScriptAction { script: {
+ deck.inTransition = false
+ fromSlide.visible = false
+ fromSlide.opacity = 0
+ toSlide.opacity = 1
+ }
+ }
+ }
+
+ function switchSlides(from, to)
+ {
+ if (deck.inTransition)
+ return false
+
+ deck.fromSlide = from
+ deck.toSlide = to
+
+ transition.running = true;
+
+ return true
+ }
+}
diff --git a/BackgroundSwirls.qml b/BackgroundSwirls.qml
new file mode 100644
index 0000000..01bccd0
--- /dev/null
+++ b/BackgroundSwirls.qml
@@ -0,0 +1,82 @@
+import QtQuick 2.0
+import Qt.labs.particles 2.0
+
+Item {
+ anchors.fill: parent
+
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#355f80" }
+ //GradientStop { position: 0; color: "steelblue" }
+ GradientStop { position: 1; color: "black" }
+ }
+ }
+
+ Rectangle {
+ id: colorTableItem
+ width: 16
+ height: 64
+ anchors.fill: parent
+
+ property color color1: Qt.rgba(0.8, 0.8, 1, 0.2)
+ property color color2: Qt.rgba(0.8, 0.8, 1, 0.2)
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: "transparent" }
+ GradientStop { position: 0.03; color: colorTableItem.color1 }
+ GradientStop { position: 0.2; color: "transparent" }
+ GradientStop { position: 0.8; color: "transparent" }
+ GradientStop { position: 0.97; color: colorTableItem.color2 }
+ GradientStop { position: 1; color: "transparent" }
+ }
+
+ visible: false
+ }
+
+ ShaderEffectSource {
+ id: colorTableSource
+ sourceItem: colorTableItem
+ smooth: true
+ }
+
+ Repeater {
+ model: 4
+ Swirl {
+
+ width: parent.width
+ anchors.bottom: parent.bottom
+ height: parent.height / (2 + index)
+ opacity: 0.3
+ speed: (index + 1) / 5
+ colorTable: colorTableSource
+ }
+ }
+
+
+ ParticleSystem{
+ id: particles
+ }
+ ColoredParticle{
+ anchors.fill: parent
+ system: particles
+ image: "images/particle.png"
+ alpha: 0
+ colorVariation: 0.2
+ }
+ TrailEmitter{
+ anchors.fill: parent
+ system: particles
+ particlesPerSecond: Math.sqrt(parent.width * parent.height) / 30
+ particleDuration: 2000
+ emitting: true
+ particleSize: 4
+ particleSizeVariation: 2
+
+ acceleration: AngleVector{ angle: 90; angleVariation: 360; magnitude: 10; }
+ speed: AngleVector{ angle: -90; angleVariation: 360; magnitude: 5; }
+ }
+
+
+
+}
diff --git a/CodeSection.qml b/CodeSection.qml
new file mode 100644
index 0000000..e1da4b3
--- /dev/null
+++ b/CodeSection.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle
+{
+ id: root
+
+ property string text
+ property real fontSize: parent.baseFontSize / 2
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: Qt.rgba(1, 1, 1, 0.3) }
+ GradientStop { position: 1; color: Qt.rgba(0, 0, 0, 0.3) }
+ }
+
+ border.color: "lightsteelblue"
+ border.width: 2
+ radius: 10
+
+ x: parent.width / 2
+ width: parent.width / 2
+ height: parent.height
+
+ Item {
+ anchors.fill: parent
+ anchors.margins: 20
+ clip: true
+
+ Text {
+ id: textItem
+ anchors.fill: parent
+ text: root.text;
+ font.family: "courier"
+ font.pixelSize: root.fontSize
+ color: "white"
+ }
+ }
+}
diff --git a/EffectSampleSlide.qml b/EffectSampleSlide.qml
new file mode 100644
index 0000000..123d243
--- /dev/null
+++ b/EffectSampleSlide.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+Slide {
+ title: "ShaderEffectItem"
+ content: [
+ "Inline GLSL",
+ "One or more QML items or subtrees as sources"
+ ]
+ contentWidth: parent.width / 3
+ CodeSection {
+ x: parent.width / 3
+ width: 2 * parent.width / 3
+ text: "
+ShaderEffectItem {
+width: 180
+height: 180
+property variant source: theSource
+property color tint: \"red\"
+fragmentShader: \"
+ uniform sampler2D source;
+ uniform lowp vec4 tint;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 c = texture2D(source, qt_TexCoord0);
+ lowp float lo = min(min(c.x, c.y), c.z);
+ lowp float hi = max(max(c.x, c.y), c.z);
+ gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
+ }\"
+"
+ }
+}
diff --git a/EffectSlide/EffectSlide.qml b/EffectSlide/EffectSlide.qml
new file mode 100644
index 0000000..2b736f5
--- /dev/null
+++ b/EffectSlide/EffectSlide.qml
@@ -0,0 +1,12 @@
+import Qt.labs.presentation 1.0
+
+Slide
+{
+ title: "ShaderEffectItem Example"
+
+ ShaderDemo
+ {
+ anchors.centerIn: parent
+ scale: parent.width * 0.7 / width
+ }
+}
diff --git a/EffectSlide/ShaderDemo.qml b/EffectSlide/ShaderDemo.qml
new file mode 100644
index 0000000..f65453e
--- /dev/null
+++ b/EffectSlide/ShaderDemo.qml
@@ -0,0 +1,298 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Declarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 640
+ height: 360
+
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ smooth: true
+ }
+
+ function saturate(x) {
+ return Math.min(Math.max(x, 0), 1)
+ }
+
+ function sliderToColor(x) {
+ return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
+ saturate(Math.min(6 * x, 4 - 6 * x)),
+ saturate(Math.min(6 * x - 2, 6 - 6 * x)))
+ }
+
+ Grid {
+ anchors.centerIn: parent
+ columns: 3
+
+ Item {
+ id: theItem
+ width: 180
+ height: 180
+ ListView {
+ anchors.centerIn: parent
+ width: 160
+ height: 140
+ clip: true
+ snapMode: ListView.SnapOneItem
+ model: VisualItemModel {
+ Text {
+ width: 160
+ height: 140
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 120
+ font.family: "Times"
+ color: "white"
+ text: "Qt"
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "qt-logo.png"
+ smooth: true
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "face-smile.png"
+ smooth: true
+ }
+ }
+ }
+ }
+ ShaderEffectItem {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property real amplitude: 0.04 * wobbleSlider.value
+ property real frequency: 20
+ property real time: 0
+ NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
+ fragmentShader:
+ "uniform highp float amplitude;" +
+ "uniform highp float frequency;" +
+ "uniform highp float time;" +
+ "uniform sampler2D source;" +
+ "varying highp vec2 qt_TexCoord0;" +
+ "uniform lowp float qt_Opacity;" +
+ "void main() {" +
+ " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
+ " gl_FragColor = qt_Opacity * texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x));" +
+ "}"
+ Slider {
+ id: wobbleSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffectItem {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property variant shadow: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffectItem {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffectItem {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform float lowp qt_Opacity;
+ void main() {
+ gl_FragColor = (0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta));
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = (0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ property real angle: 0
+ property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
+ NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
+ property variant delta: Qt.size(offset.x / width, offset.y / height)
+ property real darkness: shadowSlider.value
+ fragmentShader: "
+ uniform highp vec2 offset;
+ uniform sampler2D source;
+ uniform sampler2D shadow;
+ uniform highp float darkness;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ uniform lowp float qt_Opacity;
+ void main() {
+ lowp vec4 fg = texture2D(source, qt_TexCoord0);
+ lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
+ gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
+ }"
+ Slider {
+ id: shadowSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffectItem {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ uniform highp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
+ lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
+ lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
+ lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
+ lowp vec4 gx = (tl + bl) - (tr + br);
+ lowp vec4 gy = (tl + tr) - (bl + br);
+ gl_FragColor.xyz = vec3(0.);
+ gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
+ }"
+ }
+ ShaderEffectItem {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property color tint: sliderToColor(colorizeSlider.value)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp vec4 tint;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 c = texture2D(source, qt_TexCoord0);
+ lowp float lo = min(min(c.x, c.y), c.z);
+ lowp float hi = max(max(c.x, c.y), c.z);
+ gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
+ }"
+ Slider {
+ id: colorizeSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffectItem {
+ width: 180
+ height: 180
+ mesh: GridMesh { resolution: Qt.size(10, 10) }
+ property variant source: theSource
+ property real bend: 0
+ property real minimize: 0
+ property real side: genieSlider.value
+ SequentialAnimation on bend {
+ loops: Animation.Infinite
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1600 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ }
+ SequentialAnimation on minimize {
+ loops: Animation.Infinite
+ PauseAnimation { duration: 300 }
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1300 }
+ }
+ vertexShader: "
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ uniform highp float bend;
+ uniform highp float minimize;
+ uniform highp float side;
+ uniform highp float width;
+ uniform highp float height;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ highp vec4 pos = qt_Vertex;
+ pos.y = mix(qt_Vertex.y, height, minimize);
+ highp float t = pos.y / height;
+ t = (3. - 2. * t) * t * t;
+ pos.x = mix(qt_Vertex.x, side * width, t * bend);
+ gl_Position = qt_ModelViewProjectionMatrix * pos;
+ }"
+ Slider {
+ id: genieSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ }
+}
diff --git a/EffectSlide/Slider.qml b/EffectSlide/Slider.qml
new file mode 100644
index 0000000..e31335d
--- /dev/null
+++ b/EffectSlide/Slider.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Declarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property real value: bar.x / (foo.width - bar.width)
+ Item {
+ id: foo
+ width: parent.width - 4
+ height: 6
+ anchors.centerIn: parent
+
+ Rectangle {
+ height: parent.height
+ anchors.left: parent.left
+ anchors.right: bar.horizontalCenter
+ color: "blue"
+ radius: 3
+ }
+ Rectangle {
+ height: parent.height
+ anchors.left: bar.horizontalCenter
+ anchors.right: parent.right
+ color: "gray"
+ radius: 3
+ }
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ radius: 3
+ border.width: 2
+ border.color: "black"
+ }
+
+ Rectangle {
+ id: bar
+ y: -7
+ width: 20
+ height: 20
+ radius: 15
+ color: "white"
+ border.width: 2
+ border.color: "black"
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: foo.width - parent.width
+ }
+ }
+ }
+}
+
diff --git a/EffectSlide/face-smile.png b/EffectSlide/face-smile.png
new file mode 100644
index 0000000..3d66d72
--- /dev/null
+++ b/EffectSlide/face-smile.png
Binary files differ
diff --git a/EffectSlide/qmldir b/EffectSlide/qmldir
new file mode 100644
index 0000000..e5e689b
--- /dev/null
+++ b/EffectSlide/qmldir
@@ -0,0 +1 @@
+EffectSlide 1.0 EffectSlide.qml
diff --git a/EffectSlide/qt-logo.png b/EffectSlide/qt-logo.png
new file mode 100644
index 0000000..7d3e97e
--- /dev/null
+++ b/EffectSlide/qt-logo.png
Binary files differ
diff --git a/GLIntegrationSlide.qml b/GLIntegrationSlide.qml
new file mode 100644
index 0000000..6a10d37
--- /dev/null
+++ b/GLIntegrationSlide.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+Slide { // GL Over / GL Under
+ title: "Integration with OpenGL"
+ content: [
+ "Hook in custom OpenGL rendering code",
+ "Under QML",
+ "Over QML",
+ "Inside QML using an FBO"
+ ]
+ contentWidth: integrationImage.x
+
+ Image {
+ id: integrationImage
+ anchors.right: parent.right
+ height: parent.height / 2
+ smooth: true
+ fillMode: Image.PreserveAspectFit
+ source: "images/ogre.png"
+ }
+
+ Text {
+ font.pixelSize: parent.baseFontSize * 0.4
+ color: "white"
+ text: "Ogre3D inside the QML Scene Graph"
+ anchors.top: integrationImage.bottom
+ anchors.horizontalCenter: integrationImage.horizontalCenter
+ }
+}
+
diff --git a/SlideDeck.qml b/SlideDeck.qml
new file mode 100644
index 0000000..c417df4
--- /dev/null
+++ b/SlideDeck.qml
@@ -0,0 +1,93 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+import EffectSlide 1.0
+import samegame 1.0
+
+AnimatedPresentation {
+ width: 800
+ height: 600
+
+ property color textColor: "white"
+
+
+ Slide {
+ centeredText: "QML Scene Graph"
+ fontScale: 2
+
+ }
+
+ Slide {
+ title: "QML Scene Graph"
+ content: [
+ "Rendering engine for QML 2 in Qt 5",
+ "Retained graphics model",
+ "OpenGL (ES) 2.0 based",
+ "Runs on all OpenGL capable Lighthouse platforms"
+ ]
+ }
+
+
+ Slide
+ {
+ title: "It works!"
+ SameGame
+ {
+ anchors.centerIn: parent
+ scale: parent.height / height
+ }
+ }
+
+
+ TextSlide {}
+
+
+ EffectSampleSlide { }
+ EffectSlide {}
+
+
+ VSyncSlide {}
+
+
+ GLIntegrationSlide {}
+
+ Slide { // integrated with Qt slide... painted item thingy
+ centeredText: "painted item"
+ }
+
+
+ ThreadingSlide {}
+
+
+ Slide {
+ fontScale: 1.5
+ centeredText: "No C++ was used in this presentation"
+ }
+
+
+ Slide {
+ fontScale: 1.5
+ centeredText: "QML Scene Graph\n\nThank you for listening!"
+ }
+
+
+ Rectangle {
+ id: slideCover
+ color: "black"
+ anchors.fill: parent
+
+ visible: false
+
+ SequentialAnimation {
+ id: slideCoverFadeAnimation
+ NumberAnimation { target: slideCover; property: "opacity"; from: 1; to: 0; duration: 2500 }
+ PropertyAction { target: slideCover; property: "visible"; value: "false" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: slideCoverFadeAnimation.running = true
+ }
+ }
+
+}
diff --git a/Swirl.qml b/Swirl.qml
new file mode 100644
index 0000000..e50de3a
--- /dev/null
+++ b/Swirl.qml
@@ -0,0 +1,66 @@
+ import QtQuick 2.0
+
+ShaderEffectItem {
+ id: shader
+
+ width: 400
+ height: 300
+
+ property real speed: 1
+
+ property color d: Qt.rgba(Math.random() * 0.7,
+ Math.random() * 0.5,
+ Math.random() * 0.7,
+ Math.random() * 0.5)
+ property real tx
+ NumberAnimation on tx { from: 0; to: Math.PI * 2; duration: (Math.random() * 30 + 30) * 1000 / speed; loops: Animation.Infinite }
+ property real ty
+ NumberAnimation on ty { from: 0; to: Math.PI * 2; duration: (Math.random() * 30 + 30) * 1000 / speed; loops: Animation.Infinite }
+ property real tz
+ NumberAnimation on tz { from: 0; to: Math.PI * 2; duration: (Math.random() * 30 + 30) * 1000 / speed; loops: Animation.Infinite }
+ property real tw
+ NumberAnimation on tw { from: 0; to: Math.PI * 2; duration: (Math.random() * 30 + 30) * 1000 / speed; loops: Animation.Infinite }
+
+ property real amplitude: height / 2
+
+ property variant colorTable: ShaderEffectSource { sourceItem: Rectangle { width: 4; height: 4; color: "steelblue" } }
+
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform lowp sampler2D colorTable;
+ varying highp vec2 qt_TexCoord0;
+
+ void main() {
+ gl_FragColor = texture2D(colorTable, qt_TexCoord0);
+ gl_FragColor.w *= qt_Opacity;
+ }
+ "
+
+ vertexShader: "
+ uniform lowp vec4 d;
+ uniform highp float tx;
+ uniform highp float ty;
+ uniform highp float tz;
+ uniform highp float tw;
+ uniform highp float amplitude;
+ uniform highp mat4 qt_ModelViewProjectionMatrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+
+ void main() {
+ highp vec4 pos = qt_Vertex;
+
+ highp float y1 = sin(tx + d.x * qt_MultiTexCoord0.x * 17. + 2. * d.y) + sin(ty + d.z * qt_MultiTexCoord0.x * 11. + 5. * d.w);
+ highp float y2 = sin(tz + d.w * qt_MultiTexCoord0.x * 7. + 3. * d.z) + sin(tw + d.y * qt_MultiTexCoord0.x * 19. + 3. * d.x);
+
+ pos.y += mix(y1, y2, qt_MultiTexCoord0.y) * amplitude * 0.5;
+
+ gl_Position = qt_ModelViewProjectionMatrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }
+ "
+
+ mesh: GridMesh { resolution: Qt.size(width / 10, 4) }
+
+}
diff --git a/TextSlide.qml b/TextSlide.qml
new file mode 100644
index 0000000..7cad00f
--- /dev/null
+++ b/TextSlide.qml
@@ -0,0 +1,50 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+Slide {
+ id: textSlide
+
+ title: "Crisp Text while Scaling and Rotating"
+
+ Text {
+ id: textElement
+ anchors.centerIn: parent
+ width: 300
+ height: 100
+ wrapMode: Text.Wrap
+ color: "white"
+ font.pixelSize: 10
+ font.family: "Times New Roman"
+
+ property string content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer eget porttitor augue. Cras erat velit, suscipit a egestas ut, condimentum sed leo. Maecenas varius tempus metus et tincidunt. Donec magna magna, tempor at convallis sed, tincidunt at eros. Sed ac ante et ligula luctus varius. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris id dui tortor, vitae feugiat neque. Ut eleifend pulvinar mauris, ut lobortis ligula commodo et. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris sit amet auctor magna. Donec placerat dictum lobortis. Curabitur tincidunt pharetra leo. Etiam luctus, urna quis ornare pharetra, sem nibh facilisis tellus, id rhoncus quam turpis a neque."
+ text: content.substring(0, textElement.contentLength);
+
+ property int contentLength: 2
+ NumberAnimation on contentLength {
+ from: 1; to: textElement.content.length ; duration: textElement.content.length * 25; running: textSlide.visible
+ }
+
+ SequentialAnimation on rotation {
+ PauseAnimation { duration: 2000 }
+ NumberAnimation { from: 0; to: 360; duration: 8000; easing.type: Easing.InOutQuart }
+
+ running: textSlide.visible;
+ loops: Animation.Infinite
+ }
+
+ SequentialAnimation on scale {
+ PauseAnimation { duration: 5000 }
+ NumberAnimation { to: 2; duration: 500; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 4000 }
+ NumberAnimation { to: 10; duration: 800; easing.type: Easing.InOutSine}
+ NumberAnimation { to: 0.5; duration: 800; easing.type: Easing.InOutSine }
+ NumberAnimation { to: 5; duration: 800; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 2000 }
+ NumberAnimation { to: 1; duration: 800; easing.type: Easing.InOutSine }
+
+ running: textSlide.visible
+ loops: Animation.Infinite
+ }
+ }
+}
+
diff --git a/ThreadingSlide.qml b/ThreadingSlide.qml
new file mode 100644
index 0000000..b6d00b6
--- /dev/null
+++ b/ThreadingSlide.qml
@@ -0,0 +1,44 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+Slide
+{
+ title: "Threaded Rendering Model"
+ contentWidth: renderThreadingImage.x
+ content: [
+ "Dedicated render thread",
+ "Application thread never blocked",
+ "Animations advanced while rendering"
+ ]
+
+ Image {
+ id: renderThreadingImage
+ source: "images/render-threading.png"
+ anchors.right: parent.right
+ height: parent.height
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ }
+}
+
+
+
+// Slide
+// {
+// title: "Traditional Rendering Model"
+// content: [
+// "One Thread",
+// "Sequential processing",
+// "Blocked during swap"
+// ]
+
+
+// Image {
+// source: "images/traditional-threading.png"
+// anchors.right: parent.right
+// anchors.rightMargin: parent.baseFontSize * 2
+// height: parent.height
+// fillMode: Image.PreserveAspectFit
+// smooth: true
+// }
+// }
diff --git a/VSyncSlide.qml b/VSyncSlide.qml
new file mode 100644
index 0000000..188c3db
--- /dev/null
+++ b/VSyncSlide.qml
@@ -0,0 +1,42 @@
+import QtQuick 2.0
+import Qt.labs.presentation 1.0
+
+Slide { // Vsync animations / flickable..
+ title: "Animations Synchronized to VBlank"
+ content: [
+ "Advance animations exactly once per frame",
+ "No more jerkies",
+ "It's Velvet!"
+ ]
+ contentWidth: width / 2
+
+ Flickable {
+ id: vsyncFlickable
+ x: parent.width / 2
+ width: parent.width / 2
+ height: parent.height
+
+ clip: true
+
+ contentHeight: 25000
+ contentWidth: 25000
+
+ Image {
+ id: flickImage
+ anchors.fill: parent
+ smooth: true
+ source: "images/landscape.png"
+ fillMode: Image.Tile
+ }
+ }
+
+ Text {
+ font.pixelSize: parent.baseFontSize * 0.3
+ color: "white"
+ text: "Effect not capturable on projector or camera"
+ anchors.top: vsyncFlickable.bottom
+ anchors.horizontalCenter: vsyncFlickable.horizontalCenter
+ }
+}
+
+