Skip to content

Commit 56287b1

Browse files
committed
Add a "render-readiness" flag on tiles
Render engine or user-developer customizations can toggle it off to delay the point at which the tile can be shown, while waiting for some asynchronous post-processing to finish
1 parent 288d914 commit 56287b1

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
- Added an overload of `Math::equalsEpsilon` for glm matrices.
4242
- A tile's bounding volume and content bounding volume are now included in `TileLoadResult` for use in `prepareInLoadThread`.
4343
- Added `convertAccessorTypeToPropertyType` and `convertPropertyTypeToAccessorType` to `CesiumGltf::PropertyType`.
44+
- Added `Cesium3DTilesSelection::Tile::setRenderEngineReadiness(bool)`: pass false to delay the point at which the tile can be shown, while waiting for some asynchronous post-processing to finish for example.
4445

4546
##### Fixes :wrench:
4647

Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,14 @@ class CESIUM3DTILESSELECTION_API Tile final {
475475
*/
476476
bool isRenderable() const noexcept;
477477

478+
/**
479+
* @brief Normally, tiles are assumed immediately renderable when they reach
480+
* TileLoadState::Done status: render engine can toggle readiness off to
481+
* signify that the tile should not be considered renderable until the flag
482+
* is turned on again.
483+
*/
484+
void setRenderEngineReadiness(bool const renderEngineReady) noexcept;
485+
478486
/**
479487
* @brief Determines if this tile has mesh content.
480488
*/
@@ -660,6 +668,7 @@ class CESIUM3DTILESSELECTION_API Tile final {
660668
TilesetContentLoader* _pLoader;
661669
TileLoadState _loadState;
662670
bool _mightHaveLatentChildren;
671+
bool _renderEngineReadiness = true; ///< Relevant only when _loadState is Done
663672

664673
// mapped raster overlay
665674
std::vector<RasterMappedTo3DTile> _rasterTiles;

Cesium3DTilesSelection/src/Tile.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ bool Tile::isRenderable() const noexcept {
215215
}
216216

217217
if (getState() == TileLoadState::Done) {
218+
if (!_renderEngineReadiness)
219+
return false;
218220
// An unconditionally-refined tile is never renderable... UNLESS it has no
219221
// children, in which case waiting longer will be futile.
220222
if (!getUnconditionallyRefine() || this->_children.empty()) {
@@ -230,6 +232,10 @@ bool Tile::isRenderable() const noexcept {
230232
return false;
231233
}
232234

235+
void Tile::setRenderEngineReadiness(bool const renderEngineReady) noexcept {
236+
_renderEngineReadiness = renderEngineReady;
237+
}
238+
233239
bool Tile::isRenderContent() const noexcept {
234240
return this->_content.isRenderContent();
235241
}

0 commit comments

Comments
 (0)