Debian Codegraph @

tests/manual/bigmodel-qml/main.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 Qt3D.Core 2.0
5 import Qt3D.Render 2.0
6 import Qt3D.Input 2.0
7 import Qt3D.Extras 2.0
8 import QtQuick 2.2 as QQ2
9
10 Entity {
11 id: sceneRoot
12
13 FirstPersonCameraController { camera: mainCamera }
14
15 components: [
16 RenderSettings {
17 activeFrameGraph:ForwardRenderer {
18 camera: mainCamera
19 }
20 pickingSettings {
21 pickMethod: PickingSettings.TrianglePicking
22 }
23 },
24 // Event Source will be set by the Qt3DQuickWindow
25 InputSettings { }
26 ]
27
28 Camera {
29 id: mainCamera
30 projectionType: CameraLens.PerspectiveProjection
31 fieldOfView: 22.5
32 aspectRatio: 16 / 9
33 nearPlane: 0.01
34 farPlane: 1000.0
35 position: Qt.vector3d( 0.0, 25.0, 40.0 )
36 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
37 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
38 }
39
40 QQ2.ListModel {
41 id: entityModel
42 QQ2.ListElement { emptyRole: 0 }
43 }
44
45 NodeInstantiator {
46 id: collection
47 property int _count: 0
48 property real spacing: 5
49 property int cols: 8
50 property int _rows: count / cols
51
52 model: entityModel
53 delegate: MyEntity {
54 id: myEntity
55 name: "E" + index
56 property real _lightness: 0.2 + 0.7 / collection._rows * Math.floor(index / collection.cols)
57 property real _hue: (index % collection.cols) / collection.cols
58 position: Qt.vector3d(collection.spacing * (index % collection.cols - 0.5 * (collection.cols - 1)),
59 0.0,
60 collection.spacing * (Math.floor(index / collection.cols) - 0.5 * collection._rows));
61 diffuse: Qt.hsla( _hue, 0.5, _lightness, 1.0 )
62 }
63 }
64
65 QQ2.Timer {
66 interval: 1000
67 repeat: true
68 running: true
69 onTriggered: {
70 entityModel.append({});
71 }
72 }
73 }