Debian Codegraph @

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