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); 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(); reinit();
defaultSettings(); defaultSettings();
@ -429,9 +429,9 @@ void lightingEngineViewscreen::updateWindow()
return; return;
} }
//if(showOcupancy) if(doDebug)
//std::swap(ocupancy,myRenderer->lightGrid); std::swap(ocupancy,myRenderer->lightGrid);
//else else
std::swap(lightMap,myRenderer->lightGrid); std::swap(lightMap,myRenderer->lightGrid);
rect2d vp=getMapViewport(); rect2d vp=getMapViewport();

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

@ -49,7 +49,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
" rendermax lua\n" " rendermax lua\n"
" rendermax light - lighting engine\n" " rendermax light - lighting engine\n"
" rendermax light reload - reload the settings file\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" " rendermax disable\n"
)); ));
return CR_OK; return CR_OK;
@ -385,6 +386,13 @@ static command_result rendermax(color_ostream &out, vector <string> & parameters
engine->setHour(h); engine->setHour(h);
} }
} }
else if(parameters[1]=="occlusionON")
{
engine->debug(true);
}else if(parameters[1]=="occlusionOFF")
{
engine->debug(false);
}
} }
else else
out.printerr("Light mode already enabled"); out.printerr("Light mode already enabled");