second color attachment if so, giving a modest speed boost for testing
but deferred is still way too slow for practical use even with this...
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10983
d7cf8633-e32d-0410-b094-
e92efae38249
permutation |= SHADERPERMUTATION_CUBEFILTER;
if (diffusescale > 0)
permutation |= SHADERPERMUTATION_DIFFUSE;
- if (specularscale > 0)
+ if (specularscale > 0 && r_shadow_gloss.integer > 0)
permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE;
if (r_shadow_usingshadowmap2d)
{
// only draw light where this geometry was already rendered AND the
// stencil is 128 (values other than this mean shadow)
R_SetStencil(stenciltest, 255, GL_KEEP, GL_KEEP, GL_KEEP, GL_EQUAL, 128, 255);
- R_Mesh_SetRenderTargets(r_shadow_prepasslightingdiffusespecularfbo, r_shadow_prepassgeometrydepthtexture, r_shadow_prepasslightingdiffusetexture, r_shadow_prepasslightingspeculartexture, NULL, NULL);
+ if (rsurface.rtlight->specularscale > 0 && r_shadow_gloss.integer > 0)
+ R_Mesh_SetRenderTargets(r_shadow_prepasslightingdiffusespecularfbo, r_shadow_prepassgeometrydepthtexture, r_shadow_prepasslightingdiffusetexture, r_shadow_prepasslightingspeculartexture, NULL, NULL);
+ else
+ R_Mesh_SetRenderTargets(r_shadow_prepasslightingdiffusefbo, r_shadow_prepassgeometrydepthtexture, r_shadow_prepasslightingdiffusetexture, NULL, NULL, NULL);
r_shadow_usingshadowmap2d = shadowmapping;
" fade *= ShadowMapCompare(CubeVector);\n"
"#endif\n"
"\n"
-"#ifdef USEDIFFUSE\n"
-" gl_FragData[0] = vec4((DeferredColor_Ambient + DeferredColor_Diffuse * diffuse) * fade, 1.0);\n"
-"#else\n"
-" gl_FragData[0] = vec4(DeferredColor_Ambient * fade, 1.0);\n"
-"#endif\n"
"#ifdef USESPECULAR\n"
+" gl_FragData[0] = vec4((DeferredColor_Ambient + DeferredColor_Diffuse * diffuse) * fade, 1.0);\n"
" gl_FragData[1] = vec4(DeferredColor_Specular * (specular * fade), 1.0);\n"
-"#else\n"
-" gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);\n"
-"#endif\n"
-"\n"
"# ifdef USECUBEFILTER\n"
" vec3 cubecolor = dp_textureCube(Texture_Cube, CubeVector).rgb;\n"
" gl_FragData[0].rgb *= cubecolor;\n"
" gl_FragData[1].rgb *= cubecolor;\n"
"# endif\n"
+"#else\n"
+"# ifdef USEDIFFUSE\n"
+" gl_FragColor = vec4((DeferredColor_Ambient + DeferredColor_Diffuse * diffuse) * fade, 1.0);\n"
+"# else\n"
+" gl_FragColor = vec4(DeferredColor_Ambient * fade, 1.0);\n"
+"# endif\n"
+"# ifdef USECUBEFILTER\n"
+" vec3 cubecolor = dp_textureCube(Texture_Cube, CubeVector).rgb;\n"
+" gl_FragColor.rgb *= cubecolor;\n"
+"# endif\n"
+"#endif\n"
+" \n"
"}\n"
"#endif // FRAGMENT_SHADER\n"
"#else // !MODE_DEFERREDLIGHTSOURCE\n"