Debian Codegraph @

tests/manual/transparency-qml/main.qml

raw
1 // Copyright (C) 2015 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.4 as QQ2
9
10 Entity {
11 id: sceneRoot
12
13 Camera {
14 id: camera
15 projectionType: CameraLens.PerspectiveProjection
16 fieldOfView: 45
17 aspectRatio: 800/600
18 nearPlane : 0.1
19 farPlane : 1000.0
20 position: Qt.vector3d( 0.0, 0.0, 40.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 { camera: camera }
26
27 components: [
28 RenderSettings {
29 activeFrameGraph: ForwardRenderer{
30 camera: camera
31 clearColor: Qt.rgba(0.0, 0.5, 1, 1)
32 }
33 },
34 // Event Source will be set by the Qt3DQuickWindow
35 InputSettings { }
36 ]
37
38 Entity {
39 id: lightEntity
40 property Transform transform: Transform {
41 translation: Qt.vector3d(1.0, 1.0, 0.0)
42 }
43
44 property PointLight light: PointLight {
45 id: light
46 color: "white"
47 constantAttenuation: 1.0
48 linearAttenuation: 0.0
49 quadraticAttenuation: 0.0
50 }
51 components: [transform, light]
52 }
53
54 TorusMesh {
55 id: torusMesh
56 radius: 5
57 minorRadius: 1
58 rings: 100
59 slices: 20
60 }
61
62 SphereMesh {
63 id: sphereMesh
64 radius: 3
65 }
66
67 Transform {
68 id: sphereTransform
69 translation: Qt.vector3d(10, 0, 0)
70 }
71
72 Transform {
73 id: cylinderTransform
74 translation: Qt.vector3d(-10, 0, 0)
75 }
76
77 Entity {
78 id: torusEntity
79 components: [ torusMesh, phongMaterial ]
80 }
81
82 Entity {
83 id: sphereEntity
84 components: [ sphereMesh, alphaMaterial, sphereTransform ]
85 }
86
87 Entity {
88 id: cylinderEntity
89 components: [ sphereMesh, alphaMaterial, cylinderTransform ]
90 }
91
92 PhongAlphaMaterial {
93 id: alphaMaterial
94 shininess: 75.0
95 ambient: "black"
96 diffuse: "blue"
97 specular: "white"
98
99 QQ2.NumberAnimation {
100 duration: 2000
101 loops: QQ2.Animation.Infinite
102 target: alphaMaterial
103 property: "alpha"
104 from: 0.0
105 to: 1.0
106 running: true
107 }
108 }
109
110 PhongMaterial {
111 id: phongMaterial
112 }
113 }