mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[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.
This commit is contained in:
parent
9df260ac6c
commit
bfda6f66ac
4 changed files with 27 additions and 18 deletions
|
@ -70,6 +70,12 @@ FloatingPane {
|
||||||
checked: Viewer3DSettings.displayOrigin
|
checked: Viewer3DSettings.displayOrigin
|
||||||
onClicked: Viewer3DSettings.displayOrigin = !Viewer3DSettings.displayOrigin
|
onClicked: Viewer3DSettings.displayOrigin = !Viewer3DSettings.displayOrigin
|
||||||
}
|
}
|
||||||
|
MaterialToolButton {
|
||||||
|
text: MaterialIcons.light_mode
|
||||||
|
ToolTip.text: "Display Light Controller"
|
||||||
|
checked: Viewer3DSettings.displayLightController
|
||||||
|
onClicked: Viewer3DSettings.displayLightController = !Viewer3DSettings.displayLightController
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MaterialLabel {
|
MaterialLabel {
|
||||||
text: MaterialIcons.grain
|
text: MaterialIcons.grain
|
||||||
|
|
|
@ -107,15 +107,6 @@ FocusScope {
|
||||||
upVector: defaultCamUpVector
|
upVector: defaultCamUpVector
|
||||||
viewCenter: defaultCamViewCenter
|
viewCenter: defaultCamViewCenter
|
||||||
aspectRatio: width/height
|
aspectRatio: width/height
|
||||||
|
|
||||||
// Scene light, attached to the camera
|
|
||||||
Entity {
|
|
||||||
components: [
|
|
||||||
PointLight {
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewpointCamera {
|
ViewpointCamera {
|
||||||
|
@ -125,6 +116,15 @@ FocusScope {
|
||||||
camera.aspectRatio: width/height
|
camera.aspectRatio: width/height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entity {
|
||||||
|
components: [
|
||||||
|
DirectionalLight{
|
||||||
|
color: "white"
|
||||||
|
worldDirection: Transformations3DHelper.getRotatedCameraViewVector(cameraSelector.camera.viewVector, cameraSelector.camera.upVector, directionalLightPane.lightPitchValue, directionalLightPane.lightYawValue).normalized()
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
TrackballGizmo {
|
TrackballGizmo {
|
||||||
beamRadius: 4.0/root.height
|
beamRadius: 4.0/root.height
|
||||||
alpha: cameraController.moving ? 1.0 : 0.7
|
alpha: cameraController.moving ? 1.0 : 0.7
|
||||||
|
@ -318,6 +318,17 @@ FocusScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Directional light controller
|
||||||
|
DirectionalLightPane {
|
||||||
|
id: directionalLightPane
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
right: parent.right
|
||||||
|
margins: 2
|
||||||
|
}
|
||||||
|
visible: Viewer3DSettings.displayLightController
|
||||||
|
}
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
Menu {
|
Menu {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
|
|
|
@ -51,6 +51,7 @@ Item {
|
||||||
property bool displayGrid: true
|
property bool displayGrid: true
|
||||||
property bool displayGizmo: true
|
property bool displayGizmo: true
|
||||||
property bool displayOrigin: false
|
property bool displayOrigin: false
|
||||||
|
property bool displayLightController: false
|
||||||
// Camera
|
// Camera
|
||||||
property bool syncViewpointCamera: false
|
property bool syncViewpointCamera: false
|
||||||
property bool syncWithPickedViewId: false // Sync active camera with picked view ID from sequence player if the setting is enabled
|
property bool syncWithPickedViewId: false // Sync active camera with picked view ID from sequence player if the setting is enabled
|
||||||
|
|
|
@ -16,15 +16,6 @@ Entity {
|
||||||
nearPlane : 0.1
|
nearPlane : 0.1
|
||||||
farPlane : 10000.0
|
farPlane : 10000.0
|
||||||
viewCenter: Qt.vector3d(0.0, 0.0, -1.0)
|
viewCenter: Qt.vector3d(0.0, 0.0, -1.0)
|
||||||
|
|
||||||
// Scene light, attached to the camera
|
|
||||||
Entity {
|
|
||||||
components: [
|
|
||||||
PointLight {
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
components: [
|
components: [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue