Debian Codegraph @

tests/manual/multiplewindows-qml/Scene.qml

raw
1 // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.2 as QQ2
5 import Qt3D.Core 2.0
6 import Qt3D.Render 2.0
7 import Qt3D.Input 2.0
8 import Qt3D.Extras 2.0
9
10 Entity {
11 id: sceneRoot
12
13 property alias view1: renderer.window
14 property alias view2: renderer2.window
15
16 Camera {
17 id: camera
18 projectionType: CameraLens.PerspectiveProjection
19 fieldOfView: 45
20 aspectRatio: 16/9
21 nearPlane : 0.1
22 farPlane : 1000.0
23 position: Qt.vector3d( 0.0, 0.0, -40.0 )
24 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
25 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
26 }
27
28 OrbitCameraController {
29 camera: camera
30 }
31
32 components: [
33 RenderSettings {
34 activeFrameGraph: TechniqueFilter {
35 ForwardRenderer {
36 id: renderer
37 clearColor: Qt.rgba(0, 0.5, 1, 1)
38 camera: camera
39 }
40 ForwardRenderer {
41 id: renderer2
42 clearColor: Qt.rgba(0, 0.5, 1, 1)
43 camera: camera
44 }
45 }
46 },
47 // Event Source will be set by the Qt3DQuickWindow
48 InputSettings { }
49 ]
50
51 PhongMaterial {
52 id: material
53 }
54
55 TorusMesh {
56 id: torusMesh
57 radius: 5
58 minorRadius: 1
59 rings: 100
60 slices: 20
61 }
62
63 Transform {
64 id: torusTransform
65 scale3D: Qt.vector3d(1.5, 1, 0.5)
66 rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
67 }
68
69 Entity {
70 id: torusEntity
71 components: [ torusMesh, material, torusTransform ]
72 }
73
74 SphereMesh {
75 id: sphereMesh
76 radius: 3
77 }
78
79 Transform {
80 id: sphereTransform
81 property real userAngle: 0.0
82 matrix: {
83 var m = Qt.matrix4x4();
84 m.rotate(userAngle, Qt.vector3d(0, 1, 0));
85 m.translate(Qt.vector3d(20, 0, 0));
86 return m;
87 }
88 }
89
90 QQ2.NumberAnimation {
91 target: sphereTransform
92 property: "userAngle"
93 duration: 10000
94 from: 0
95 to: 360
96
97 loops: QQ2.Animation.Infinite
98 running: true
99 }
100
101 Entity {
102 id: sphereEntity
103 components: [ sphereMesh, material, sphereTransform ]
104 }
105 }