From 2cc696a6e11397d1c6a3901b554daa4bf184105a Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 29 Oct 2011 13:38:19 +0200 Subject: [PATCH] add separate spotlight scale -spotscale --- tools/quake3/q3map2/light.c | 28 ++++++++++++++++++++++++++-- tools/quake3/q3map2/q3map2.h | 1 + 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index b6dcb122..512146e7 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -400,7 +400,6 @@ void CreateEntityLights( void ) if(light->extraDist == 0.0f) light->extraDist = extraDist; - intensity = intensity * pointScale; light->photons = intensity; light->type = EMIT_POINT; @@ -424,6 +423,7 @@ void CreateEntityLights( void ) { Sys_Printf( "WARNING: light at (%i %i %i) has missing target\n", (int) light->origin[ 0 ], (int) light->origin[ 1 ], (int) light->origin[ 2 ] ); + intensity = intensity * pointScale; } else { @@ -461,7 +461,7 @@ void CreateEntityLights( void ) /* make a sun */ VectorScale( light->normal, -1.0f, sun.direction ); VectorCopy( light->color, sun.color ); - sun.photons = (intensity / pointScale); + sun.photons = intensity; sun.deviance = deviance / 180.0f * Q_PI; sun.numSamples = numSamples; sun.style = noStyles ? LS_NORMAL : light->style; @@ -477,8 +477,14 @@ void CreateEntityLights( void ) /* skip the rest of this love story */ continue; } + else + { + intensity = intensity * spotScale; + } } } + else + intensity = intensity * pointScale; /* jitter the light */ for( j = 1; j < numSamples; j++ ) @@ -2124,6 +2130,15 @@ int LightMain( int argc, char **argv ) { /* lightsource scaling */ if( !strcmp( argv[ i ], "-point" ) || !strcmp( argv[ i ], "-pointscale" ) ) + { + f = atof( argv[ i + 1 ] ); + pointScale *= f; + spotScale *= f; + Sys_Printf( "Point (entity) light scaled by %f to %f\n", f, pointScale ); + i++; + } + + if( !strcmp( argv[ i ], "-pointonly" ) || !strcmp( argv[ i ], "-pointonlyscale" ) ) { f = atof( argv[ i + 1 ] ); pointScale *= f; @@ -2131,6 +2146,14 @@ int LightMain( int argc, char **argv ) i++; } + if( !strcmp( argv[ i ], "-spot" ) || !strcmp( argv[ i ], "-spotscale" ) ) + { + f = atof( argv[ i + 1 ] ); + spotScale *= f; + Sys_Printf( "Point (entity) light scaled by %f to %f\n", f, spotScale ); + i++; + } + else if( !strcmp( argv[ i ], "-area" ) || !strcmp( argv[ i ], "-areascale" ) ) { f = atof( argv[ i + 1 ] ); @@ -2159,6 +2182,7 @@ int LightMain( int argc, char **argv ) { f = atof( argv[ i + 1 ] ); pointScale *= f; + spotScale *= f; areaScale *= f; skyScale *= f; bounceScale *= f; diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 3d3509a4..9172415e 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2280,6 +2280,7 @@ Q_EXTERN float maxMapDistance Q_ASSIGN( 0 ); /* for run time tweaking of light sources */ Q_EXTERN float pointScale Q_ASSIGN( 7500.0f ); +Q_EXTERN float spotScale Q_ASSIGN( 7500.0f ); Q_EXTERN float areaScale Q_ASSIGN( 0.25f ); Q_EXTERN float skyScale Q_ASSIGN( 1.0f ); Q_EXTERN float bounceScale Q_ASSIGN( 0.25f ); -- 2.39.2