diff --git a/tools/quake3/q3map2/light.cpp b/tools/quake3/q3map2/light.cpp index 04cf3e08..869c5bd5 100644 --- a/tools/quake3/q3map2/light.cpp +++ b/tools/quake3/q3map2/light.cpp @@ -1854,13 +1854,14 @@ void LightWorld( bool fastAllocate ){ ambientColor.set( 0 ); floodlighty = false; + /* delete any existing lights, freeing up memory for the next bounce */ + lights.clear(); /* generate diffuse lights */ - RadFreeLights(); RadCreateDiffuseLights(); /* setup light envelopes */ SetupEnvelopes( false, fastbounce ); - if ( numLights == 0 ) { + if ( lights.empty() ) { Sys_Printf( "No diffuse light to calculate, ending radiosity.\n" ); break; } diff --git a/tools/quake3/q3map2/light_bounce.cpp b/tools/quake3/q3map2/light_bounce.cpp index 5c9f37a9..d0cbbeed 100644 --- a/tools/quake3/q3map2/light_bounce.cpp +++ b/tools/quake3/q3map2/light_bounce.cpp @@ -32,20 +32,8 @@ #include "q3map2.h" - /* functions */ -/* - RadFreeLights() - deletes any existing lights, freeing up memory for the next bounce - */ - -void RadFreeLights( void ){ - lights.clear(); - numLights = 0; -} - - /* RadClipWindingEpsilon() diff --git a/tools/quake3/q3map2/light_ydnar.cpp b/tools/quake3/q3map2/light_ydnar.cpp index dccb8eae..9d6889c2 100644 --- a/tools/quake3/q3map2/light_ydnar.cpp +++ b/tools/quake3/q3map2/light_ydnar.cpp @@ -3339,7 +3339,6 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){ Sys_FPrintf( SYS_VRB, "--- SetupEnvelopes%s ---\n", fastFlag ? " (fast)" : "" ); /* count lights */ - numLights = 0; numCulledLights = 0; for( decltype( lights )::iterator light = lights.begin(); light != lights.end(); ) { @@ -3574,9 +3573,6 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){ /* square envelope */ light->envelope2 = ( light->envelope * light->envelope ); - /* increment light count */ - numLights++; - /* set next light */ ++light; } @@ -3589,7 +3585,7 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){ } /* emit some statistics */ - Sys_Printf( "%9d total lights\n", numLights ); + Sys_Printf( "%9zu total lights\n", lights.size() ); Sys_Printf( "%9d culled lights\n", numCulledLights ); } @@ -3605,16 +3601,11 @@ void CreateTraceLightsForBounds( const MinMax& minmax, const Vector3 *normal, in float length; - /* potential pre-setup */ - if ( numLights == 0 ) { - SetupEnvelopes( false, fast ); - } - /* debug code */ //% Sys_Printf( "CTWLFB: (%4.1f %4.1f %4.1f) (%4.1f %4.1f %4.1f)\n", minmax.mins[ 0 ], minmax.mins[ 1 ], minmax.mins[ 2 ], minmax.maxs[ 0 ], minmax.maxs[ 1 ], minmax.maxs[ 2 ] ); /* allocate the light list */ - trace->lights = safe_malloc( sizeof( light_t* ) * ( numLights + 1 ) ); + trace->lights = safe_malloc( sizeof( light_t* ) * ( lights.size() + 1 ) ); trace->numLights = 0; /* calculate spherical bounds */ diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index d1cf664d..ae3d18d8 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1795,7 +1795,6 @@ bool RadSampleImage( byte * pixels, int width, int height void RadLightForTriangles( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t *si, float scale, float subdivide, clipWork_t *cw ); void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t *si, float scale, float subdivide, clipWork_t *cw ); void RadCreateDiffuseLights( void ); -void RadFreeLights(); /* light_ydnar.c */ @@ -2355,7 +2354,6 @@ Q_EXTERN float subdivideThreshold Q_ASSIGN( DEFAULT_SUBDIVIDE_THRESHOLD ); Q_EXTERN int numOpaqueBrushes, maxOpaqueBrush; Q_EXTERN byte *opaqueBrushes; -Q_EXTERN int numLights; Q_EXTERN int numCulledLights; Q_EXTERN int gridBoundsCulled;