poly iter
This commit is contained in:
parent
78686b449d
commit
995ad255bc
10
src/model.rs
10
src/model.rs
@ -84,7 +84,15 @@ impl PolygonGroupId{
|
|||||||
}
|
}
|
||||||
pub enum PolygonGroup{
|
pub enum PolygonGroup{
|
||||||
PolygonList(Vec<IndexedVertexList>),
|
PolygonList(Vec<IndexedVertexList>),
|
||||||
//TriangleStrip(Vec<IndexedVertexList>),
|
//TriangleStrip(Vec<VertexId>),
|
||||||
|
}
|
||||||
|
impl PolygonGroup{
|
||||||
|
pub fn polys(&self)->impl Iterator<Item=&[VertexId]>{
|
||||||
|
match self{
|
||||||
|
PolygonGroup::PolygonList(polys)=>return polys.iter().map(|poly|poly.vertices.as_slice()),
|
||||||
|
//PolygonGroup::TriangleStrip(strip)=>return strip.windows(3).enumerate().map(|(i,s)|if i&0!=0{return s.iter().rev()}else{return s.iter()}),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// Ah yes, a group of things to render at the same time
|
/// Ah yes, a group of things to render at the same time
|
||||||
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
#[derive(Clone,Copy,Hash,Eq,PartialEq)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user