Debian Codegraph @

tests/manual/transparency-qml-scene3d/Scene.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.2 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 frustumCulling: false
33 }
34 },
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 SkyboxEntity {
55 baseName: "qrc:/assets/cubemaps/miramar/miramar"
56 extension: ".webp"
57 }
58
59 TorusMesh {
60 id: torusMesh
61 radius: 5
62 minorRadius: 1
63 rings: 100
64 slices: 20
65 }
66
67 SphereMesh {
68 id: sphereMesh
69 radius: 3
70 }
71
72 Transform {
73 id: sphereTransform
74 translation: Qt.vector3d(10, 0, 0)
75 }
76
77 Transform {
78 id: cylinderTransform
79 translation: Qt.vector3d(-10, 0, 0)
80 }
81
82 Entity {
83 id: torusEntity
84 components: [ torusMesh, phongMaterial ]
85 }
86
87 Entity {
88 id: sphereEntity
89 components: [ sphereMesh, alphaMaterial, sphereTransform ]
90 }
91
92 Entity {
93 id: cylinderEntity
94 components: [ sphereMesh, alphaMaterial, cylinderTransform ]
95 }
96
97 PhongAlphaMaterial {
98 id: alphaMaterial
99 shininess: 75.0
100 ambient: "black"
101 diffuse: "blue"
102 specular: "white"
103 alpha: 0.1
104 sourceAlphaArg: BlendEquationArguments.Zero
105 destinationAlphaArg: BlendEquationArguments.One
106
107 QQ2.NumberAnimation {
108 duration: 2000
109 loops: QQ2.Animation.Infinite
110 target: alphaMaterial
111 property: "alpha"
112 from: 0.0
113 to: 1.0
114 running: true
115 }
116 }
117
118 PhongMaterial {
119 id: phongMaterial
120 }
121 }