forked from StrafesNET/strafe-client
pretty polygon fanning from vbsp code
This commit is contained in:
parent
5c107c1e5f
commit
ed27ee060b
@ -419,22 +419,26 @@ 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];
|
let i=vertices.len();
|
||||||
indices.push(*index_from_vertex.entry(vertex_index).or_insert_with(||{
|
let vertex=&model.unique_vertices[vertex_index.get() as usize];
|
||||||
let i=vertices.len();
|
vertices.push(GraphicsVertex{
|
||||||
let vertex=&model.unique_vertices[vertex_index.get() as usize];
|
pos:model.unique_pos[vertex.pos.get() as usize],
|
||||||
vertices.push(GraphicsVertex{
|
tex:model.unique_tex[vertex.tex.get() as usize],
|
||||||
pos:model.unique_pos[vertex.pos.get() as usize],
|
normal:model.unique_normal[vertex.normal.get() as usize],
|
||||||
tex:model.unique_tex[vertex.tex.get() as usize],
|
color:model.unique_color[vertex.color.get() as usize],
|
||||||
normal:model.unique_normal[vertex.normal.get() as usize],
|
});
|
||||||
color:model.unique_color[vertex.color.get() as usize],
|
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