diff options
author | Saracen <SaracenOne@gmail.com> | 2015-11-08 03:21:06 +0000 |
---|---|---|
committer | Saracen <SaracenOne@gmail.com> | 2015-11-08 03:54:55 +0000 |
commit | c1d19ad258139c73e7aa81cf6e1fbd99e1bfe38b (patch) | |
tree | d2512815b6892a1a5ede56f7c220f24999eeb723 /drivers/gles2/shaders/material.glsl | |
parent | 3fcfdfec0ac5175f55527b3ec95d14d48bf29dd2 (diff) |
New shader feature: change the colour of shadows on a per-material basis.
Conflicts:
drivers/gles2/shader_compiler_gles2.cpp
Diffstat (limited to 'drivers/gles2/shaders/material.glsl')
-rw-r--r-- | drivers/gles2/shaders/material.glsl | 8 |
1 files changed, 8 insertions, 0 deletions
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); |