diff --git a/src/model.rs b/src/model.rs index ac69cc7..f94f823 100644 --- a/src/model.rs +++ b/src/model.rs @@ -73,7 +73,7 @@ impl VertexId{ } } pub struct IndexedVertexList{ - pub vertices:Vec, + vertices:Vec, } #[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_idVertexId>(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)]