remove Q_EXTERN int numLights
remove /* potential pre-setup */ : 1. it seems to never actually be the case 2. it is called from threaded functions, while SetupEnvelopes() itself is not thread safe
This commit is contained in:
parent
f49639c697
commit
357f67f237
|
|
@ -1854,13 +1854,14 @@ void LightWorld( bool fastAllocate ){
|
||||||
ambientColor.set( 0 );
|
ambientColor.set( 0 );
|
||||||
floodlighty = false;
|
floodlighty = false;
|
||||||
|
|
||||||
|
/* delete any existing lights, freeing up memory for the next bounce */
|
||||||
|
lights.clear();
|
||||||
/* generate diffuse lights */
|
/* generate diffuse lights */
|
||||||
RadFreeLights();
|
|
||||||
RadCreateDiffuseLights();
|
RadCreateDiffuseLights();
|
||||||
|
|
||||||
/* setup light envelopes */
|
/* setup light envelopes */
|
||||||
SetupEnvelopes( false, fastbounce );
|
SetupEnvelopes( false, fastbounce );
|
||||||
if ( numLights == 0 ) {
|
if ( lights.empty() ) {
|
||||||
Sys_Printf( "No diffuse light to calculate, ending radiosity.\n" );
|
Sys_Printf( "No diffuse light to calculate, ending radiosity.\n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,8 @@
|
||||||
#include "q3map2.h"
|
#include "q3map2.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* functions */
|
/* functions */
|
||||||
|
|
||||||
/*
|
|
||||||
RadFreeLights()
|
|
||||||
deletes any existing lights, freeing up memory for the next bounce
|
|
||||||
*/
|
|
||||||
|
|
||||||
void RadFreeLights( void ){
|
|
||||||
lights.clear();
|
|
||||||
numLights = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
RadClipWindingEpsilon()
|
RadClipWindingEpsilon()
|
||||||
|
|
|
||||||
|
|
@ -3339,7 +3339,6 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){
|
||||||
Sys_FPrintf( SYS_VRB, "--- SetupEnvelopes%s ---\n", fastFlag ? " (fast)" : "" );
|
Sys_FPrintf( SYS_VRB, "--- SetupEnvelopes%s ---\n", fastFlag ? " (fast)" : "" );
|
||||||
|
|
||||||
/* count lights */
|
/* count lights */
|
||||||
numLights = 0;
|
|
||||||
numCulledLights = 0;
|
numCulledLights = 0;
|
||||||
for( decltype( lights )::iterator light = lights.begin(); light != lights.end(); )
|
for( decltype( lights )::iterator light = lights.begin(); light != lights.end(); )
|
||||||
{
|
{
|
||||||
|
|
@ -3574,9 +3573,6 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){
|
||||||
/* square envelope */
|
/* square envelope */
|
||||||
light->envelope2 = ( light->envelope * light->envelope );
|
light->envelope2 = ( light->envelope * light->envelope );
|
||||||
|
|
||||||
/* increment light count */
|
|
||||||
numLights++;
|
|
||||||
|
|
||||||
/* set next light */
|
/* set next light */
|
||||||
++light;
|
++light;
|
||||||
}
|
}
|
||||||
|
|
@ -3589,7 +3585,7 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* emit some statistics */
|
/* 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 );
|
Sys_Printf( "%9d culled lights\n", numCulledLights );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3605,16 +3601,11 @@ void CreateTraceLightsForBounds( const MinMax& minmax, const Vector3 *normal, in
|
||||||
float length;
|
float length;
|
||||||
|
|
||||||
|
|
||||||
/* potential pre-setup */
|
|
||||||
if ( numLights == 0 ) {
|
|
||||||
SetupEnvelopes( false, fast );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* debug code */
|
/* 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 ] );
|
//% 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 */
|
/* 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;
|
trace->numLights = 0;
|
||||||
|
|
||||||
/* calculate spherical bounds */
|
/* calculate spherical bounds */
|
||||||
|
|
|
||||||
|
|
@ -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 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 RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t *si, float scale, float subdivide, clipWork_t *cw );
|
||||||
void RadCreateDiffuseLights( void );
|
void RadCreateDiffuseLights( void );
|
||||||
void RadFreeLights();
|
|
||||||
|
|
||||||
|
|
||||||
/* light_ydnar.c */
|
/* light_ydnar.c */
|
||||||
|
|
@ -2355,7 +2354,6 @@ Q_EXTERN float subdivideThreshold Q_ASSIGN( DEFAULT_SUBDIVIDE_THRESHOLD );
|
||||||
Q_EXTERN int numOpaqueBrushes, maxOpaqueBrush;
|
Q_EXTERN int numOpaqueBrushes, maxOpaqueBrush;
|
||||||
Q_EXTERN byte *opaqueBrushes;
|
Q_EXTERN byte *opaqueBrushes;
|
||||||
|
|
||||||
Q_EXTERN int numLights;
|
|
||||||
Q_EXTERN int numCulledLights;
|
Q_EXTERN int numCulledLights;
|
||||||
|
|
||||||
Q_EXTERN int gridBoundsCulled;
|
Q_EXTERN int gridBoundsCulled;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user