QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
CameraLightModel.qml
Go to the documentation of this file.
1import QtQuick3D
2
3Node {
4 property alias cameraOne: cameraPerspectiveOne
5 property alias orbitCenter: orbitCenterNode.position
6 property real cameraHeading: 0
7 property real cameraTilt: 0
8 property real cameraZoom: 1500
9 property real lightsBrightness: 0.5
10 property real viewDistance: 50000
11
12 // Two directional lights maximum: mobile GPUs with small uniform buffers
13 // make Qt Quick 3D reduce the directional light limit to 2 and silently
14 // drop the rest ("Too many directional lights in scene, maximum is 2").
15
16 // Shadow-casting key light, shining straight down (scene is z-up)
17 DirectionalLight {
18 brightness: 0.6
19 castsShadow: true
20 csmBlendRatio: 0.1
21 csmNumSplits: 3
22 eulerRotation.x: 0
23 lockShadowmapTexels: true
24 pcfFactor: 2.0
25 shadowBias: 5
26 shadowFactor: 50
27 shadowMapFar: viewDistance
28 shadowMapQuality: Light.ShadowMapQualityHigh
29 softShadowQuality: Light.PCF16
30 }
31
32 // Slanted up/side fill so vertical faces and undersides aren't black
33 DirectionalLight {
34 brightness: lightsBrightness
35 eulerRotation.x: 225
36 eulerRotation.y: 45
37 }
38
39 // Orbit camera rig: heading rotates around the scene up axis (z),
40 // tilt rotates around the local x axis, camera sits cameraZoom away
41 // looking back at the orbit center.
42 Node {
43 id: orbitCenterNode
44
45 eulerRotation.z: cameraHeading
46
47 Node {
48 id: camNode
49
50 eulerRotation.x: 90 + cameraTilt
51
52 Node {
53 id: cameraPerspectiveTwo
54
55 position.y: cameraZoom
56
57 PerspectiveCamera {
58 id: cameraPerspectiveOne
59
60 clipFar: viewDistance
61 clipNear: 25
62 frustumCullingEnabled: true
63
64 eulerRotation {
65 x: -90
66 }
67 }
68 }
69 }
70 }
71}