summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-30 11:34:24 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-30 11:34:24 -0300
commit5c6b31c024b60ae9c43dc48c04128de99d147f5a (patch)
treea08bb439dc474664cc32370f5553f1ac7a68abc4
parent21939ce08b042b8cfcff16da780a4595aac500cd (diff)
-fixed broken lighting in release version of godot for isometric light demo, fixes #1697
-rw-r--r--demos/2d/isometric_light/character_shder.resbin1150 -> 1152 bytes
-rw-r--r--demos/2d/isometric_light/cubio.scnbin6927 -> 7003 bytes
-rw-r--r--demos/2d/isometric_light/floor_shader.resbin1026 -> 1027 bytes
-rw-r--r--demos/2d/isometric_light/map.scnbin8535 -> 8634 bytes
-rw-r--r--demos/2d/isometric_light/tileset.resbin2775 -> 2781 bytes
-rw-r--r--demos/2d/isometric_light/wall_shader.resbin1684 -> 1687 bytes
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp2
-rw-r--r--servers/visual/visual_server_raster.cpp4
8 files changed, 6 insertions, 0 deletions
diff --git a/demos/2d/isometric_light/character_shder.res b/demos/2d/isometric_light/character_shder.res
index ca221f766c..17cd9ad287 100644
--- a/demos/2d/isometric_light/character_shder.res
+++ b/demos/2d/isometric_light/character_shder.res
Binary files differ
diff --git a/demos/2d/isometric_light/cubio.scn b/demos/2d/isometric_light/cubio.scn
index c8ab7ddd4e..c52b7dfd4b 100644
--- a/demos/2d/isometric_light/cubio.scn
+++ b/demos/2d/isometric_light/cubio.scn
Binary files differ
diff --git a/demos/2d/isometric_light/floor_shader.res b/demos/2d/isometric_light/floor_shader.res
index 446c71d227..c078d27b97 100644
--- a/demos/2d/isometric_light/floor_shader.res
+++ b/demos/2d/isometric_light/floor_shader.res
Binary files differ
diff --git a/demos/2d/isometric_light/map.scn b/demos/2d/isometric_light/map.scn
index c939a4b392..c1d11f8e4c 100644
--- a/demos/2d/isometric_light/map.scn
+++ b/demos/2d/isometric_light/map.scn
Binary files differ
diff --git a/demos/2d/isometric_light/tileset.res b/demos/2d/isometric_light/tileset.res
index 633bdada38..dab6f36f57 100644
--- a/demos/2d/isometric_light/tileset.res
+++ b/demos/2d/isometric_light/tileset.res
Binary files differ
diff --git a/demos/2d/isometric_light/wall_shader.res b/demos/2d/isometric_light/wall_shader.res
index 78c8fe57e1..7e33c26201 100644
--- a/demos/2d/isometric_light/wall_shader.res
+++ b/demos/2d/isometric_light/wall_shader.res
Binary files differ
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 585d512abb..feff49c1de 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -9452,6 +9452,7 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
while(light) {
+
if (ci->light_mask&light->item_mask && p_z>=light->z_min && p_z<=light->z_max && ci->global_rect_cache.intersects_transformed(light->xform_cache,light->rect_cache)) {
//intersects this light
@@ -9489,6 +9490,7 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
}
+
bool has_shadow = light->shadow_buffer.is_valid() && ci->light_mask&light->item_shadow_mask;
canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS,has_shadow);
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 64ddc12513..6556f8bc42 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -7047,17 +7047,20 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
for(Set<Rasterizer::CanvasLight*>::Element *F=E->get().canvas->lights.front();F;F=F->next()) {
+
Rasterizer::CanvasLight* cl=F->get();
if (cl->enabled && cl->texture.is_valid()) {
//not super efficient..
Size2 tsize(rasterizer->texture_get_width(cl->texture),rasterizer->texture_get_height(cl->texture));
tsize*=cl->scale;
+
Vector2 offset=tsize/2.0;
cl->rect_cache=Rect2(-offset+cl->texture_offset,tsize);
cl->xform_cache=xf * cl->xform;
if (clip_rect.intersects_transformed(cl->xform_cache,cl->rect_cache)) {
+
cl->filter_next_ptr=lights;
lights=cl;
cl->texture_cache=NULL;
@@ -7067,6 +7070,7 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
cl->light_shader_xform = (cl->xform_cache * scale).affine_inverse();
cl->light_shader_pos=cl->xform_cache[2];
if (cl->shadow_buffer.is_valid()) {
+
cl->shadows_next_ptr=lights_with_shadow;
if (lights_with_shadow==NULL) {
shadow_rect = cl->xform_cache.xform(cl->rect_cache);