summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_shade.c
diff options
context:
space:
mode:
authorSmileTheory <SmileTheory@gmail.com>2013-01-30 17:27:36 -0800
committerTim Angus <tim@ngus.net>2013-05-03 16:06:37 +0100
commitb9374dfb56e7011204844029946cd814f425a65a (patch)
tree6114b82cfeb452b6f3257eae67a7e06aaa387051 /src/renderergl2/tr_shade.c
parent38daed324464666b5a4bb6a758c60e960b4610f0 (diff)
Starting sunlight experimentation branch
Diffstat (limited to 'src/renderergl2/tr_shade.c')
-rw-r--r--src/renderergl2/tr_shade.c15
1 files changed, 15 insertions, 0 deletions
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