]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
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 194a6533280506af26d89995b3e7639d72174ed5..8b79666900d1177a3b5001488ee4c1606437a579 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 2bf893f3f498a7745834aff527ba3fed30a6571d..7563dd38a536872fabbe6c9874b5b5b635125c67 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;