split_mesh_by_indexed_colour

Function split_mesh_by_indexed_colour 

Source
pub fn split_mesh_by_indexed_colour(
    mesh: &Mesh,
    map: &FullIndexedColourMap,
) -> Option<Vec<(Rgba, Mesh)>>
Expand description

Split a flat-shaded mesh into one sub-mesh per palette group.

Returns None (caller keeps the single dominant-coloured mesh) unless the mesh triangle count matches map.triangle_palette exactly — a mismatch means CSG/void cutting changed the topology, so the per-triangle mapping no longer applies. Triangle i of the mesh corresponds to CoordIndex[i] because the triangulated-face-set processor preserves triangle order.