From 2da136116dfa21b515cde77364fabbf3dff04a64 Mon Sep 17 00:00:00 2001 From: Japa Date: Mon, 24 Jun 2013 05:10:01 +0530 Subject: [PATCH 1/2] Added some fast checking for obstacles around lights, resulting in a huge speedup outside. --- plugins/rendermax/renderer_light.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 187b3d2d8..87eb210ad 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -168,8 +168,23 @@ void lightingEngineViewscreen::doFovs() radius*=flicker; power=power*flicker; } - plotCircle(i,j,radius, - std::bind(&lightingEngineViewscreen::doRay,this,power,i,j,_1,_2)); + int surrounds = 0; + lightCell curPower; + + if(lightUpCell(curPower = power, 0, 0,i+0, j+0)) + { + surrounds += lightUpCell(curPower = power, 0, 1,i+0, j+1); + surrounds += lightUpCell(curPower = power, 1, 1,i+1, j+1); + surrounds += lightUpCell(curPower = power, 1, 0,i+1, j+0); + surrounds += lightUpCell(curPower = power, 1,-1,i+1, j-1); + surrounds += lightUpCell(curPower = power, 0,-1,i+0, j-1); + surrounds += lightUpCell(curPower = power,-1,-1,i-1, j-1); + surrounds += lightUpCell(curPower = power,-1, 0,i-1, j+0); + surrounds += lightUpCell(curPower = power,-1, 1,i-1, j+1); + } + if(surrounds) + plotCircle(i,j,radius, + std::bind(&lightingEngineViewscreen::doRay,this,power,i,j,_1,_2)); } } } From b8d2ceb23b7845463e476b16e565d17da5a5dedf Mon Sep 17 00:00:00 2001 From: Japa Date: Mon, 24 Jun 2013 05:35:16 +0530 Subject: [PATCH 2/2] Made the low water check actually use floats. --- plugins/rendermax/renderer_light.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index 87eb210ad..921ea814a 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -321,7 +321,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() } if(d.bits.liquid_type == df::enums::tile_liquid::Water && d.bits.flow_size) { - cellArray[block_x][block_y] *= (lightCell(1,1,1) - (lightCell(1,1,1) - lightCell(0.63f,0.63f,0.75f))*(d.bits.flow_size/7)); + cellArray[block_x][block_y] *= (lightCell(1,1,1) - (lightCell(1,1,1) - lightCell(0.63f,0.63f,0.75f))*((float)d.bits.flow_size/7.0f)); } else if(d.bits.liquid_type == df::enums::tile_liquid::Magma && d.bits.flow_size > 3) { @@ -494,7 +494,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() for(int i=0;iplants.size();i++) { df::plant* cPlant=block->plants[i]; - + df::coord2d pos=cPlant->pos; int wx=pos.x-window_x+vp.first.x; int wy=pos.y-window_y+vp.first.y;