From ada6778a14d4ccecf7d2de73aa7816865d297399 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 9 Sep 2002 14:30:09 +0000 Subject: [PATCH 1/1] removed modelsortedsurfaces git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2343 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rsurf.c | 2 +- model_brush.c | 29 ----------------------------- model_shared.h | 2 -- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/gl_rsurf.c b/gl_rsurf.c index d1c0c38d..f33bd315 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -1489,7 +1489,7 @@ void R_DrawSurfaces(entity_render_t *ent, int sky, int normal) Matrix4x4_Transform(&ent->inversematrix, r_origin, modelorg); for (i = 0;i < model->nummodelsurfaces;i++) { - surf = model->modelsortedsurfaces[i]; + surf = model->surfaces + i + model->firstmodelsurface; if (surf->visframe == r_framecount) { // mark any backface surfaces as not visible diff --git a/model_brush.c b/model_brush.c index 28aa2d24..edcb6093 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1381,33 +1381,6 @@ static void Mod_LoadFaces (lump_t *l) } } -static model_t *sortmodel; - -static int Mod_SurfaceQSortCompare(const void *voida, const void *voidb) -{ - const msurface_t *a, *b; - a = *((const msurface_t **)voida); - b = *((const msurface_t **)voidb); - if (a->shader != b->shader) - return (qbyte *) a->shader - (qbyte *) b->shader; - if (a->texinfo->texture != b->texinfo->texture); - return a->texinfo->texture - b->texinfo->texture; - return 0; -} - -static void Mod_BrushSortedSurfaces(model_t *model, mempool_t *pool) -{ - int surfnum; - sortmodel = model; - sortmodel->modelsortedsurfaces = Mem_Alloc(pool, sortmodel->nummodelsurfaces * sizeof(msurface_t *)); - for (surfnum = 0;surfnum < sortmodel->nummodelsurfaces;surfnum++) - sortmodel->modelsortedsurfaces[surfnum] = &sortmodel->surfaces[surfnum + sortmodel->firstmodelsurface]; - - if (r_sortsurfaces.integer) - qsort(sortmodel->modelsortedsurfaces, sortmodel->nummodelsurfaces, sizeof(msurface_t *), Mod_SurfaceQSortCompare); -} - - /* ================= Mod_SetParent @@ -2536,8 +2509,6 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) mod->Draw = R_DrawBrushModelNormal; mod->DrawShadow = NULL; - Mod_BrushSortedSurfaces(mod, mainmempool); - // LordHavoc: only register submodels if it is the world // (prevents bsp models from replacing world submodels) if (loadmodel->isworldmodel && i < (mod->numsubmodels - 1)) diff --git a/model_shared.h b/model_shared.h index d970b84f..d35e06a5 100644 --- a/model_shared.h +++ b/model_shared.h @@ -115,8 +115,6 @@ typedef struct model_s // brush model specific int firstmodelsurface, nummodelsurfaces; - // LordHavoc: sorted surface pointer array, sorted by shader type and then by texture - msurface_t **modelsortedsurfaces; // [nummodelsurfaces] // lightmap format, set to r_lightmaprgba when model is loaded int lightmaprgba; -- 2.39.2