forked from StrafesNET/strafe-client
pretty polygon fanning from vbsp code
This commit is contained in:
parent
5c107c1e5f
commit
ed27ee060b
@ -419,10 +419,8 @@ impl GraphicsState{
|
|||||||
//this mut be combined in a more complex way if the models use different render patterns per group
|
//this mut be combined in a more complex way if the models use different render patterns per group
|
||||||
let mut indices=Vec::new();
|
let mut indices=Vec::new();
|
||||||
for poly in model.polys.polys(){
|
for poly in model.polys.polys(){
|
||||||
for end_index in 2..poly.len(){
|
let mut poly_vertices=poly.iter()
|
||||||
for index in [0,end_index-1,end_index]{
|
.map(|&vertex_index|*index_from_vertex.entry(vertex_index).or_insert_with(||{
|
||||||
let vertex_index=poly[index];
|
|
||||||
indices.push(*index_from_vertex.entry(vertex_index).or_insert_with(||{
|
|
||||||
let i=vertices.len();
|
let i=vertices.len();
|
||||||
let vertex=&model.unique_vertices[vertex_index.get() as usize];
|
let vertex=&model.unique_vertices[vertex_index.get() as usize];
|
||||||
vertices.push(GraphicsVertex{
|
vertices.push(GraphicsVertex{
|
||||||
@ -433,8 +431,14 @@ impl GraphicsState{
|
|||||||
});
|
});
|
||||||
i
|
i
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
}
|
let a=poly_vertices.next().unwrap();
|
||||||
|
let mut b=poly_vertices.next().unwrap();
|
||||||
|
|
||||||
|
poly_vertices.for_each(|c|{
|
||||||
|
indices.extend([a,b,c]);
|
||||||
|
b=c;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
GraphicsMeshOwnedRenderConfig{
|
GraphicsMeshOwnedRenderConfig{
|
||||||
instances:model.instances,
|
instances:model.instances,
|
||||||
|
Loading…
Reference in New Issue
Block a user