add surfaceindex to bih_leaf_t and initialize it
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Jun 2010 14:03:32 +0000 (14:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Jun 2010 14:03:32 +0000 (14:03 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10251 d7cf8633-e32d-0410-b094-e92efae38249

bih.h
model_brush.c

diff --git a/bih.h b/bih.h
index 194a653..8b79666 100644 (file)
--- a/bih.h
+++ b/bih.h
@@ -52,6 +52,7 @@ typedef struct bih_leaf_s
        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;
index 2bf893f..7563dd3 100644 (file)
@@ -6652,6 +6652,7 @@ void Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces)
                                continue;
                        bihleafs[bihleafindex].type = BIH_RENDERTRIANGLE;
                        bihleafs[bihleafindex].textureindex = surface->texture - model->data_textures;
+                       bihleafs[bihleafindex].surfaceindex = surface - model->data_surfaces;
                        bihleafs[bihleafindex].itemindex = triangleindex+surface->num_firsttriangle;
                        bihleafs[bihleafindex].mins[0] = min(rendervertex3f[3*e[0]+0], min(rendervertex3f[3*e[1]+0], rendervertex3f[3*e[2]+0])) - 1;
                        bihleafs[bihleafindex].mins[1] = min(rendervertex3f[3*e[0]+1], min(rendervertex3f[3*e[1]+1], rendervertex3f[3*e[2]+1])) - 1;
@@ -6672,6 +6673,7 @@ void Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces)
                                continue;
                        bihleafs[bihleafindex].type = BIH_BRUSH;
                        bihleafs[bihleafindex].textureindex = brush->texture - model->data_textures;
+                       bihleafs[bihleafindex].surfaceindex = -1;
                        bihleafs[bihleafindex].itemindex = brushindex+model->firstmodelbrush;
                        VectorCopy(brush->colbrushf->mins, bihleafs[bihleafindex].mins);
                        VectorCopy(brush->colbrushf->maxs, bihleafs[bihleafindex].maxs);
@@ -6687,6 +6689,7 @@ void Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces)
                        {
                                bihleafs[bihleafindex].type = BIH_COLLISIONTRIANGLE;
                                bihleafs[bihleafindex].textureindex = surface->texture - model->data_textures;
+                               bihleafs[bihleafindex].surfaceindex = surface - model->data_surfaces;
                                bihleafs[bihleafindex].itemindex = triangleindex+surface->num_firstcollisiontriangle;
                                bihleafs[bihleafindex].mins[0] = min(collisionvertex3f[3*e[0]+0], min(collisionvertex3f[3*e[1]+0], collisionvertex3f[3*e[2]+0])) - 1;
                                bihleafs[bihleafindex].mins[1] = min(collisionvertex3f[3*e[0]+1], min(collisionvertex3f[3*e[1]+1], collisionvertex3f[3*e[2]+1])) - 1;