3#include <Cesium3DTilesSelection/BoundingVolume.h>
4#include <Cesium3DTilesSelection/Library.h>
5#include <Cesium3DTilesSelection/RasterMappedTo3DTile.h>
6#include <Cesium3DTilesSelection/TileContent.h>
7#include <Cesium3DTilesSelection/TileID.h>
8#include <Cesium3DTilesSelection/TileRefine.h>
9#include <Cesium3DTilesSelection/TileSelectionState.h>
10#include <CesiumUtility/DoublyLinkedList.h>
11#include <CesiumUtility/IntrusivePointer.h>
13#include <glm/common.hpp>
23#ifdef CESIUM_DEBUG_TILE_UNLOADING
24#include <unordered_map>
31#ifdef CESIUM_DEBUG_TILE_UNLOADING
32class TileReferenceCountTracker {
48 static std::unordered_map<std::string, std::vector<Entry>> _entries;
123class CESIUM3DTILESSELECTION_API
Tile final {
154 const TileID& tileID = {})
noexcept;
177 std::unique_ptr<TileExternalContent>&& externalContent)
noexcept;
256 return std::span<Tile>(this->_children);
261 return std::span<const Tile>(this->_children);
292 return this->_boundingVolume;
303 this->_boundingVolume = value;
318 return this->_viewerRequestVolume;
330 this->_viewerRequestVolume = value;
352 this->_geometricError = value;
383 return glm::isinf(this->_geometricError);
392 this->_geometricError = std::numeric_limits<double>::infinity();
425 const glm::dmat4x4&
getTransform() const noexcept {
return this->_transform; }
435 this->_transform = value;
467 const std::optional<BoundingVolume>&
469 return this->_contentBoundingVolume;
481 const std::optional<BoundingVolume>& value)
noexcept {
482 this->_contentBoundingVolume = value;
495 return this->_rasterTiles;
499 const std::vector<RasterMappedTo3DTile>&
501 return this->_rasterTiles;
653 struct TileConstructorImpl {};
655 typename... TileContentArgs,
656 typename TileContentEnable = std::enable_if_t<
657 std::is_constructible_v<
TileContent, TileContentArgs&&...>,
660 TileConstructorImpl tag,
664 TileContentArgs&&... args);
666 void setParent(
Tile* pParent)
noexcept;
685 bool getMightHaveLatentChildren() const noexcept;
687 void setMightHaveLatentChildren(
bool mightHaveLatentChildren) noexcept;
699 double _geometricError;
701 glm::dmat4x4 _transform;
708 bool _mightHaveLatentChildren;
713 mutable int32_t _referenceCount;
715 friend class TilesetContentManager;
716 friend class MockTilesetContentManagerTestFixture;
An abstract class that allows modifying a tile's glTF model after it has been loaded.
The result of applying a CesiumRasterOverlays::RasterOverlayTile to geometry.
A tile content container that can store and query the content type that is currently being owned by t...
Tile(TilesetContentLoader *pLoader, const TileID &tileID={}) noexcept
Construct a tile with unknown content and a loader that is used to load the content of this tile....
const std::optional< BoundingVolume > & getViewerRequestVolume() const noexcept
Returns the viewer request volume of this tile.
const std::optional< BoundingVolume > & getContentBoundingVolume() const noexcept
Returns the BoundingVolume of the renderable content of this tile.
const TileID & getTileID() const noexcept
Returns the TileID of this tile.
double getNonZeroGeometricError() const noexcept
Gets the tile's geometric error as if by calling getGeometricError, except that if the error is small...
CesiumUtility::DoublyLinkedList< Tile, &Tile::_unusedTilesLinks > UnusedLinkedList
A CesiumUtility::DoublyLinkedList for tile objects.
const std::vector< RasterMappedTo3DTile > & getMappedRasterTiles() const noexcept
Returns the raster overlay tiles that have been mapped to this tile.
void setGeometricError(double value) noexcept
Set the geometric error of the contents of this tile.
bool isExternalContent() const noexcept
Determines if this tile has external tileset content.
TileLoadState getState() const noexcept
Returns the TileLoadState of this tile.
void setTileID(const TileID &id) noexcept
Set the TileID of this tile.
bool hasReferencingContent() const noexcept
Determines if this tile's getContent counts as a reference to this tile.
int64_t computeByteSize() const noexcept
Determines the number of bytes in this tile's geometry and texture data.
void createChildTiles(std::vector< Tile > &&children)
Assigns the given child tiles to this tile.
bool isRenderContent() const noexcept
Determines if this tile has mesh content.
Tile(TilesetContentLoader *pLoader, const TileID &tileID, std::unique_ptr< TileExternalContent > &&externalContent) noexcept
Construct a tile with an external content and a loader that is associated with this tile....
Tile * getParent() noexcept
Returns the parent of this tile in the tile hierarchy.
bool isRenderable() const noexcept
Determines if this tile is currently renderable.
~Tile() noexcept
Default destructor, which clears all resources associated with this tile.
Tile(TilesetContentLoader *pLoader, const TileID &tileID, TileEmptyContent emptyContent) noexcept
Construct a tile with an empty content and a loader that is associated with this tile....
void clearChildren() noexcept
Clears the children of this tile.
CesiumUtility::IntrusivePointer< Tile > Pointer
A reference counting pointer to a Tile.
std::span< const Tile > getChildren() const noexcept
Returns a view on the children of this tile.
CesiumUtility::IntrusivePointer< const Tile > ConstPointer
A reference counting pointer to a const Tile.
void setRefine(TileRefine value) noexcept
Set the refinement strategy of this tile.
const glm::dmat4x4 & getTransform() const noexcept
Gets the transformation matrix for this tile.
std::span< Tile > getChildren() noexcept
Returns a view on the children of this tile.
TilesetContentLoader * getLoader() const noexcept
get the loader that is used to load the tile content.
void addReference(const char *reason=nullptr) const noexcept
Adds a reference to this tile. A live reference will keep this tile from being destroyed,...
void setTransform(const glm::dmat4x4 &value) noexcept
Set the transformation matrix for this tile.
void setViewerRequestVolume(const std::optional< BoundingVolume > &value) noexcept
Set the viewer request volume of this tile.
bool needsWorkerThreadLoading(const GltfModifier *pModifier) const noexcept
Determines if this tile requires worker-thread loading.
TileRefine getRefine() const noexcept
The refinement strategy of this tile.
std::vector< RasterMappedTo3DTile > & getMappedRasterTiles() noexcept
Returns the raster overlay tiles that have been mapped to this tile.
int32_t getReferenceCount() const noexcept
Gets the current number of references to this tile.
bool needsMainThreadLoading(const GltfModifier *pModifier) const noexcept
Determines if this tile requires main-thread loading.
void releaseReference(const char *reason=nullptr) const noexcept
Removes a reference from this tile. A live reference will keep this tile from being destroyed,...
void setContentBoundingVolume(const std::optional< BoundingVolume > &value) noexcept
Set the BoundingVolume of the renderable content of this tile.
const BoundingVolume & getBoundingVolume() const noexcept
Returns the BoundingVolume of this tile.
void setBoundingVolume(const BoundingVolume &value) noexcept
Set the BoundingVolume of this tile.
void setUnconditionallyRefine() noexcept
Marks that this tile should be unconditionally refined.
bool getUnconditionallyRefine() const noexcept
Returns whether to unconditionally refine this tile.
TileContent & getContent() noexcept
Get the content of the tile.
bool isEmptyContent() const noexcept
Determines if this tile has empty content.
const TileContent & getContent() const noexcept
Get the content of the tile.
double getGeometricError() const noexcept
Returns the geometric error of this tile.
const Tile * getParent() const noexcept
Returns the parent of this tile in the tile hierarchy.
The loader interface to load the tile content.
A smart pointer that calls addReference and releaseReference on the controlled object.
Classes that implement the 3D Tiles standard.
@ ContentLoaded
The tile content has finished loading.
@ Unloading
This tile is in the process of being unloaded, but could not be fully unloaded because an asynchronou...
@ ContentLoading
The tile content is currently being loaded.
@ FailedTemporarily
Something went wrong while loading this tile, but it may be a temporary problem.
@ Unloaded
The tile is not yet loaded at all, beyond the metadata in tileset.json.
@ Failed
Something went wrong while loading this tile and it will not be retried.
@ Done
The tile is completely done loading.
std::variant< CesiumGeometry::BoundingSphere, CesiumGeometry::OrientedBoundingBox, CesiumGeospatial::BoundingRegion, CesiumGeospatial::BoundingRegionWithLooseFittingHeights, CesiumGeospatial::S2CellBoundingVolume, CesiumGeometry::BoundingCylinderRegion > BoundingVolume
A bounding volume.
TileRefine
Refinement strategies for a Cesium3DTilesSelection::Tile.
std::variant< std::string, CesiumGeometry::QuadtreeTileID, CesiumGeometry::OctreeTileID, CesiumGeometry::UpsampledQuadtreeNode > TileID
An identifier for a Tile inside the tile hierarchy.
Utility classes for Cesium.
A content tag that indicates a tile has no content.