From 2b77a4b0d8f8283a5dcaa86642d46f8ad114f189 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 6 Aug 2002 16:35:51 +0000 Subject: [PATCH] added r_sortsurfaces cvar, default off, sorting them seems to be a very minor slowdown ingame for me git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2213 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model_brush.c b/model_brush.c index 3ce2fe01..3c248fe2 100644 --- a/model_brush.c +++ b/model_brush.c @@ -31,6 +31,7 @@ cvar_t r_miplightmaps = {CVAR_SAVE, "r_miplightmaps", "0"}; cvar_t r_lightmaprgba = {0, "r_lightmaprgba", "1"}; cvar_t r_vertexsurfacesthreshold = {CVAR_SAVE, "r_vertexsurfacesthreshold", "0"}; cvar_t r_nosurftextures = {0, "r_nosurftextures", "0"}; +cvar_t r_sortsurfaces = {0, "r_sortsurfaces", "0"}; /* =============== @@ -46,6 +47,7 @@ void Mod_BrushInit (void) Cvar_RegisterVariable(&r_lightmaprgba); Cvar_RegisterVariable(&r_vertexsurfacesthreshold); Cvar_RegisterVariable(&r_nosurftextures); + Cvar_RegisterVariable(&r_sortsurfaces); memset(mod_novis, 0xff, sizeof(mod_novis)); } @@ -1392,7 +1394,8 @@ static void Mod_BrushSortedSurfaces(model_t *model, mempool_t *pool) for (surfnum = 0;surfnum < sortmodel->nummodelsurfaces;surfnum++) sortmodel->modelsortedsurfaces[surfnum] = &sortmodel->surfaces[surfnum + sortmodel->firstmodelsurface]; - qsort(sortmodel->modelsortedsurfaces, sortmodel->nummodelsurfaces, sizeof(msurface_t *), Mod_SurfaceQSortCompare); + if (r_sortsurfaces.integer) + qsort(sortmodel->modelsortedsurfaces, sortmodel->nummodelsurfaces, sizeof(msurface_t *), Mod_SurfaceQSortCompare); } -- 2.39.2