Skip to content
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

##### Fixes :wrench:

- Raster tiles are now included in the progress percentage for `Cesium3DTilesSelection::Tileset`. This allows apps that rely on this progress percentage to continue updating their views until all raster tiles have been properly loaded.
- Fixed various bugs with `CesiumRasterOverlays::GeoJsonDocumentRasterOverlay`:
- Line width is now factored in to calculations of what geometry is visible in any given tile, reducing the possibility that certain geometry (like perfectly vertical or horizontal lines) would be incorrectly ignored.
- Geometry near the antimeridian, such as lines that need to wrap around the entire globe, will now render correctly without gaps.
Expand Down
61 changes: 35 additions & 26 deletions Cesium3DTilesSelection/src/TilesetViewGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,10 @@ void TilesetViewGroup::finishFrame(
updateResult.tilesKicked +
this->_tilesAlreadyLoadingOrUnloading;

if (tilesLoading == 0) {
this->_loadProgressPercentage = 100.0f;
} else {
this->_loadProgressPercentage =
100.0f * float(totalTiles - tilesLoading) / float(totalTiles);
}

// aggregate all the credits needed from this tileset for the current frame
const std::shared_ptr<CreditSystem>& pCreditSystem =
tileset.getExternals().pCreditSystem;

if (pCreditSystem) {
this->_currentFrameCredits.setCreditSystem(pCreditSystem);

Expand All @@ -189,36 +183,51 @@ void TilesetViewGroup::finishFrame(

pActivated->getTileProvider()->addCredits(this->_currentFrameCredits);
}
}

// Add per-tile credits for tiles selected this frame.
for (const Tile::ConstPointer& pTile :
updateResult.tilesToRenderThisFrame) {
const std::vector<RasterMappedTo3DTile>& mappedRasterTiles =
pTile->getMappedRasterTiles();
// raster overlay tile credits
for (const RasterMappedTo3DTile& mappedRasterTile : mappedRasterTiles) {
const RasterOverlayTile* pRasterOverlayTile =
mappedRasterTile.getReadyTile();
if (pRasterOverlayTile != nullptr) {
for (const Credit& credit : pRasterOverlayTile->getCredits()) {
this->_currentFrameCredits.addCreditReference(credit);
}
}
for (const Tile::ConstPointer& pTile : updateResult.tilesToRenderThisFrame) {
// add tile render content credits like gltf copyrights
const TileRenderContent* pRenderContent =
pTile->getContent().getRenderContent();
if (pCreditSystem && pRenderContent) {
for (const Credit& credit : pRenderContent->getCredits()) {
this->_currentFrameCredits.addCreditReference(credit);
}
}

// content credits like gltf copyrights
const TileRenderContent* pRenderContent =
pTile->getContent().getRenderContent();
if (pRenderContent) {
for (const Credit& credit : pRenderContent->getCredits()) {
// add mapped raster tile credits and tile progress percentage
const std::vector<RasterMappedTo3DTile>& mappedRasterTiles =
pTile->getMappedRasterTiles();
for (const RasterMappedTo3DTile& mappedRasterTile : mappedRasterTiles) {
// add mapped raster tile credits for tiles selected this frame.
const RasterOverlayTile* pRasterOverlayTile =
mappedRasterTile.getReadyTile();
if (pCreditSystem && pRasterOverlayTile != nullptr) {
for (const Credit& credit : pRasterOverlayTile->getCredits()) {
this->_currentFrameCredits.addCreditReference(credit);
}
}

// add the mapped raster tile in the progress percentage.
++totalTiles;
if (mappedRasterTile.getState() !=
RasterMappedTo3DTile::AttachmentState::Attached)
++tilesLoading;
}
}

if (pCreditSystem) {
this->_previousFrameCredits.releaseAllReferences();
std::swap(this->_previousFrameCredits, this->_currentFrameCredits);
}

// update progress percentage
if (tilesLoading == 0) {
this->_loadProgressPercentage = 100.0f;
} else {
this->_loadProgressPercentage =
100.0f * float(totalTiles - tilesLoading) / float(totalTiles);
}
}

float TilesetViewGroup::getPreviousLoadProgressPercentage() const {
Expand Down
Loading