X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=bih.h;h=43b659e97f6753aa5fd8e9fb7756aca0035741bc;hp=90ec71db7744c887f328ed51730586475443eeeb;hb=1e31fd8ce86ded2d447ce9ba77bb77cecd56d48e;hpb=09f884dd87cbb5b3da9e261d8c0841cdb9365c5b diff --git a/bih.h b/bih.h index 90ec71db..43b659e9 100644 --- a/bih.h +++ b/bih.h @@ -6,10 +6,12 @@ #ifndef BIH_H #define BIH_H +#define BIH_MAXUNORDEREDCHILDREN 8 + 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; @@ -36,12 +39,14 @@ typedef struct bih_node_s // TODO: move bounds data to parent node and remove it from leafs? float mins[3]; float maxs[3]; - // < 0 is a leaf index (-1-leafindex), >= 0 is another node index (always >= this node's index) + // node indexes of children (always > this node's index) int front; int back; // interval of children float frontmin; // children[0] float backmax; // children[1] + // BIH_UNORDERED uses this for a list of leafindex (all >= 0), -1 = end of list + int children[BIH_MAXUNORDEREDCHILDREN]; } bih_node_t;