This commit is contained in:
Quaternions 2024-02-05 20:28:09 -08:00
parent 6f0c579601
commit 75a1829f53

View File

@ -73,7 +73,7 @@ impl VertexId{
}
}
pub struct IndexedVertexList{
pub vertices:Vec<VertexId>,
vertices:Vec<VertexId>,
}
#[derive(Clone,Copy,Hash,PartialEq,Eq)]
pub struct PolygonGroupId(u32);
@ -93,6 +93,11 @@ impl PolygonGroup{
//PolygonGroup::TriangleStrip(strip)=>return strip.windows(3).enumerate().map(|(i,s)|if i&0!=0{return s.iter().rev()}else{return s.iter()}),
}
}
pub fn map_vertex_id<F:Fn(VertexId)->VertexId>(self,f:F)->Self{
match self{
PolygonGroup::PolygonList(polys)=>Self::PolygonList(polys.into_iter().map(|ivl|IndexedVertexList{vertices:ivl.vertices.into_iter().map(&f).collect()}).collect()),
}
}
}
/// Ah yes, a group of things to render at the same time
#[derive(Clone,Copy,Hash,Eq,PartialEq)]