summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_gles2.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-09 02:34:56 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-09 02:34:56 -0300
commit09489e3a78de39bb4d8690f3c65f8a5e7a56a95e (patch)
treeb6207118763b8f1ec81c9d5b7e483813363253c2 /drivers/gles2/rasterizer_gles2.cpp
parent2c2894ceb674927a35d2798b3e63adabdb020077 (diff)
lot of work on 2D lighting and isometric maps
added a new demo, isometric_light that does full isometric sorting, lights, shadows, etc.
Diffstat (limited to 'drivers/gles2/rasterizer_gles2.cpp')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index e167b647e7..b6444b2978 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -9276,7 +9276,10 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
normal_flip=Vector2(1,1);
}
- canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS,light->shadow_buffer.is_valid());
+
+ bool has_shadow = light->shadow_buffer.is_valid() && ci->light_mask&light->item_shadow_mask;
+
+ canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS,has_shadow);
bool light_rebind = canvas_shader.bind();
@@ -9302,7 +9305,9 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_POS,light->light_shader_pos);
canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_COLOR,light->color);
canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_HEIGHT,light->height);
- if (light->shadow_buffer.is_valid()) {
+ canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_LOCAL_MATRIX,light->xform_cache.affine_inverse());
+
+ if (has_shadow) {
CanvasLightShadow *cls = canvas_light_shadow_owner.get(light->shadow_buffer);
glActiveTexture(GL_TEXTURE0+max_texture_units-3);
@@ -9313,7 +9318,6 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
canvas_shader.set_uniform(CanvasShaderGLES2::SHADOW_TEXTURE,max_texture_units-3);
canvas_shader.set_uniform(CanvasShaderGLES2::SHADOW_MATRIX,light->shadow_matrix_cache);
- canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_LOCAL_MATRIX,light->xform_cache.affine_inverse());
canvas_shader.set_uniform(CanvasShaderGLES2::SHADOW_ESM_MULTIPLIER,light->shadow_esm_mult);
}