MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / waitForLighting

Method waitForLighting

source/game/StarWorldClient.cpp:1454–1471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1452}
1453
1454bool 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
1473WorldClient::BroadcastCallback& WorldClient::broadcastCallback() {
1474 return m_broadcastCallback;

Callers 1

renderMethod · 0.80

Calls 5

emptyMethod · 0.45
diffMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected