parq_blockmodel.mesh.glb.write_glb#
- parq_blockmodel.mesh.glb.write_glb(mesh, output_path, texture_attribute=None, colormap='viridis', include_metadata=True)[source]#
Write a TriangleMesh to GLB (glTF 2.0 binary) format.
This generates a single-file GLB suitable for viewing in standard 3D viewers (Babylon.js, Three.js, etc.). Optionally applies vertex colors based on a scalar attribute.
- Parameters:
mesh (TriangleMesh) – The mesh to write.
output_path (str or Path) – Path to the output .glb file.
texture_attribute (str, optional) – If provided, vertex attribute to use for coloring (e.g., “grade”). Colors are mapped via the specified colormap.
colormap (str, default "viridis") – Matplotlib colormap name for texture_attribute mapping. Only used if texture_attribute is specified.
include_metadata (bool, default True) – If True, embed mesh metadata in glTF extras.
- Raises:
ValueError – If the mesh is invalid or attribute is not found.
- Return type:
None