X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosrtxon;a=blobdiff_plain;f=src%2Fbsptree.h;fp=src%2Fbsptree.h;h=2839ab01b761688a406138b3b74055413b6e0c7d;hp=0000000000000000000000000000000000000000;hb=ac1dd983cb211904ca6c74ca28ceb5e83aa09527;hpb=4621a049a4889c5a6845a08e9c0a4d6634ab8556 diff --git a/src/bsptree.h b/src/bsptree.h new file mode 100644 index 0000000..2839ab0 --- /dev/null +++ b/src/bsptree.h @@ -0,0 +1,37 @@ +#ifndef BSPMESH_H_ +#define BSPMESH_H_ + +#include "mesh.h" +#include "vmath.h" +#include "polyclip.h" + +struct bsppoly { + struct cplane plane; + int vcount; + struct g3d_vertex *verts; +}; + +struct bspnode { + struct bsppoly poly; + struct bspnode *front, *back; +}; + +struct bsptree { + struct bspnode *root; + struct bsppoly *soup; /* dynarr: see dynarr.h */ +}; + +int init_bsp(struct bsptree *bsp); +void destroy_bsp(struct bsptree *bsp); + +int save_bsp(struct bsptree *bsp, const char *fname); +int load_bsp(struct bsptree *bsp, const char *fname); + +int bsp_add_poly(struct bsptree *bsp, struct g3d_vertex *v, int vnum); +int bsp_add_mesh(struct bsptree *bsp, struct g3d_mesh *m); + +int bsp_build(struct bsptree *bsp); + +void draw_bsp(struct bsptree *bsp, float view_x, float view_y, float view_z); + +#endif /* BSPMESH_H_ */