Skip to content

Commit 95f52d6

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 790bb78 commit 95f52d6

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
- Added an overload of `Math::equalsEpsilon` for glm matrices.
5959
- A tile's bounding volume and content bounding volume are now included in `TileLoadResult` for use in `prepareInLoadThread`.
6060
- Added `convertAccessorTypeToPropertyType` and `convertPropertyTypeToAccessorType` to `CesiumGltf::PropertyType`.
61+
- 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.
6162

6263
##### Fixes :wrench:
6364

Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,17 @@ class CESIUM3DTILESSELECTION_API Tile final {
501501
*/
502502
bool isRenderable() const noexcept;
503503

504+
/**
505+
* @brief Set by the render engine to notify when a tile needs post-load
506+
* processing before being actually renderable, that will have to happen
507+
* over one or more several main thread loop cycles.
508+
* By default, tiles are assumed immediately renderable when they reach
509+
* TileLoadState::Done status. Render engine can toggle readiness off to
510+
* signify that the tile should not be considered renderable until the flag
511+
* is turned on again.
512+
*/
513+
void setRenderEngineReadiness(bool const renderEngineReady) noexcept;
514+
504515
/**
505516
* @brief Determines if this tile has mesh content.
506517
*/
@@ -687,6 +698,7 @@ class CESIUM3DTILESSELECTION_API Tile final {
687698
TilesetContentLoader* _pLoader;
688699
TileLoadState _loadState;
689700
bool _mightHaveLatentChildren;
701+
bool _renderEngineReadiness = true; ///< Relevant only when _loadState is Done
690702

691703
// mapped raster overlay
692704
std::vector<RasterMappedTo3DTile> _rasterTiles;

Cesium3DTilesSelection/src/Tile.cpp

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

222222
if (getState() == TileLoadState::Done) {
223+
if (!_renderEngineReadiness)
224+
return false;
223225
// An unconditionally-refined tile is never renderable... UNLESS it has no
224226
// children, in which case waiting longer will be futile.
225227
if (!getUnconditionallyRefine() || this->_children.empty()) {
@@ -235,6 +237,10 @@ bool Tile::isRenderable() const noexcept {
235237
return false;
236238
}
237239

240+
void Tile::setRenderEngineReadiness(bool const renderEngineReady) noexcept {
241+
_renderEngineReadiness = renderEngineReady;
242+
}
243+
238244
bool Tile::isRenderContent() const noexcept {
239245
return this->_content.isRenderContent();
240246
}

0 commit comments

Comments
 (0)