summaryrefslogtreecommitdiff
path: root/drivers/gles2/shaders/canvas.glsl
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-03 01:43:37 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-03 01:43:37 -0300
commit9fa1698c7420bae2c6353bf300ce2cdb73434bf6 (patch)
tree7d67492203476b2599621ebe258987c94db79b88 /drivers/gles2/shaders/canvas.glsl
parent42d41a3fbc79ff1014d3b65666d6f80240520c8c (diff)
Changes to Light
-=-=-=-=-=-=-=-= -Changed material unshaded property for an enum, which supports light-only shading -Added a "Mix" shading mode, useful for using lights as masks -Added energy parameter to Light2D
Diffstat (limited to 'drivers/gles2/shaders/canvas.glsl')
-rw-r--r--drivers/gles2/shaders/canvas.glsl12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index baa7e664b5..bb47de6688 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -230,7 +230,11 @@ FRAGMENT_SHADER_CODE
float att=1.0;
- vec4 light = texture2D(light_texture,light_uv_interp.xy) * light_color;
+ vec2 light_uv = light_uv_interp.xy;
+ vec4 light = texture2D(light_texture,light_uv) * light_color;
+#if defined(USE_LIGHT_SHADOW_COLOR)
+ vec4 shadow_color=vec4(0.0,0.0,0.0,0.0);
+#endif
#if defined(USE_LIGHT_SHADER_CODE)
//light is written by the light shader
@@ -362,7 +366,11 @@ LIGHT_SHADER_CODE
#endif
- color.rgb*=shadow_attenuation;
+#if defined(USE_LIGHT_SHADOW_COLOR)
+ color=mix(shadow_color,color,shadow_attenuation);
+#else
+ color.rgb*=shadow_attenuation;
+#endif
//use shadows
#endif
}