| 1452 | } |
| 1453 | |
| 1454 | bool WorldClient::waitForLighting(WorldRenderData* renderData) { |
| 1455 | MutexLocker prepLocker(m_lightMapPrepMutex); |
| 1456 | MutexLocker lightMapLocker(m_lightMapMutex); |
| 1457 | if (renderData && !m_lightMap.empty()) { |
| 1458 | for (auto& previewTile : m_previewTiles) { |
| 1459 | if (previewTile.updateLight) { |
| 1460 | Vec2I lightArrayPos = m_geometry.diff(previewTile.position, m_lightMinPosition); |
| 1461 | if (lightArrayPos[0] >= 0 && lightArrayPos[0] < (int)m_lightMap.width() |
| 1462 | && lightArrayPos[1] >= 0 && lightArrayPos[1] < (int)m_lightMap.height()) |
| 1463 | m_lightMap.set(lightArrayPos[0], lightArrayPos[1], Color::v3bToFloat(previewTile.light)); |
| 1464 | } |
| 1465 | } |
| 1466 | renderData->lightMap = std::move(m_lightMap); |
| 1467 | renderData->lightMinPosition = m_lightMinPosition; |
| 1468 | return true; |
| 1469 | } |
| 1470 | return false; |
| 1471 | } |
| 1472 | |
| 1473 | WorldClient::BroadcastCallback& WorldClient::broadcastCallback() { |
| 1474 | return m_broadcastCallback; |