X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=bih.h;h=4be1564fda8bcb7f5f34c368e7872439bd0dc335;hp=f1af0ef2c2601fb4b2b0c1301a6d0e99a06e12b9;hb=1ff3bc8e953680793a28ea923f2d1e58cdf2c9f0;hpb=1fa82ae49ae155e5258c0675fb619922281d6439 diff --git a/bih.h b/bih.h index f1af0ef2..4be1564f 100644 --- a/bih.h +++ b/bih.h @@ -1,12 +1,12 @@ -// This code written in 2010 by Forest Hale (lordhavoc ghdigital com), and placed into public domain. +// This code written in 2010 by Forest Hale (darkplacesengine gmail com), and placed into public domain. // Based on information in http://zach.in.tu-clausthal.de/papers/vrst02.html (in particular vrst02_boxtree.pdf) #ifndef BIH_H #define BIH_H -#define BIH_MAXUNORDEREDCHILDREN 16 +#define BIH_MAXUNORDEREDCHILDREN 8 typedef enum biherror_e { @@ -39,13 +39,13 @@ 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 (positive), -1 = end of list + // BIH_UNORDERED uses this for a list of leafindex (all >= 0), -1 = end of list int children[BIH_MAXUNORDEREDCHILDREN]; } bih_node_t; @@ -78,14 +78,13 @@ 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 maxchildrenunordered); +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_GetTriangleListForBox(const bih_t *bih, int maxtriangles, int *trianglelist_idx, int *trianglelist_surf, const float *mins, const float *maxs);