Debian Codegraph @

tests/manual/scene3d-loader/AnimatedEntity.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
8 import QtQuick 2.0 as QQ2
9
10
11 Entity {
12 id: sceneRoot
13
14 Camera {
15 id: camera
16 projectionType: CameraLens.PerspectiveProjection
17 fieldOfView: 45
18 nearPlane : 0.1
19 farPlane : 1000.0
20 position: Qt.vector3d( 0.0, 0.0, 40.0 )
21 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
22 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
23 }
24
25 FirstPersonCameraController { camera: camera }
26
27 components: [
28 RenderSettings {
29 activeFrameGraph: ForwardRenderer {
30 camera: camera
31 clearColor: "transparent"
32 }
33 }
34 ]
35
36 PhongMaterial {
37 id: material
38 }
39
40 TorusMesh {
41 id: torusMesh
42 radius: 5
43 minorRadius: 1
44 rings: 100
45 slices: 20
46 }
47
48 Transform {
49 id: torusTransform
50 scale3D: Qt.vector3d(1.5, 1, 0.5)
51 rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
52 }
53
54 Entity {
55 id: torusEntity
56 components: [ torusMesh, material, torusTransform ]
57 }
58
59 SphereMesh {
60 id: sphereMesh
61 radius: 3
62 }
63
64 Transform {
65 id: sphereTransform
66 property real userAngle: 0.0
67 matrix: {
68 var m = Qt.matrix4x4();
69 m.rotate(userAngle, Qt.vector3d(0, 1, 0))
70 m.translate(Qt.vector3d(20, 0, 0));
71 return m;
72 }
73 }
74
75 QQ2.NumberAnimation {
76 target: sphereTransform
77 property: "userAngle"
78 duration: 10000
79 from: 0
80 to: 360
81
82 loops: QQ2.Animation.Infinite
83 running: true
84 }
85
86 Entity {
87 id: sphereEntity
88 components: [ sphereMesh, material, sphereTransform ]
89 }
90 }