Debian Codegraph @

tests/manual/deferred-renderer-qml/ScreenQuadEntity.qml

raw
1 // Copyright (C) 2016 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.Extras 2.0
7
8 Entity {
9 id: root
10
11 readonly property Layer layer: screenQuadLayer
12 property PointLight baseLight
13 property vector3d light1Pos
14 property vector3d light2Pos
15 property vector3d light3Pos
16 property vector3d light4Pos
17
18 Entity {
19 components: [
20 baseLight,
21 layer
22 ]
23 }
24
25 Entity {
26 readonly property Transform transform1 : Transform { translation: root.light1Pos }
27 readonly property PointLight light1 : PointLight {
28 color : "dodgerblue"
29 intensity : 0.9
30 }
31 components: [
32 transform1,
33 light1,
34 layer
35 ]
36 }
37
38 Entity {
39 readonly property Transform transform2 : Transform { translation: root.light2Pos }
40 readonly property PointLight light2 : PointLight {
41 color : "green"
42 intensity : 0.5
43 }
44 components: [
45 transform2,
46 light2,
47 layer
48 ]
49 }
50
51 Entity {
52 readonly property Transform transform3 : Transform { translation: root.light3Pos }
53 readonly property PointLight light3 : PointLight {
54 color : "white"
55 intensity : 2.0
56 }
57 components: [
58 transform3,
59 light3,
60 layer
61 ]
62 }
63
64 Entity {
65 readonly property Transform transform4 : Transform { translation: root.light4Pos }
66 readonly property PointLight light4 : PointLight {
67 color : "white"
68 intensity : 0.5
69 }
70 components: [
71 transform4,
72 light4,
73 layer
74 ]
75 }
76
77 // We need to have the actual screen quad entity separate from the lights.
78 // If the lights were sub-entities of this screen quad entity, they would
79 // be affected by the rotation matrix, and their world positions would thus
80 // be changed.
81 Entity {
82 components : [
83 Layer { id: screenQuadLayer },
84
85 PlaneMesh {
86 width: 2.0
87 height: 2.0
88 meshResolution: Qt.size(2, 2)
89 },
90
91 Transform { // We rotate the plane so that it faces us
92 rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
93 },
94
95 Material {
96 effect : FinalEffect {}
97 }
98 ]
99 }
100 }