summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-01-20 11:49:14 +0100
committerPaul Lemire <paul.lemire@kdab.com>2015-01-24 14:30:08 +0100
commitef096175a0d0da6b79e5809d6a249b906ea0e578 (patch)
tree2f5dd3d3bacb1a43e8f2ec1384c4e792b3479a9a /examples
parentaee56cd070695e53484c6f773487c253e3cee768 (diff)
enabled-qml: use enabled flag on FrameGraph nodes
Change-Id: Ifd76233a38b07ee82bb0dca2cd69746144711c11 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/enabled-qml/main.cpp6
-rw-r--r--examples/enabled-qml/main.qml172
2 files changed, 110 insertions, 68 deletions
diff --git a/examples/enabled-qml/main.cpp b/examples/enabled-qml/main.cpp
index f5db7be29..61425f19b 100644
--- a/examples/enabled-qml/main.cpp
+++ b/examples/enabled-qml/main.cpp
@@ -42,7 +42,7 @@
#include <QGuiApplication>
#include <Qt3DCore/QCamera>
-#include <Qt3DQuick/QuickWindow>
+#include <Qt3DCore/Window>
#include <Qt3DQuick/QQmlAspectEngine>
#include <Qt3DRenderer/QRenderAspect>
@@ -53,13 +53,13 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
- Qt3D::Quick::QuickWindow view;
+ Qt3D::Window view;
Qt3D::Quick::QQmlAspectEngine engine;
engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect());
engine.aspectEngine()->initialize();
QVariantMap data;
data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("window"), QVariant::fromValue(&view));
+ data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
engine.aspectEngine()->setData(data);
engine.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
view.show();
diff --git a/examples/enabled-qml/main.qml b/examples/enabled-qml/main.qml
index 0d4f2723c..5c69ee192 100644
--- a/examples/enabled-qml/main.qml
+++ b/examples/enabled-qml/main.qml
@@ -48,8 +48,25 @@ Entity {
property int counter: 0
components: FrameGraph {
- ForwardRenderer {
- camera: basicCamera
+ Viewport {
+ rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+ clearColor: "white"
+ enabled: counter !== 5
+
+ ClearBuffer {
+ buffers : ClearBuffer.ColorDepthBuffer
+ enabled: counter !== 6
+ }
+
+ CameraSelector {
+ camera: basicCamera
+ enabled: counter !== 7
+
+ LayerFilter {
+ enabled: counter === 12
+ layers: "scene"
+ }
+ }
}
}
@@ -59,7 +76,7 @@ Entity {
running: true
onTriggered: {
counter += 1;
- if (counter > 6)
+ if (counter > 15)
counter = 0;
}
}
@@ -72,7 +89,7 @@ Entity {
LookAt {
upVector: Qt.vector3d(0, 1, 0)
viewCenter: Qt.vector3d(0, 0, 0)
- position: Qt.vector3d(0, 0, -10)
+ position: Qt.vector3d(0, 10, -10)
}
}
components: [basicCameraTransform, cameraLens]
@@ -88,76 +105,101 @@ Entity {
enabled: counter !== 4
}
- SphereMesh {
- id: sphereMesh
- enabled: counter !== 0
- }
+ // Sphere
+ Entity {
+ SphereMesh {
+ id: sphereMesh
+ enabled: counter !== 0
+ }
- PhongMaterial {
- id: material
- ambient: "dodgerblue"
- diffuse: "chartreuse"
- specular: "ghostwhite"
- enabled: counter !== 1
- }
+ PhongMaterial {
+ id: material
+ ambient: "dodgerblue"
+ diffuse: "chartreuse"
+ specular: "ghostwhite"
+ enabled: counter !== 1
+ }
- Layer {
- id: layer
- enabled: counter !== 2
- }
+ Layer {
+ id: layer
+ enabled: counter !== 2
+ names: "scene"
+ }
- Transform {
- id: transform
- enabled: counter !== 3
-
- Translate {
- id: translate
-
- QQ2.SequentialAnimation {
- running: true
- loops: QQ2.Animation.Infinite
- QQ2.NumberAnimation {
- target: translate; property: "dx"
- from: 0; to: 5;
- duration: 550
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: translate; property: "dy"
- from: 0; to: 5;
- duration: 650
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: translate; property: "dz"
- from: 0; to: 5;
- duration: 350
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: translate; property: "dx"
- from: 5; to: 0;
- duration: 550
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: translate; property: "dy"
- from: 5; to: 0;
- duration: 350
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: translate; property: "dz"
- from: 5; to: 0;
- duration: 650
- easing.type: QQ2.Easing.InOutQuad
+ Transform {
+ id: transform
+ enabled: counter !== 3
+
+ Translate {
+ id: translate
+
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.NumberAnimation {
+ target: translate; property: "dx"
+ from: 0; to: 5;
+ duration: 550
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: translate; property: "dy"
+ from: 0; to: 5;
+ duration: 650
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: translate; property: "dz"
+ from: 0; to: 5;
+ duration: 350
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: translate; property: "dx"
+ from: 5; to: 0;
+ duration: 550
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: translate; property: "dy"
+ from: 5; to: 0;
+ duration: 350
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: translate; property: "dz"
+ from: 5; to: 0;
+ duration: 650
+ easing.type: QQ2.Easing.InOutQuad
+ }
}
}
}
+ components: [sphereMesh, material, layer, transform]
}
+ // Floor
Entity {
- components: [sphereMesh, material, layer, transform]
+ PlaneMesh {
+ id: planeMesh
+ width: 25.0
+ height: 10
+ }
+
+ PhongMaterial {
+ id: floorMaterial
+ ambient: "lawngreen"
+ diffuse: "forestgreen"
+ specular: "floralwhite"
+ shininess: 0.5
+ }
+
+ Layer {
+ id: floorLayer
+ names: "floor"
+ }
+
+ components: [planeMesh, floorMaterial, floorLayer]
}
}