mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-29 22:47:17 +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 source: modelLoader.source
|
||||||
property alias abcSource: modelLoader.abcSource
|
property alias abcSource: modelLoader.abcSource
|
||||||
|
property alias depthMapSource: modelLoader.depthMapSource
|
||||||
|
|
||||||
readonly property alias loading: modelLoader.loading
|
readonly property alias loading: modelLoader.loading
|
||||||
|
|
||||||
// Alembic optional support => won't be available if AlembicEntity plugin is not available
|
// Alembic optional support => won't be available if AlembicEntity plugin is not available
|
||||||
readonly property Component abcLoaderComp: Qt.createComponent("AlembicLoader.qml")
|
readonly property Component abcLoaderComp: Qt.createComponent("AlembicLoader.qml")
|
||||||
readonly property bool supportAlembic: abcLoaderComp.status == Component.Ready
|
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
|
// functions
|
||||||
function resetCameraCenter() {
|
function resetCameraCenter() {
|
||||||
|
@ -233,6 +236,7 @@ FocusScope {
|
||||||
id: modelLoader
|
id: modelLoader
|
||||||
property string source
|
property string source
|
||||||
property string abcSource
|
property string abcSource
|
||||||
|
property string depthMapSource
|
||||||
property bool meshHasTexture: false
|
property bool meshHasTexture: false
|
||||||
// SceneLoader status is not reliable when loading a 3D file
|
// SceneLoader status is not reliable when loading a 3D file
|
||||||
property bool loading: false
|
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 }
|
Locator3D { enabled: locatorCheckBox.checked }
|
||||||
}
|
}
|
||||||
Grid3D { enabled: gridCheckBox.checked }
|
Grid3D { enabled: gridCheckBox.checked }
|
||||||
|
@ -363,6 +393,16 @@ FocusScope {
|
||||||
ToolTip.visible: hovered
|
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 {
|
Row {
|
||||||
CheckBox { id: showMeshCheckBox; text: "Mesh"; checked: true; opacity: root.source ? 1.0 : 0.6 }
|
CheckBox { id: showMeshCheckBox; text: "Mesh"; checked: true; opacity: root.source ? 1.0 : 0.6 }
|
||||||
ToolButton {
|
ToolButton {
|
||||||
|
|
|
@ -36,6 +36,11 @@ Item {
|
||||||
viewer3D.clearAbc()
|
viewer3D.clearAbc()
|
||||||
viewer3D.abcSource = filepath
|
viewer3D.abcSource = filepath
|
||||||
}
|
}
|
||||||
|
if(Filepath.extension(filepath) === ".exr")
|
||||||
|
{
|
||||||
|
// viewer3D.clearDepthMap()
|
||||||
|
viewer3D.depthMapSource = filepath
|
||||||
|
}
|
||||||
else
|
else
|
||||||
viewer3D.source = filepath
|
viewer3D.source = filepath
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue