MCPcopy Create free account
hub / github.com/DFHack/dfhack / calculate

Method calculate

plugins/rendermax/renderer_light.cpp:277–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275 }
276}
277void lightingEngineViewscreen::calculate()
278{
279 if(lightMap.size()!=myRenderer->lightGrid.size())
280 {
281 reinit();
282 myRenderer->invalidate();//needs a lock?
283 }
284 rect2d vp=getMapViewport();
285 const rgbf dim(levelDim,levelDim,levelDim);
286 lightMap.assign(lightMap.size(),rgbf(1,1,1));
287 lights.assign(lights.size(),lightSource());
288 for(int i=vp.first.x;i<vp.second.x;i++)
289 for(int j=vp.first.y;j<vp.second.y;j++)
290 {
291 lightMap[getIndex(i,j)]=dim;
292 }
293 doOcupancyAndLights();
294 threading.signalDoneOcclusion();
295 threading.waitForWrites();
296}
297void lightingEngineViewscreen::updateWindow()
298{
299 std::lock_guard<std::mutex> guard{myRenderer->dataMutex};

Callers 2

Calls 7

getMapViewportFunction · 0.85
rgbfClass · 0.85
lightSourceClass · 0.85
signalDoneOcclusionMethod · 0.80
waitForWritesMethod · 0.80
sizeMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected