Skip to content

Commit 49819dc

Browse files
gregoire-dlcbentejac
authored andcommitted
[ui] Viewer3D: Use directional light & add light controller
Use a single light entity instead of one per camera. Use directional light instead of point light. Add camera relative directional light controller.
1 parent 9b1b277 commit 49819dc

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

meshroom/ui/qml/Viewer3D/Inspector3D.qml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ FloatingPane {
6969
checked: Viewer3DSettings.displayOrigin
7070
onClicked: Viewer3DSettings.displayOrigin = !Viewer3DSettings.displayOrigin
7171
}
72+
MaterialToolButton {
73+
text: MaterialIcons.light_mode
74+
ToolTip.text: "Display Light Controller"
75+
checked: Viewer3DSettings.displayLightController
76+
onClicked: Viewer3DSettings.displayLightController = !Viewer3DSettings.displayLightController
77+
}
7278
}
7379
MaterialLabel {
7480
text: MaterialIcons.grain

meshroom/ui/qml/Viewer3D/Viewer3D.qml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,6 @@ FocusScope {
109109
upVector: defaultCamUpVector
110110
viewCenter: defaultCamViewCenter
111111
aspectRatio: width/height
112-
113-
// Scene light, attached to the camera
114-
Entity {
115-
components: [
116-
PointLight {
117-
color: "white"
118-
}
119-
]
120-
}
121112
}
122113

123114
ViewpointCamera {
@@ -127,6 +118,15 @@ FocusScope {
127118
camera.aspectRatio: width/height
128119
}
129120

121+
Entity {
122+
components: [
123+
DirectionalLight{
124+
color: "white"
125+
worldDirection: Transformations3DHelper.getRotatedCameraViewVector(cameraSelector.camera.viewVector, cameraSelector.camera.upVector, directionalLightPane.lightPitchValue, directionalLightPane.lightYawValue).normalized()
126+
}
127+
]
128+
}
129+
130130
TrackballGizmo {
131131
beamRadius: 4.0/root.height
132132
alpha: cameraController.moving ? 1.0 : 0.7
@@ -330,6 +330,17 @@ FocusScope {
330330
}
331331
}
332332

333+
// Directional light controller
334+
DirectionalLightPane {
335+
id: directionalLightPane
336+
anchors {
337+
bottom: parent.bottom
338+
right: parent.right
339+
margins: 2
340+
}
341+
visible: Viewer3DSettings.displayLightController
342+
}
343+
333344
// Menu
334345
Menu {
335346
id: contextMenu

meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Item {
4949
property bool displayGrid: true
5050
property bool displayGizmo: true
5151
property bool displayOrigin: false
52+
property bool displayLightController: false
5253
// Camera
5354
property bool syncViewpointCamera: false
5455
property bool syncWithPickedViewId: false // Sync active camera with picked view ID from sequence player if the setting is enabled

meshroom/ui/qml/Viewer3D/ViewpointCamera.qml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ Entity {
1616
nearPlane : 0.1
1717
farPlane : 10000.0
1818
viewCenter: Qt.vector3d(0.0, 0.0, -1.0)
19-
20-
// Scene light, attached to the camera
21-
Entity {
22-
components: [
23-
PointLight {
24-
color: "white"
25-
}
26-
]
27-
}
2819
}
2920

3021
components: [

0 commit comments

Comments
 (0)