Debian Codegraph @

tests/manual/compressed_textures/main.qml

raw
1 // Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.12 as QQ2
5 import QtQuick.Scene3D 2.12
6 import QtQuick.Controls 2.12
7 import Qt3D.Core 2.12
8 import Qt3D.Render 2.12
9 import Qt3D.Input 2.12
10 import Qt3D.Extras 2.12
11
12 QQ2.Item {
13 id: root
14 width: 1280
15 height: 720
16
17 readonly property string textureSource: "file://" + _pathPrefix + "/" + textureSelector.textAt(textureSelector.currentIndex)
18
19 Scene3D {
20 anchors.fill: parent
21 focus: true
22 aspects: ["input", "logic"]
23
24 Entity {
25 id: sceneRoot
26
27 Camera {
28 id: camera
29 projectionType: CameraLens.PerspectiveProjection
30 fieldOfView: 45
31 aspectRatio: 16/9
32 nearPlane : 0.1
33 farPlane : 1000.0
34 position: Qt.vector3d(0.0, 0.0, -2.0)
35 upVector: Qt.vector3d(0.0, 1.0, 0.0)
36 viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
37 }
38
39 OrbitCameraController {
40 camera: camera
41 }
42
43 components: [
44 RenderSettings {
45 activeFrameGraph: ForwardRenderer {
46 clearColor: Qt.rgba(0, 0.5, 1, 1)
47 camera: camera
48 }
49 },
50 // Event Source will be set by the Qt3DQuickWindow
51 InputSettings { }
52 ]
53
54 Entity {
55 readonly property GeometryRenderer mesh: CuboidMesh { }
56 readonly property DiffuseMapMaterial material: DiffuseMapMaterial {
57 diffuse: TextureLoader {
58 source: textureSource
59 }
60 }
61 components: [ mesh, material ]
62 }
63 }
64 }
65
66 ComboBox {
67 id: textureSelector
68 model: _texturesList
69 width: 200
70 }
71 }