]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added r_sortsurfaces cvar, default off, sorting them seems to be a very minor slowdow...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 6 Aug 2002 16:35:51 +0000 (16:35 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 6 Aug 2002 16:35:51 +0000 (16:35 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2213 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index 3ce2fe0174ce46e41a080a9a7ec4651982af339c..3c248fe258ee06fa2948ee422affcd0c920cec1e 100644 (file)
@@ -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);
 }