Debian Codegraph @

tests/manual/enabled-qml/main.qml

raw
1 // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import Qt3D.Core 2.0
5 import Qt3D.Render 2.0
6 import Qt3D.Extras 2.0
7 import QtQuick 2.0 as QQ2
8
9 Entity {
10 id: sceneRoot
11 property int counter: 0
12
13 components: [
14 RenderSettings {
15 activeFrameGraph: Viewport {
16 normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
17 enabled: counter !== 5
18
19 RenderSurfaceSelector {
20
21 ClearBuffers {
22 buffers : ClearBuffers.ColorDepthBuffer
23 clearColor: "white"
24 enabled: counter !== 6
25 }
26
27 CameraSelector {
28 camera: camera
29 enabled: counter !== 7
30
31 LayerFilter {
32 enabled: counter === 12
33 layers: sceneLayer
34 }
35 }
36 }
37 }
38 }
39 ]
40
41 QQ2.Timer {
42 interval: 500
43 repeat: true
44 running: true
45 onTriggered: {
46 counter += 1;
47 if (counter > 15)
48 counter = 0;
49 }
50 }
51
52 Camera {
53 id: camera
54 projectionType: CameraLens.PerspectiveProjection
55 fieldOfView: 45
56 aspectRatio: 16/9
57 nearPlane : 0.1
58 farPlane : 1000.0
59 enabled: counter !== 4
60 position: Qt.vector3d(0, 10, 10)
61 viewCenter: Qt.vector3d(0, 0, 0)
62 upVector: Qt.vector3d(0, 1, 0)
63 }
64
65 // Sphere
66 Entity {
67 SphereMesh {
68 id: sphereMesh
69 enabled: counter !== 0
70 }
71
72 PhongMaterial {
73 id: material
74 ambient: "dodgerblue"
75 diffuse: "chartreuse"
76 specular: "ghostwhite"
77 enabled: counter !== 1
78 }
79
80 Layer {
81 id: sceneLayer
82 enabled: counter !== 2
83 }
84
85 Transform {
86 id: transform
87 property real x: 0.0
88 property real y: 0.0
89 property real z: 0.0
90 translation: Qt.vector3d(x, y, z)
91 enabled: counter !== 3
92 }
93
94 QQ2.SequentialAnimation {
95 running: true
96 loops: QQ2.Animation.Infinite
97 QQ2.NumberAnimation {
98 target: transform; property: "x"
99 from: 0; to: 5;
100 duration: 550
101 easing.type: QQ2.Easing.InOutQuad
102 }
103 QQ2.NumberAnimation {
104 target: transform; property: "y"
105 from: 0; to: 5;
106 duration: 650
107 easing.type: QQ2.Easing.InOutQuad
108 }
109 QQ2.NumberAnimation {
110 target: transform; property: "z"
111 from: 0; to: 5;
112 duration: 350
113 easing.type: QQ2.Easing.InOutQuad
114 }
115 QQ2.NumberAnimation {
116 target: transform; property: "x"
117 from: 5; to: 0;
118 duration: 550
119 easing.type: QQ2.Easing.InOutQuad
120 }
121 QQ2.NumberAnimation {
122 target: transform; property: "y"
123 from: 5; to: 0;
124 duration: 350
125 easing.type: QQ2.Easing.InOutQuad
126 }
127 QQ2.NumberAnimation {
128 target: transform; property: "z"
129 from: 5; to: 0;
130 duration: 650
131 easing.type: QQ2.Easing.InOutQuad
132 }
133 }
134
135 components: [sphereMesh, material, sceneLayer, transform]
136 }
137
138 // Floor
139 Entity {
140 PlaneMesh {
141 id: planeMesh
142 width: 25.0
143 height: 10
144 }
145
146 PhongMaterial {
147 id: floorMaterial
148 ambient: "lawngreen"
149 diffuse: "forestgreen"
150 specular: "floralwhite"
151 shininess: 0.5
152 }
153
154 Layer {
155 id: floorLayer
156 }
157
158 components: [planeMesh, floorMaterial, floorLayer]
159 }
160 }
161