X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fbsptree.c;h=334e53073c66f7ce10a7f7ee0019176eb71931da;hp=30f67eff08fb3d87eca861a91a10bb1ab60fdddd;hb=e5393153629cb39ea6af0ca4a35370442127c5c2;hpb=1fc50fb52faab54b3d5e160d3765d866c6cf173a diff --git a/src/bsptree.c b/src/bsptree.c index 30f67ef..334e530 100644 --- a/src/bsptree.c +++ b/src/bsptree.c @@ -239,6 +239,22 @@ static struct bspnode *add_poly_tree(struct bspnode *n, struct g3d_vertex *v, in return n; } +void debug_draw_poly(struct g3d_vertex *varr, int vcount) +{ + int i, nfaces = vcount - 2; + int vbuf_size = nfaces * 3; + struct g3d_vertex *vbuf = alloca(vbuf_size * sizeof *vbuf); + struct g3d_vertex *vptr = varr + 1; + + for(i=0; ix * n->plane.nx + vdir->y * n->plane.ny + vdir->z * n->plane.nz; if(dot >= 0.0f) { draw_bsp_tree(n->front, vdir); - g3d_draw_indexed(n->vcount, n->verts, n->vcount, 0, 0); + //g3d_draw_indexed(n->vcount, n->verts, n->vcount, 0, 0); + debug_draw_poly(n->verts, n->vcount); draw_bsp_tree(n->back, vdir); } else { draw_bsp_tree(n->back, vdir); - g3d_draw_indexed(n->vcount, n->verts, n->vcount, 0, 0); + //g3d_draw_indexed(n->vcount, n->verts, n->vcount, 0, 0); + debug_draw_poly(n->verts, n->vcount); draw_bsp_tree(n->front, vdir); } }