| 80 | } |
| 81 | |
| 82 | void TileManager::loadTilesForFieldOfView(const QRectF& FOV, const unsigned int level) { |
| 83 | if (level > _lastRenderLevel) { |
| 84 | return; |
| 85 | } |
| 86 | if (_ioThread) { |
| 87 | QPoint topLeftTile = this->pixelCoordinatesToTileCoordinates(FOV.topLeft(), level); |
| 88 | QPoint bottomRightTile = this->pixelCoordinatesToTileCoordinates(FOV.bottomRight(), level); |
| 89 | QRect FOVTile = QRect(topLeftTile, bottomRightTile); |
| 90 | QPoint nrTiles = getLevelTiles(level); |
| 91 | float levelDownsample = _levelDownsamples[level]; |
| 92 | if (FOVTile != _lastFOV || level != _lastLevel) { |
| 93 | _lastLevel = level; |
| 94 | _lastFOV = FOVTile; |
| 95 | for (int x = topLeftTile.x(); x <= bottomRightTile.x(); ++x) { |
| 96 | if (x >= 0 && x <= nrTiles.x()) { |
| 97 | for (int y = topLeftTile.y(); y <= bottomRightTile.y(); ++y) { |
| 98 | if (y >= 0 && y <= nrTiles.y()) { |
| 99 | if (providesCoverage(level, x, y) < 1) { |
| 100 | setCoverage(level, x, y, 1); |
| 101 | _ioThread->addJob(_tileSize, x, y, level); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | void TileManager::updateTileForegounds() { |
| 112 | _ioThread->clearJobs(); |
no test coverage detected