Added occlusionON|occlusionOFF commands

develop
Warmist 2013-06-28 23:34:47 +03:00
parent 368a326b40
commit 269a2680c8
3 changed files with 19 additions and 6 deletions

@ -176,7 +176,7 @@ rect2d getMapViewport()
}
return mkrect_wh(1,1,view_rb,view_height+1);
}
lightingEngineViewscreen::lightingEngineViewscreen(renderer_light* target):lightingEngine(target)
lightingEngineViewscreen::lightingEngineViewscreen(renderer_light* target):lightingEngine(target),doDebug(false)
{
reinit();
defaultSettings();
@ -429,10 +429,10 @@ void lightingEngineViewscreen::updateWindow()
return;
}
//if(showOcupancy)
//std::swap(ocupancy,myRenderer->lightGrid);
//else
std::swap(lightMap,myRenderer->lightGrid);
if(doDebug)
std::swap(ocupancy,myRenderer->lightGrid);
else
std::swap(lightMap,myRenderer->lightGrid);
rect2d vp=getMapViewport();
myRenderer->invalidateRect(vp.first.x,vp.first.y,vp.second.x-vp.first.x,vp.second.y-vp.first.y);

@ -79,6 +79,7 @@ public:
virtual void clear()=0;
virtual void setHour(float h)=0;
virtual void debug(bool enable)=0;
protected:
renderer_light* myRenderer;
};
@ -140,6 +141,8 @@ public:
void loadSettings();
void clear();
void debug(bool enable){doDebug=enable;};
private:
df::coord2d worldToViewportCoord(const df::coord2d& in,const DFHack::rect2d& r,const df::coord2d& window2d) ;
@ -188,6 +191,8 @@ public:
void lightWorkerThread(void * arg);
private:
lightCell getSkyColor(float v);
bool doDebug;
//settings
float daySpeed;
float dayHour; //<0 to cycle

@ -49,7 +49,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
" rendermax lua\n"
" rendermax light - lighting engine\n"
" rendermax light reload - reload the settings file\n"
" rendermax light sun <x>|cycle - set time to x or cycle (same effect if x<0)\n"
" rendermax light sun <x>|cycle - set time to x (in hours) or cycle (same effect if x<0)\n"
" rendermax light occlusionON|occlusionOFF - debug the occlusion map\n"
" rendermax disable\n"
));
return CR_OK;
@ -385,6 +386,13 @@ static command_result rendermax(color_ostream &out, vector <string> & parameters
engine->setHour(h);
}
}
else if(parameters[1]=="occlusionON")
{
engine->debug(true);
}else if(parameters[1]=="occlusionOFF")
{
engine->debug(false);
}
}
else
out.printerr("Light mode already enabled");