From b35237bfee04ae38cc35bdb333ab1ef8a74ffaae Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 9 May 2017 15:14:00 +0200 Subject: Scene2D example: highlight that QtQuick is a Texture on a Mesh Change-Id: Ibc78cc120ceed26c8521fa116e1794500b47c2dd Task-number: QTBUG-60695 Reviewed-by: Sean Harmer --- examples/qt3d/scene2d/main.qml | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'examples/qt3d/scene2d/main.qml') diff --git a/examples/qt3d/scene2d/main.qml b/examples/qt3d/scene2d/main.qml index d9d4676c2..35b8f3eb6 100644 --- a/examples/qt3d/scene2d/main.qml +++ b/examples/qt3d/scene2d/main.qml @@ -108,25 +108,41 @@ Entity { } Entity { - id: plane + id: cube - components: [planeTransform, planeMaterial, planeMesh, planePicker] + components: [cubeTransform, cubeMaterial, cubeMesh, cubePicker] + + property real rotationAngle: 0 + + Behavior on rotationAngle { + enabled: logoControls.enabled + RotationAnimation { + direction: RotationAnimation.Shortest + duration: 450 + } + } + + RotationAnimation on rotationAngle { + running: !logoControls.enabled + loops: Animation.Infinite + from: 0; to: 360 + duration: 4000 + onStopped: cube.rotationAngle = 0 + } Transform { - id: planeTransform + id: cubeTransform translation: Qt.vector3d(2, 0, 10) - rotation: fromAxisAndAngle(Qt.vector3d(1,0,0), 90) + scale3D: Qt.vector3d(1, 4, 1) + rotation: fromAxisAndAngle(Qt.vector3d(0,1,0), cube.rotationAngle) } - PlaneMesh { - id: planeMesh - width: 1 - height: 4 - mirrored: true // Align OpenGL and Qt window coordinates by flipping texture coordinates + CuboidMesh { + id: cubeMesh } ObjectPicker { - id: planePicker + id: cubePicker hoverEnabled: true dragEnabled: true @@ -141,7 +157,7 @@ Entity { } TextureMaterial { - id: planeMaterial + id: cubeMaterial texture: offscreenTexture } @@ -164,7 +180,7 @@ Entity { } } - entities: [ plane ] + entities: [ cube ] mouseEnabled: false LogoControls { -- cgit v1.2.3