From b9374dfb56e7011204844029946cd814f425a65a Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Wed, 30 Jan 2013 17:27:36 -0800 Subject: Starting sunlight experimentation branch --- src/renderergl2/tr_shade.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/renderergl2/tr_shade.c') diff --git a/src/renderergl2/tr_shade.c b/src/renderergl2/tr_shade.c index ace5b2dc..fbf11d6a 100644 --- a/src/renderergl2/tr_shade.c +++ b/src/renderergl2/tr_shade.c @@ -1330,6 +1330,11 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) index |= LIGHTDEF_ENTITY; } + if ((backEnd.viewParms.flags & VPF_USESUNLIGHT) && ((index & LIGHTDEF_USE_LIGHTMAP) || (index & LIGHTDEF_USE_LIGHT_VERTEX))) + { + index |= LIGHTDEF_USE_SHADOWMAP; + } + if (r_lightmap->integer && index & LIGHTDEF_USE_LIGHTMAP) { index = LIGHTDEF_USE_LIGHTMAP; @@ -1493,6 +1498,14 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) { int i; + if ((backEnd.viewParms.flags & VPF_USESUNLIGHT) && ((pStage->glslShaderIndex & LIGHTDEF_USE_LIGHTMAP) || (pStage->glslShaderIndex & LIGHTDEF_USE_LIGHT_VERTEX))) + { + GL_BindToTMU(tr.screenShadowImage, TB_SHADOWMAP); + GLSL_SetUniformVec3(sp, GENERIC_UNIFORM_AMBIENTLIGHT, backEnd.refdef.sunAmbCol); + GLSL_SetUniformVec3(sp, GENERIC_UNIFORM_DIRECTEDLIGHT, backEnd.refdef.sunCol); + GLSL_SetUniformVec4(sp, GENERIC_UNIFORM_LIGHTORIGIN, backEnd.refdef.sunDir); + } + if ((r_lightmap->integer == 1 || r_lightmap->integer == 2) && pStage->bundle[TB_LIGHTMAP].image[0]) { for (i = 0; i < NUM_TEXTURE_BUNDLES; i++) @@ -1783,11 +1796,13 @@ void RB_StageIteratorGeneric( void ) } } +#if 0 if ((backEnd.viewParms.flags & VPF_USESUNLIGHT) && tess.shader->sort <= SS_OPAQUE //if ((tr.sunShadows || r_forceSunlight->value > 0.0f) && tess.shader->sort <= SS_OPAQUE && !(tess.shader->surfaceFlags & (SURF_NODLIGHT | SURF_SKY) ) && tess.xstages[0]->glslShaderGroup == tr.lightallShader) { ForwardSunlight(); } +#endif // // now do fog -- cgit