mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-25 20:47:39 +02:00
Add 3D depth map viewer
This commit is contained in:
parent
ad98d70bfe
commit
2dceec447d
3 changed files with 54 additions and 0 deletions
9
meshroom/ui/qml/Viewer/DepthMapLoader.qml
Normal file
9
meshroom/ui/qml/Viewer/DepthMapLoader.qml
Normal file
|
@ -0,0 +1,9 @@
|
|||
import DepthMapEntity 1.0
|
||||
|
||||
/**
|
||||
* Support for Depth Map files (EXR) in Qt3d.
|
||||
* Create this component dynamically to test for DepthMapEntity plugin availability.
|
||||
*/
|
||||
DepthMapEntity {
|
||||
id: root
|
||||
}
|
|
@ -12,12 +12,15 @@ FocusScope {
|
|||
|
||||
property alias source: modelLoader.source
|
||||
property alias abcSource: modelLoader.abcSource
|
||||
property alias depthMapSource: modelLoader.depthMapSource
|
||||
|
||||
readonly property alias loading: modelLoader.loading
|
||||
|
||||
// Alembic optional support => won't be available if AlembicEntity plugin is not available
|
||||
readonly property Component abcLoaderComp: Qt.createComponent("AlembicLoader.qml")
|
||||
readonly property bool supportAlembic: abcLoaderComp.status == Component.Ready
|
||||
readonly property Component depthMapLoaderComp: Qt.createComponent("DepthMapLoader.qml")
|
||||
readonly property bool supportDepthMap: depthMapLoaderComp.status == Component.Ready
|
||||
|
||||
// functions
|
||||
function resetCameraCenter() {
|
||||
|
@ -233,6 +236,7 @@ FocusScope {
|
|||
id: modelLoader
|
||||
property string source
|
||||
property string abcSource
|
||||
property string depthMapSource
|
||||
property bool meshHasTexture: false
|
||||
// SceneLoader status is not reliable when loading a 3D file
|
||||
property bool loading: false
|
||||
|
@ -313,6 +317,32 @@ FocusScope {
|
|||
}
|
||||
}
|
||||
|
||||
Entity {
|
||||
id: depthMapLoaderEntity
|
||||
// Instantiate the DepthMapEntity dynamically
|
||||
// to avoid import errors if the plugin is not available
|
||||
property Entity depthMapLoader: undefined
|
||||
enabled: showDepthMapCheckBox.checked
|
||||
|
||||
Component.onCompleted: {
|
||||
if(!root.supportDepthMap) // DepthMap plugin not available
|
||||
return
|
||||
|
||||
// destroy previously created entity
|
||||
if(depthMapLoader != undefined)
|
||||
depthMapLoader.destroy()
|
||||
|
||||
depthMapLoader = depthMapLoaderComp.createObject(depthMapLoaderEntity, {
|
||||
'source': Qt.binding(function() { return modelLoader.depthMapSource } )
|
||||
});
|
||||
// 'sourceChanged' signal is emitted once the depthMap file is loaded
|
||||
// set the 'loading' property to false when it's emitted
|
||||
// TODO: DepthMapEntity should expose a status
|
||||
depthMapLoader.onSourceChanged.connect(function(){ modelLoader.loading = false })
|
||||
modelLoader.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
Locator3D { enabled: locatorCheckBox.checked }
|
||||
}
|
||||
Grid3D { enabled: gridCheckBox.checked }
|
||||
|
@ -363,6 +393,16 @@ FocusScope {
|
|||
ToolTip.visible: hovered
|
||||
}
|
||||
}
|
||||
Row {
|
||||
visible: root.depthMapSource != ''
|
||||
CheckBox { id: showDepthMapCheckBox; text: "DepthMap"; checked: true; }
|
||||
ToolButton {
|
||||
text: MaterialIcons.clear; font.family: MaterialIcons.fontFamily;
|
||||
onClicked: root.depthMapSource = ''
|
||||
ToolTip.text: "Unload"
|
||||
ToolTip.visible: hovered
|
||||
}
|
||||
}
|
||||
Row {
|
||||
CheckBox { id: showMeshCheckBox; text: "Mesh"; checked: true; opacity: root.source ? 1.0 : 0.6 }
|
||||
ToolButton {
|
||||
|
|
|
@ -36,6 +36,11 @@ Item {
|
|||
viewer3D.clearAbc()
|
||||
viewer3D.abcSource = filepath
|
||||
}
|
||||
if(Filepath.extension(filepath) === ".exr")
|
||||
{
|
||||
// viewer3D.clearDepthMap()
|
||||
viewer3D.depthMapSource = filepath
|
||||
}
|
||||
else
|
||||
viewer3D.source = filepath
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue