X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=bih.h;h=9b48becd4f2a32d7b70657630678dc83baceb1b6;hp=810cf9ca9e87ad7e53be86ec7c5c333d6c4a7187;hb=7ea07939bef0cbe85c54d9f68cb924198b0b1f64;hpb=0f80ff51ff9f369233d17b3377d3a0d34b4c8e5a diff --git a/bih.h b/bih.h index 810cf9ca..9b48becd 100644 --- a/bih.h +++ b/bih.h @@ -1,11 +1,13 @@ -// This code written in 2010 by Forest Hale (lordhavoc ghdigital com), and placed into public domain. +// This code written in 2010 by Ashley Rose Hale (LadyHavoc) (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 8 + typedef enum biherror_e { BIHERROR_OK, // no error, be happy @@ -17,15 +19,16 @@ typedef enum bih_nodetype_e { BIH_SPLITX = 0, BIH_SPLITY = 1, - BIH_SPLITZ = 2 + 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;