mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-29 02:08:08 +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],
|
||||
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(
|
||||
name='saveRawDensePointCloud',
|
||||
label='Save Raw Dense Point Cloud',
|
||||
|
@ -230,17 +237,17 @@ class Meshing(desc.CommandLineNode):
|
|||
|
||||
outputs = [
|
||||
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",
|
||||
label="Output Mesh",
|
||||
description="Output mesh (OBJ file format).",
|
||||
value="{cache}/{nodeType}/{uid0}/mesh.obj",
|
||||
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"])
|
||||
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):
|
||||
"""
|
||||
|
|
|
@ -62,7 +62,11 @@ Entity {
|
|||
},
|
||||
State {
|
||||
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
|
||||
}
|
||||
|
||||
PerVertexColorMaterial {
|
||||
id: colored
|
||||
objectName: "VertexColorMaterial"
|
||||
}
|
||||
|
||||
DiffuseSpecularMaterial {
|
||||
id: textured
|
||||
objectName: "TexturedMaterial"
|
||||
|
|
Loading…
Add table
Reference in a new issue