allowing to customize how directional the light is
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sun, 4 Oct 2009 13:32:41 +0000 (13:32 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sun, 4 Oct 2009 13:32:41 +0000 (13:32 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@397 61c419a2-8eb2-4b30-bcec-8cead039b335

tools/quake3/q3map2/light.c
tools/quake3/q3map2/q3map2.h

index 5b868bc82c3181332152c249e9e99cd10eca5ca1..9f06cfd361e6955e61057dca3b81a58d1b6f7175 100644 (file)
@@ -1455,6 +1455,8 @@ void TraceGrid( int num )
        {
                /* get relative directed strength */
                d = DotProduct( contributions[ i ].dir, gp->dir );
+               /* we map 1 to gridDirectionality, and 0 to gridAmbientDirectionality */
+               d = gridAmbientDirectionality + d * (gridDirectionality - gridAmbientDirectionality);
                if( d < 0.0f )
                        d = 0.0f;
                
@@ -1987,6 +1989,26 @@ int LightMain( int argc, char **argv )
                        gridAmbientScale *= f;
                        i++;
                }
+
+               else if( !strcmp( argv[ i ], "-griddirectionality" ) )
+               {
+                       f = atof( argv[ i + 1 ] );
+                       if(f < 0) f = 0;
+                       if(f > gridAmbientDirectionality) f = gridAmbientDirectionality;
+                       Sys_Printf( "Grid directionality is %f\n", f );
+                       gridDirectionality *= f;
+                       i++;
+               }
+
+               else if( !strcmp( argv[ i ], "-gridambientdirectionality" ) )
+               {
+                       f = atof( argv[ i + 1 ] );
+                       if(f > gridDirectionality) f = gridDirectionality
+                       if(f > 1) f = 1;
+                       Sys_Printf( "Grid ambient directionality is %f\n", f );
+                       gridAmbientDirectionality *= f;
+                       i++;
+               }
                
                else if( !strcmp( argv[ i ], "-gamma" ) )
                {
index 6deeed24239bad919066421db6d0ecb8d263cdf7..49710c10c5a76f906446bc422c91aa7ac7569570 100644 (file)
@@ -2221,6 +2221,8 @@ Q_EXTERN float                            bounceScale Q_ASSIGN( 0.25f );
 /* vortex: gridscale and gridambientscale */
 Q_EXTERN float                         gridScale Q_ASSIGN( 1.0f );
 Q_EXTERN float                         gridAmbientScale Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridDirectionality Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridAmbientDirectionality Q_ASSIGN( 0.0f );
 
 /* ydnar: lightmap gamma/compensation */
 Q_EXTERN float                         lightmapGamma Q_ASSIGN( 1.0f );