| 275 | } |
| 276 | } |
| 277 | void 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 | } |
| 297 | void lightingEngineViewscreen::updateWindow() |
| 298 | { |
| 299 | std::lock_guard<std::mutex> guard{myRenderer->dataMutex}; |
no test coverage detected