]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - bih.h
fix ~TEXF_PICMIP in DDS loading, and fix TEXF_ALPHA generation (there was a bug that...
[xonotic/darkplaces.git] / bih.h
diff --git a/bih.h b/bih.h
index 7a98045f5808e943fd7286d08eb70a2372a8c7da..90ec71db7744c887f328ed51730586475443eeeb 100644 (file)
--- a/bih.h
+++ b/bih.h
@@ -18,10 +18,17 @@ typedef enum bih_nodetype_e
        BIH_SPLITX = 0,
        BIH_SPLITY = 1,
        BIH_SPLITZ = 2,
-       BIH_LEAF = 3,
 }
 bih_nodetype_t;
 
+typedef enum bih_leaftype_e
+{
+       BIH_BRUSH = 3,
+       BIH_COLLISIONTRIANGLE = 4,
+       BIH_RENDERTRIANGLE = 5,
+}
+bih_leaftype_t;
+
 typedef struct bih_node_s
 {
        bih_nodetype_t type; // = BIH_SPLITX and similar values
@@ -30,17 +37,22 @@ typedef struct bih_node_s
        float mins[3];
        float maxs[3];
        // < 0 is a leaf index (-1-leafindex), >= 0 is another node index (always >= this node's index)
-       int children[2];
+       int front;
+       int back;
+       // interval of children
+       float frontmin; // children[0]
+       float backmax; // children[1]
 }
 bih_node_t;
 
 typedef struct bih_leaf_s
 {
-       bih_nodetype_t type; // = BIH_LEAF
+       bih_leaftype_t type; // = BIH_BRUSH And similar values
        float mins[3];
        float maxs[3];
        // data past this point is generic and entirely up to the caller...
        int textureindex;
+       int surfaceindex;
        int itemindex; // triangle or brush index
 }
 bih_leaf_t;
@@ -54,6 +66,10 @@ typedef struct bih_s
        // nodes are constructed by BIH_Build
        int numnodes;
        bih_node_t *nodes;
+       int rootnode; // 0 if numnodes > 0, -1 otherwise
+       // bounds calculated by BIH_Build
+       float mins[3];
+       float maxs[3];
 
        // fields used only during BIH_Build:
        int maxnodes;
@@ -65,4 +81,6 @@ 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_GetTriangleListForBox(const bih_t *bih, int maxtriangles, int *trianglelist_idx, int *trianglelist_surf, const float *mins, const float *maxs);
+
 #endif