From be40cd674833750c00c605009615f1d809a86c2a Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 25 Jun 2010 14:03:32 +0000 Subject: [PATCH] add surfaceindex to bih_leaf_t and initialize it git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10251 d7cf8633-e32d-0410-b094-e92efae38249 --- bih.h | 1 + model_brush.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/bih.h b/bih.h index 194a6533..8b796669 100644 --- 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; diff --git a/model_brush.c b/model_brush.c index 2bf893f3..7563dd38 100644 --- a/model_brush.c +++ b/model_brush.c @@ -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; -- 2.39.2