From c1d19ad258139c73e7aa81cf6e1fbd99e1bfe38b Mon Sep 17 00:00:00 2001 From: Saracen Date: Sun, 8 Nov 2015 03:21:06 +0000 Subject: New shader feature: change the colour of shadows on a per-material basis. Conflicts: drivers/gles2/shader_compiler_gles2.cpp --- drivers/gles2/shaders/material.glsl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/gles2/shaders/material.glsl') diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index 38fb03ab5c..ccd80bf2f0 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -1175,6 +1175,10 @@ FRAGMENT_SHADER_CODE vec3 mdiffuse = diffuse.rgb; vec3 light; +#if defined(USE_LIGHT_SHADOW_COLOR) + vec3 shadow_color=vec3(0.0,0.0,0.0); +#endif + #if defined(USE_LIGHT_SHADER_CODE) //light is written by the light shader { @@ -1195,6 +1199,10 @@ LIGHT_SHADER_CODE #endif diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; +#if defined(USE_LIGHT_SHADOW_COLOR) + diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation); +#endif + #ifdef USE_FOG diffuse.rgb = mix(diffuse.rgb,fog_interp.rgb,fog_interp.a); -- cgit v1.2.3