add separate spotlight scale -spotscale
authorRudolf Polzer <divverent@xonotic.org>
Sat, 29 Oct 2011 11:38:19 +0000 (13:38 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 29 Oct 2011 11:38:19 +0000 (13:38 +0200)
tools/quake3/q3map2/light.c
tools/quake3/q3map2/q3map2.h

index b6dcb12..512146e 100644 (file)
@@ -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;
index 3d3509a..9172415 100644 (file)
@@ -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 );