X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=bih.h;h=f1af0ef2c2601fb4b2b0c1301a6d0e99a06e12b9;hp=8b79666900d1177a3b5001488ee4c1606437a579;hb=1fa82ae49ae155e5258c0675fb619922281d6439;hpb=be40cd674833750c00c605009615f1d809a86c2a diff --git a/bih.h b/bih.h index 8b796669..f1af0ef2 100644 --- a/bih.h +++ b/bih.h @@ -6,10 +6,12 @@ #ifndef BIH_H #define BIH_H +#define BIH_MAXUNORDEREDCHILDREN 16 + typedef enum biherror_e { BIHERROR_OK, // no error, be happy - BIHERROR_OUT_OF_NODES, // could not produce complete hierarchy, maxnodes too low (should be roughly half of numleafs) + BIHERROR_OUT_OF_NODES // could not produce complete hierarchy, maxnodes too low (should be roughly half of numleafs) } biherror_t; @@ -18,14 +20,15 @@ typedef enum bih_nodetype_e BIH_SPLITX = 0, BIH_SPLITY = 1, BIH_SPLITZ = 2, + BIH_UNORDERED = 3, } bih_nodetype_t; typedef enum bih_leaftype_e { - BIH_BRUSH = 3, - BIH_COLLISIONTRIANGLE = 4, - BIH_RENDERTRIANGLE = 5, + BIH_BRUSH = 4, + BIH_COLLISIONTRIANGLE = 5, + BIH_RENDERTRIANGLE = 6 } bih_leaftype_t; @@ -42,6 +45,8 @@ typedef struct bih_node_s // interval of children float frontmin; // children[0] float backmax; // children[1] + // BIH_UNORDERED uses this for a list of leafindex (positive), -1 = end of list + int children[BIH_MAXUNORDEREDCHILDREN]; } bih_node_t; @@ -73,14 +78,15 @@ typedef struct bih_s // fields used only during BIH_Build: int maxnodes; + int maxchildrenunordered; int error; // set to a value if an error occurs in building (such as numnodes == maxnodes) int *leafsort; int *leafsortscratch; } bih_t; -int BIH_Build(bih_t *bih, int numleafs, bih_leaf_t *leafs, int maxnodes, bih_node_t *nodes, int *temp_leafsort, int *temp_leafsortscratch); +int BIH_Build(bih_t *bih, int numleafs, bih_leaf_t *leafs, int maxnodes, bih_node_t *nodes, int *temp_leafsort, int *temp_leafsortscratch, int maxchildrenunordered); -int BIH_GetTriangleListForBox(const bih_t *bih, int maxtriangles, int *trianglelist, const float *mins, const float *maxs); +int BIH_GetTriangleListForBox(const bih_t *bih, int maxtriangles, int *trianglelist_idx, int *trianglelist_surf, const float *mins, const float *maxs); #endif