mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-31 18:06:31 +02:00
Merge pull request #550 from alicevision/dev/coloredMeshViewer
Viewer3D: add support for vertex-colored meshes
This commit is contained in:
commit
d5dc83f14e
3 changed files with 31 additions and 8 deletions
|
@ -209,6 +209,13 @@ class Meshing(desc.CommandLineNode):
|
||||||
uid=[0],
|
uid=[0],
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
|
desc.BoolParam(
|
||||||
|
name='colorizeOutput',
|
||||||
|
label='Colorize Output',
|
||||||
|
description='Whether to colorize output dense point cloud and mesh.',
|
||||||
|
value=False,
|
||||||
|
uid=[0],
|
||||||
|
),
|
||||||
desc.BoolParam(
|
desc.BoolParam(
|
||||||
name='saveRawDensePointCloud',
|
name='saveRawDensePointCloud',
|
||||||
label='Save Raw Dense Point Cloud',
|
label='Save Raw Dense Point Cloud',
|
||||||
|
@ -230,17 +237,17 @@ class Meshing(desc.CommandLineNode):
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
desc.File(
|
desc.File(
|
||||||
name="output",
|
|
||||||
label="Output Dense Point Cloud",
|
|
||||||
description="Output dense point cloud with visibilities (SfMData file format).",
|
|
||||||
value="{cache}/{nodeType}/{uid0}/densePointCloud.abc",
|
|
||||||
uid=[],
|
|
||||||
),
|
|
||||||
desc.File(
|
|
||||||
name="outputMesh",
|
name="outputMesh",
|
||||||
label="Output Mesh",
|
label="Output Mesh",
|
||||||
description="Output mesh (OBJ file format).",
|
description="Output mesh (OBJ file format).",
|
||||||
value="{cache}/{nodeType}/{uid0}/mesh.obj",
|
value="{cache}/{nodeType}/{uid0}/mesh.obj",
|
||||||
uid=[],
|
uid=[],
|
||||||
),
|
),
|
||||||
|
desc.File(
|
||||||
|
name="output",
|
||||||
|
label="Output Dense Point Cloud",
|
||||||
|
description="Output dense point cloud with visibilities (SfMData file format).",
|
||||||
|
value="{cache}/{nodeType}/{uid0}/densePointCloud.abc",
|
||||||
|
uid=[],
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,6 +45,13 @@ class Scene3DHelper(QObject):
|
||||||
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexPosition"])
|
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexPosition"])
|
||||||
return count / 3
|
return count / 3
|
||||||
|
|
||||||
|
@Slot(Qt3DCore.QEntity, result=int)
|
||||||
|
def vertexColorCount(self, entity):
|
||||||
|
count = 0
|
||||||
|
for geo in entity.findChildren(Qt3DRender.QGeometry):
|
||||||
|
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexColor"])
|
||||||
|
return count
|
||||||
|
|
||||||
|
|
||||||
class TrackballController(QObject):
|
class TrackballController(QObject):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -62,7 +62,11 @@ Entity {
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "Textured"
|
name: "Textured"
|
||||||
PropertyChanges { target: m; material: diffuseMap ? textured : solid }
|
PropertyChanges {
|
||||||
|
target: m;
|
||||||
|
// "textured" material resolution order: diffuse map > vertex color data > no color info
|
||||||
|
material: diffuseMap ? textured : (Scene3DHelper.vertexColorCount(root.parent) ? colored : solid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -80,6 +84,11 @@ Entity {
|
||||||
diffuse: root.diffuseColor
|
diffuse: root.diffuseColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PerVertexColorMaterial {
|
||||||
|
id: colored
|
||||||
|
objectName: "VertexColorMaterial"
|
||||||
|
}
|
||||||
|
|
||||||
DiffuseSpecularMaterial {
|
DiffuseSpecularMaterial {
|
||||||
id: textured
|
id: textured
|
||||||
objectName: "TexturedMaterial"
|
objectName: "TexturedMaterial"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue