Skip to content

Commit 97bcbda

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 ae77fb9 commit 97bcbda

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
@@ -70,6 +70,12 @@ FloatingPane {
7070
checked: Viewer3DSettings.displayOrigin
7171
onClicked: Viewer3DSettings.displayOrigin = !Viewer3DSettings.displayOrigin
7272
}
73+
MaterialToolButton {
74+
text: MaterialIcons.light_mode
75+
ToolTip.text: "Display Light Controller"
76+
checked: Viewer3DSettings.displayLightController
77+
onClicked: Viewer3DSettings.displayLightController = !Viewer3DSettings.displayLightController
78+
}
7379
}
7480
MaterialLabel {
7581
text: MaterialIcons.grain

meshroom/ui/qml/Viewer3D/Viewer3D.qml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,6 @@ FocusScope {
107107
upVector: defaultCamUpVector
108108
viewCenter: defaultCamViewCenter
109109
aspectRatio: width/height
110-
111-
// Scene light, attached to the camera
112-
Entity {
113-
components: [
114-
PointLight {
115-
color: "white"
116-
}
117-
]
118-
}
119110
}
120111

121112
ViewpointCamera {
@@ -125,6 +116,15 @@ FocusScope {
125116
camera.aspectRatio: width/height
126117
}
127118

119+
Entity {
120+
components: [
121+
DirectionalLight{
122+
color: "white"
123+
worldDirection: Transformations3DHelper.getRotatedCameraViewVector(cameraSelector.camera.viewVector, cameraSelector.camera.upVector, directionalLightPane.lightPitchValue, directionalLightPane.lightYawValue).normalized()
124+
}
125+
]
126+
}
127+
128128
TrackballGizmo {
129129
beamRadius: 4.0/root.height
130130
alpha: cameraController.moving ? 1.0 : 0.7
@@ -318,6 +318,17 @@ FocusScope {
318318
}
319319
}
320320

321+
// Directional light controller
322+
DirectionalLightPane {
323+
id: directionalLightPane
324+
anchors {
325+
bottom: parent.bottom
326+
right: parent.right
327+
margins: 2
328+
}
329+
visible: Viewer3DSettings.displayLightController
330+
}
331+
321332
// Menu
322333
Menu {
323334
id: contextMenu

meshroom/ui/qml/Viewer3D/Viewer3DSettings.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Item {
5151
property bool displayGrid: true
5252
property bool displayGizmo: true
5353
property bool displayOrigin: false
54+
property bool displayLightController: false
5455
// Camera
5556
property bool syncViewpointCamera: false
5657
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)