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 real _pan: 0.001
5 property real _tilt: 0.001
6 property real _zoom: 1500
7 property alias cameraOne: cameraPerspectiveOne
8 property alias cameraOneRotation: cameraPerspectiveOne.eulerRotation
9 property alias cameraTwoPosition: cameraPerspectiveTwo.position
10 property real lightsBrightness: 0.3
11 property real viewDistance: 50000
12
13 function resetCamera() {
14 camNode.position = Qt.vector3d(0, 0, 0);
15 camNode.eulerRotation = Qt.vector3d(90, 0, 0);
16
17 cameraPerspectiveTwo.position = Qt.vector3d(_zoom * Math.sin(_tilt) * Math.cos(_pan), _zoom * Math.cos(_tilt), _zoom * Math.sin(_tilt) * Math.sin(_pan));
18 cameraPerspectiveTwo.eulerRotation = Qt.vector3d(0, 0, 0);
19
20 cameraPerspectiveOne.position = Qt.vector3d(0, 0, 0);
21 cameraPerspectiveOne.eulerRotation = Qt.vector3d(-90, 0, 0);
22 }
23
24 DirectionalLight {
25 brightness: lightsBrightness
26 eulerRotation.x: 180
27 }
28
29 DirectionalLight {
30 brightness: 0.6
31 castsShadow: true
32 csmBlendRatio: 0.1
33 csmNumSplits: 3
34 eulerRotation.x: 0
35 lockShadowmapTexels: true
36 pcfFactor: 2.0
37 shadowBias: 5
38 shadowFactor: 50
39 shadowMapFar: viewDistance
40 shadowMapQuality: Light.ShadowMapQualityHigh
41 softShadowQuality: Light.PCF16
42 }
43
44 DirectionalLight {
45 brightness: lightsBrightness
46 eulerRotation.x: 90
47 }
48
49 DirectionalLight {
50 brightness: lightsBrightness
51 eulerRotation.x: 270
52 }
53
54 DirectionalLight {
55 brightness: lightsBrightness
56 eulerRotation.y: 90
57 }
58
59 DirectionalLight {
60 brightness: lightsBrightness
61 eulerRotation.y: -90
62 }
63
64 Node {
65 id: camNode
66
67 eulerRotation {
68 x: 90
69 }
70
71 Node {
72 id: cameraPerspectiveTwo
73
74 position {
75 x: _zoom * Math.sin(_tilt) * Math.cos(_pan)
76 y: _zoom * Math.cos(_tilt)
77 z: _zoom * Math.sin(_tilt) * Math.sin(_pan)
78 }
79
80 PerspectiveCamera {
81 id: cameraPerspectiveOne
82
83 clipFar: viewDistance
84 clipNear: 25
85 frustumCullingEnabled: true
86
87 eulerRotation {
88 x: -90
89 }
90 }
91 }
92 }
93}