diff options
Diffstat (limited to 'src/renderergl2')
-rw-r--r-- | src/renderergl2/tr_bsp.c | 3 | ||||
-rw-r--r-- | src/renderergl2/tr_init.c | 2 | ||||
-rw-r--r-- | src/renderergl2/tr_local.h | 2 | ||||
-rw-r--r-- | src/renderergl2/tr_scene.c | 37 | ||||
-rw-r--r-- | src/renderergl2/tr_shader.c | 4 |
5 files changed, 31 insertions, 17 deletions
diff --git a/src/renderergl2/tr_bsp.c b/src/renderergl2/tr_bsp.c index b85189fd..dd8887b0 100644 --- a/src/renderergl2/tr_bsp.c +++ b/src/renderergl2/tr_bsp.c @@ -3278,7 +3278,8 @@ void RE_LoadWorldMap( const char *name ) { } // set default map light scale - tr.mapLightScale = 1.0f; + tr.mapLightScale = 1.0f; + tr.sunShadowScale = 0.5f; // set default sun direction to be used if it isn't // overridden by a shader diff --git a/src/renderergl2/tr_init.c b/src/renderergl2/tr_init.c index a011bba4..c02c3345 100644 --- a/src/renderergl2/tr_init.c +++ b/src/renderergl2/tr_init.c @@ -1128,7 +1128,7 @@ void R_Register( void ) r_forceSun = ri.Cvar_Get( "r_forceSun", "0", CVAR_CHEAT ); r_forceSunMapLightScale = ri.Cvar_Get( "r_forceSunMapLightScale", "1.0", CVAR_CHEAT ); r_forceSunLightScale = ri.Cvar_Get( "r_forceSunLightScale", "1.0", CVAR_CHEAT ); - r_forceSunAmbientScale = ri.Cvar_Get( "r_forceSunAmbientScale", "0.75", CVAR_CHEAT ); + r_forceSunAmbientScale = ri.Cvar_Get( "r_forceSunAmbientScale", "0.5", CVAR_CHEAT ); r_drawSunRays = ri.Cvar_Get( "r_drawSunRays", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_sunlightMode = ri.Cvar_Get( "r_sunlightMode", "1", CVAR_ARCHIVE | CVAR_LATCH ); diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h index 96f657e4..7105f1ae 100644 --- a/src/renderergl2/tr_local.h +++ b/src/renderergl2/tr_local.h @@ -1790,10 +1790,10 @@ typedef struct { int viewCluster; float mapLightScale; + float sunShadowScale; qboolean sunShadows; vec3_t sunLight; // from the sky shader for this level - vec3_t sunAmbient; vec3_t sunDirection; frontEndCounters_t pc; diff --git a/src/renderergl2/tr_scene.c b/src/renderergl2/tr_scene.c index 1f6c765e..71e816b4 100644 --- a/src/renderergl2/tr_scene.c +++ b/src/renderergl2/tr_scene.c @@ -361,19 +361,34 @@ void RE_RenderScene( const refdef_t *fd ) { VectorSet(tr.refdef.sunCol, 0, 0, 0); VectorSet(tr.refdef.sunAmbCol, 0, 0, 0); } - else if (r_forceSun->integer == 1) - { - float scale = pow(2, r_mapOverBrightBits->integer - tr.overbrightBits - 8); - tr.refdef.colorScale = r_forceSunMapLightScale->value; - VectorScale(tr.sunLight, scale * r_forceSunLightScale->value, tr.refdef.sunCol); - VectorScale(tr.sunLight, scale * r_forceSunAmbientScale->value, tr.refdef.sunAmbCol); - } else { - float scale = pow(2, r_mapOverBrightBits->integer - tr.overbrightBits - 8); - tr.refdef.colorScale = tr.mapLightScale; - VectorScale(tr.sunLight, scale, tr.refdef.sunCol); - VectorScale(tr.sunAmbient, scale, tr.refdef.sunAmbCol); + tr.refdef.colorScale = r_forceSun->integer ? r_forceSunMapLightScale->value : tr.mapLightScale; + + if (r_sunlightMode->integer == 1) + { + tr.refdef.sunCol[0] = + tr.refdef.sunCol[1] = + tr.refdef.sunCol[2] = 1.0f; + + tr.refdef.sunAmbCol[0] = + tr.refdef.sunAmbCol[1] = + tr.refdef.sunAmbCol[2] = r_forceSun->integer ? r_forceSunAmbientScale->value : tr.sunShadowScale; + } + else + { + float scale = pow(2, r_mapOverBrightBits->integer - tr.overbrightBits - 8); + if (r_forceSun->integer) + { + VectorScale(tr.sunLight, scale * r_forceSunLightScale->value, tr.refdef.sunCol); + VectorScale(tr.sunLight, scale * r_forceSunAmbientScale->value, tr.refdef.sunAmbCol); + } + else + { + VectorScale(tr.sunLight, scale, tr.refdef.sunCol); + VectorScale(tr.sunLight, scale * tr.sunShadowScale, tr.refdef.sunAmbCol); + } + } } if (r_forceAutoExposure->integer) diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c index 7eebf787..0d98129b 100644 --- a/src/renderergl2/tr_shader.c +++ b/src/renderergl2/tr_shader.c @@ -1637,8 +1637,6 @@ static qboolean ParseShader( char **text ) a = atof( token ); VectorScale( tr.sunLight, a, tr.sunLight); - VectorSet( tr.sunAmbient, 0.0f, 0.0f, 0.0f); - token = COM_ParseExt( text, qfalse ); a = atof( token ); a = a / 180 * M_PI; @@ -1657,7 +1655,7 @@ static qboolean ParseShader( char **text ) tr.mapLightScale = atof(token); token = COM_ParseExt( text, qfalse ); - VectorScale( tr.sunLight, atof(token), tr.sunAmbient ); + tr.sunShadowScale = atof(token); } SkipRestOfLine( text ); |