Debian Codegraph @

tests/manual/distancefieldtext-dynamic/TextScene.qml

raw
1 // Copyright (C) 2023 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.9
8 import QtQuick 2.0 as QQ2;
9
10 Entity {
11 id: sceneRoot
12
13 Camera {
14 id: camera
15 projectionType: CameraLens.PerspectiveProjection
16 fieldOfView: 45
17 aspectRatio: 16/9
18 nearPlane : 0.1
19 farPlane : 1000.0
20 position: Qt.vector3d( 0.0, 0.0, 50.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 {
26 camera: camera
27 linearSpeed: 0.1 + camera.position.z
28 }
29
30 components: [
31 RenderSettings {
32 activeFrameGraph : ForwardRenderer {
33 camera: camera
34 clearColor: "black"
35 }
36 },
37 InputSettings {
38 }
39 ]
40
41
42 property bool odd: false
43 QQ2.Timer {
44 running: true
45 interval: 1000
46 onTriggered: {
47 odd = !odd
48 }
49 repeat: true
50 }
51
52 NodeInstantiator {
53 model: odd ? 5 : 1
54 delegate: Entity {
55 components: [
56 Transform {
57 id: rot
58 translation: Qt.vector3d(-5, -20 + model.index * 5, 0)
59 }
60 ]
61
62 Text2DEntity {
63 id: text
64 font.pointSize: 1
65 text: "Text"
66 width: 20
67 height: 10
68 }
69 }
70 }
71 }