From 714c46381553bcc3d30f44e512fd9abce55314d0 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 4 Oct 2009 13:32:41 +0000 Subject: [PATCH] allowing to customize how directional the light is git-svn-id: svn://svn.icculus.org/netradiant/trunk@397 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/light.c | 22 ++++++++++++++++++++++ tools/quake3/q3map2/q3map2.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index 5b868bc8..9f06cfd3 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -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" ) ) { diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 6deeed24..49710c10 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -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 ); -- 2.39.2