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

Method signalDoneOcclusion

plugins/rendermax/renderer_light.cpp:1395–1421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1393 }
1394}
1395void lightThreadDispatch::signalDoneOcclusion()
1396{
1397 {
1398 std::lock_guard<std::mutex> guardWrite(writeLock);
1399 writeCount=0;
1400 }
1401 std::lock_guard<std::mutex> guard1(occlusionMutex);
1402 std::lock_guard<std::mutex> guard2(unprocessedMutex);
1403 while(!unprocessed.empty())
1404 unprocessed.pop();
1405 viewPort=getMapViewport();
1406 int threadCount=threadPool.size();
1407 int w=viewPort.second.x-viewPort.first.x;
1408 int slicew=w/threadCount;
1409 for(int i=0;i<threadCount;i++)
1410 {
1411 rect2d area=viewPort;
1412 area.first.x=viewPort.first.x+i*slicew;
1413 if(i==threadCount-1)
1414 area.second.x=viewPort.second.x; //fix, when area is even number or sth.
1415 else
1416 area.second.x=viewPort.first.x+(i+1)*slicew;
1417 unprocessed.push(area);
1418 }
1419 occlusionReady=true;
1420 occlusionDone.notify_all();
1421}
1422
1423lightThreadDispatch::lightThreadDispatch( lightingEngineViewscreen* p ):parent(p),lights(parent->lights),
1424 occlusionReady(false),occlusion(parent->ocupancy),num_diffusion(parent->num_diffuse),

Callers 1

calculateMethod · 0.80

Calls 3

getMapViewportFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected