Debian Codegraph @

tests/manual/shadow-map-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 QtQuick 2.1 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 Camera {
14 id: camera
15 projectionType: CameraLens.PerspectiveProjection
16 fieldOfView: 45
17 aspectRatio: _window.width / _window.height
18 nearPlane: 0.1
19 farPlane: 1000.0
20 position: Qt.vector3d(0.0, 10.0, 20.0)
21 viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
22 upVector: Qt.vector3d(0.0, 1.0, 0.0)
23 }
24
25 FirstPersonCameraController { camera: camera }
26
27 ShadowMapLight {
28 id: light
29 }
30
31 components: [
32 ShadowMapFrameGraph {
33 id: framegraph
34 viewCamera: camera
35 lightCamera: light.lightCamera
36 },
37 // Event Source will be set by the Qt3DQuickWindow
38 InputSettings { }
39 ]
40
41
42 AdsEffect {
43 id: shadowMapEffect
44
45 shadowTexture: framegraph.shadowTexture
46 light: light
47 }
48
49
50 // Trefoil knot entity
51 Trefoil {
52 material: AdsMaterial {
53 effect: shadowMapEffect
54 specularColor: Qt.rgba(0.5, 0.5, 0.5, 1.0)
55 }
56 }
57
58 // Toyplane entity
59 Toyplane {
60 material: AdsMaterial {
61 effect: shadowMapEffect
62 diffuseColor: Qt.rgba(0.9, 0.5, 0.3, 1.0)
63 shininess: 75
64 }
65 }
66
67 // Plane entity
68 GroundPlane {
69 material: AdsMaterial {
70 effect: shadowMapEffect
71 diffuseColor: Qt.rgba(0.2, 0.5, 0.3, 1.0)
72 specularColor: Qt.rgba(0, 0, 0, 1.0)
73 }
74 }
75 }