cesium-native 0.48.0
Loading...
Searching...
No Matches
SubtreeAvailability.h
1#pragma once
2
3#include <Cesium3DTiles/Subtree.h>
4#include <CesiumAsync/Future.h>
5#include <CesiumAsync/IAssetAccessor.h>
6
7#include <optional>
8
9namespace CesiumGeometry {
10struct QuadtreeTileID;
11struct OctreeTileID;
12} // namespace CesiumGeometry
13
14namespace Cesium3DTiles {
15struct ImplicitTiling;
16} // namespace Cesium3DTiles
17
18namespace Cesium3DTilesContent {
19
34
40public:
51 static std::optional<SubtreeAvailability> fromSubtree(
52 ImplicitTileSubdivisionScheme subdivisionScheme,
53 uint32_t levelsInSubtree,
54 Cesium3DTiles::Subtree&& subtree) noexcept;
55
67 static std::optional<SubtreeAvailability> createEmpty(
68 ImplicitTileSubdivisionScheme subdivisionScheme,
69 uint32_t levelsInSubtree,
70 bool setTilesAvailable) noexcept;
71
91 ImplicitTileSubdivisionScheme subdivisionScheme,
92 uint32_t levelsInSubtree,
93 const CesiumAsync::AsyncSystem& asyncSystem,
94 const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
95 const std::shared_ptr<spdlog::logger>& pLogger,
96 const std::string& subtreeUrl,
97 const std::vector<CesiumAsync::IAssetAccessor::THeader>& requestHeaders);
98
110
119 std::span<std::byte> view;
120 };
121
127 std::variant<SubtreeConstantAvailability, SubtreeBufferViewAvailability>;
128
145 ImplicitTileSubdivisionScheme subdivisionScheme,
146 uint32_t levelsInSubtree,
147 AvailabilityView tileAvailability,
148 AvailabilityView subtreeAvailability,
149 std::vector<AvailabilityView>&& contentAvailability,
150 Cesium3DTiles::Subtree&& subtree);
151
160 const CesiumGeometry::QuadtreeTileID& subtreeId,
161 const CesiumGeometry::QuadtreeTileID& tileId) const noexcept;
162
171 const CesiumGeometry::OctreeTileID& subtreeId,
172 const CesiumGeometry::OctreeTileID& tileId) const noexcept;
173
184 uint32_t relativeTileLevel,
185 uint64_t relativeTileMortonId) const noexcept;
186
195 const CesiumGeometry::QuadtreeTileID& subtreeId,
196 const CesiumGeometry::QuadtreeTileID& tileId,
197 bool isAvailable) noexcept;
198
207 const CesiumGeometry::OctreeTileID& subtreeId,
208 const CesiumGeometry::OctreeTileID& tileId,
209 bool isAvailable) noexcept;
210
222 uint32_t relativeTileLevel,
223 uint64_t relativeTileMortonId,
224 bool isAvailable) noexcept;
225
235 const CesiumGeometry::QuadtreeTileID& subtreeId,
236 const CesiumGeometry::QuadtreeTileID& tileId,
237 uint64_t contentId) const noexcept;
238
248 const CesiumGeometry::OctreeTileID& subtreeId,
249 const CesiumGeometry::OctreeTileID& tileId,
250 uint64_t contentId) const noexcept;
251
263 uint32_t relativeTileLevel,
264 uint64_t relativeTileMortonId,
265 uint64_t contentId) const noexcept;
266
277 const CesiumGeometry::QuadtreeTileID& subtreeId,
278 const CesiumGeometry::QuadtreeTileID& tileId,
279 uint64_t contentId,
280 bool isAvailable) noexcept;
281
292 const CesiumGeometry::OctreeTileID& subtreeId,
293 const CesiumGeometry::OctreeTileID& tileId,
294 uint64_t contentId,
295 bool isAvailable) noexcept;
296
310 uint32_t relativeTileLevel,
311 uint64_t relativeTileMortonId,
312 uint64_t contentId,
313 bool isAvailable) noexcept;
314
327 const CesiumGeometry::QuadtreeTileID& thisSubtreeID,
328 const CesiumGeometry::QuadtreeTileID& checkSubtreeID) const noexcept;
329
342 const CesiumGeometry::OctreeTileID& thisSubtreeID,
343 const CesiumGeometry::OctreeTileID& checkSubtreeID) const noexcept;
344
356 bool isSubtreeAvailable(uint64_t relativeSubtreeMortonId) const noexcept;
357
371 const CesiumGeometry::QuadtreeTileID& thisSubtreeID,
372 const CesiumGeometry::QuadtreeTileID& setSubtreeID,
373 bool isAvailable) noexcept;
374
388 const CesiumGeometry::OctreeTileID& thisSubtreeID,
389 const CesiumGeometry::OctreeTileID& setSubtreeID,
390 bool isAvailable) noexcept;
391
405 uint64_t relativeSubtreeMortonId,
406 bool isAvailable) noexcept;
407
411 const Cesium3DTiles::Subtree& getSubtree() const noexcept {
412 return this->_subtree;
413 }
414
415private:
416 bool isAvailable(
417 uint32_t relativeTileLevel,
418 uint64_t relativeTileMortonId,
419 const AvailabilityView& availabilityView) const noexcept;
420 void setAvailable(
421 uint32_t relativeTileLevel,
422 uint64_t relativeTileMortonId,
423 AvailabilityView& availabilityView,
424 Cesium3DTiles::Availability& availability,
425 bool isAvailable) noexcept;
426
427 bool isAvailableUsingBufferView(
428 uint64_t numOfTilesFromRootToParentLevel,
429 uint64_t relativeTileMortonId,
430 const AvailabilityView& availabilityView) const noexcept;
431 void setAvailableUsingBufferView(
432 uint64_t numOfTilesFromRootToParentLevel,
433 uint64_t relativeTileMortonId,
434 AvailabilityView& availabilityView,
435 bool isAvailable) noexcept;
436
437 void updateAvailabilityViews();
438
439 void convertConstantAvailabilityToBitstream(
440 Cesium3DTiles::Subtree& subtree,
441 uint64_t numberOfTiles,
443 Cesium3DTiles::Availability& availability);
444
445 uint32_t _powerOf2;
446 uint32_t _levelsInSubtree;
447 Cesium3DTiles::Subtree _subtree;
448 uint32_t _childCount;
449 AvailabilityView _tileAvailability;
450 AvailabilityView _subtreeAvailability;
451 std::vector<AvailabilityView> _contentAvailability;
452};
453} // namespace Cesium3DTilesContent
void setSubtreeAvailable(const CesiumGeometry::OctreeTileID &thisSubtreeID, const CesiumGeometry::OctreeTileID &setSubtreeID, bool isAvailable) noexcept
Sets the availability state of the child octree rooted at the given tile.
static CesiumAsync::Future< std::optional< SubtreeAvailability > > loadSubtree(ImplicitTileSubdivisionScheme subdivisionScheme, uint32_t levelsInSubtree, const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const std::shared_ptr< spdlog::logger > &pLogger, const std::string &subtreeUrl, const std::vector< CesiumAsync::IAssetAccessor::THeader > &requestHeaders)
Asynchronously loads a subtree from a URL. The resource downloaded from the URL may be either a JSON ...
SubtreeAvailability(ImplicitTileSubdivisionScheme subdivisionScheme, uint32_t levelsInSubtree, AvailabilityView tileAvailability, AvailabilityView subtreeAvailability, std::vector< AvailabilityView > &&contentAvailability, Cesium3DTiles::Subtree &&subtree)
Constructs a new instance.
bool isTileAvailable(uint32_t relativeTileLevel, uint64_t relativeTileMortonId) const noexcept
Determines if a given tile in the subtree is available.
std::variant< SubtreeConstantAvailability, SubtreeBufferViewAvailability > AvailabilityView
A mechanism for accessing availability information. It may be a constant value, or it may be read fro...
bool isContentAvailable(const CesiumGeometry::OctreeTileID &subtreeId, const CesiumGeometry::OctreeTileID &tileId, uint64_t contentId) const noexcept
Determines if content for a given tile in the octree is available.
void setTileAvailable(const CesiumGeometry::OctreeTileID &subtreeId, const CesiumGeometry::OctreeTileID &tileId, bool isAvailable) noexcept
Sets the availability state of a given tile in the octree.
bool isSubtreeAvailable(uint64_t relativeSubtreeMortonId) const noexcept
Determines if the subtree rooted at the given tile is available.
bool isTileAvailable(const CesiumGeometry::OctreeTileID &subtreeId, const CesiumGeometry::OctreeTileID &tileId) const noexcept
Determines if a given tile in the octree is available.
void setContentAvailable(const CesiumGeometry::OctreeTileID &subtreeId, const CesiumGeometry::OctreeTileID &tileId, uint64_t contentId, bool isAvailable) noexcept
Sets the availability state of the content for a given tile in the octree.
bool isContentAvailable(const CesiumGeometry::QuadtreeTileID &subtreeId, const CesiumGeometry::QuadtreeTileID &tileId, uint64_t contentId) const noexcept
Determines if content for a given tile in the quadtree is available.
static std::optional< SubtreeAvailability > fromSubtree(ImplicitTileSubdivisionScheme subdivisionScheme, uint32_t levelsInSubtree, Cesium3DTiles::Subtree &&subtree) noexcept
Creates an instance from a Subtree.
bool isContentAvailable(uint32_t relativeTileLevel, uint64_t relativeTileMortonId, uint64_t contentId) const noexcept
Determines if content for a given tile in the subtree is available.
void setContentAvailable(uint32_t relativeTileLevel, uint64_t relativeTileMortonId, uint64_t contentId, bool isAvailable) noexcept
Sets the availability state of the content for a given tile in the subtree.
bool isTileAvailable(const CesiumGeometry::QuadtreeTileID &subtreeId, const CesiumGeometry::QuadtreeTileID &tileId) const noexcept
Determines if a given tile in the quadtree is available.
void setTileAvailable(const CesiumGeometry::QuadtreeTileID &subtreeId, const CesiumGeometry::QuadtreeTileID &tileId, bool isAvailable) noexcept
Sets the availability state of a given tile in the quadtree.
void setContentAvailable(const CesiumGeometry::QuadtreeTileID &subtreeId, const CesiumGeometry::QuadtreeTileID &tileId, uint64_t contentId, bool isAvailable) noexcept
Sets the availability state of the content for a given tile in the quadtree.
void setSubtreeAvailable(const CesiumGeometry::QuadtreeTileID &thisSubtreeID, const CesiumGeometry::QuadtreeTileID &setSubtreeID, bool isAvailable) noexcept
Sets the availability state of the child quadtree rooted at the given tile.
static std::optional< SubtreeAvailability > createEmpty(ImplicitTileSubdivisionScheme subdivisionScheme, uint32_t levelsInSubtree, bool setTilesAvailable) noexcept
Creates an empty instance with the specified tile availability. All content and subtrees are initiall...
bool isSubtreeAvailable(const CesiumGeometry::QuadtreeTileID &thisSubtreeID, const CesiumGeometry::QuadtreeTileID &checkSubtreeID) const noexcept
Determines if the subtree rooted at the given tile is available.
const Cesium3DTiles::Subtree & getSubtree() const noexcept
Gets the subtree that this instance queries and modifies.
bool isSubtreeAvailable(const CesiumGeometry::OctreeTileID &thisSubtreeID, const CesiumGeometry::OctreeTileID &checkSubtreeID) const noexcept
Determines if the subtree rooted at the given tile is available.
void setSubtreeAvailable(uint64_t relativeSubtreeMortonId, bool isAvailable) noexcept
Sets the availability state of the child subtree rooted at the given tile.
void setTileAvailable(uint32_t relativeTileLevel, uint64_t relativeTileMortonId, bool isAvailable) noexcept
Sets the availability state of a given tile in the subtree.
A system for managing asynchronous requests and tasks.
Definition AsyncSystem.h:36
A value that will be available in the future, as produced by AsyncSystem.
Definition Future.h:29
Classes that support loading and converting 3D Tiles tile content.
ImplicitTileSubdivisionScheme
Indicates how an implicit tile is subdivided.
@ Octree
Implicit tiles are divided into eight children, forming an octree.
@ Quadtree
Implicit tiles are divided into four children, forming a quadree.
Classes for using 3D Tiles.
Definition Buffer.h:7
Basic geometry classes for Cesium.
An AvailabilityView that accesses availability information from a bitstream.
std::span< std::byte > view
The buffer from which to read and write availability information.
An AvailibilityView that indicates that either all tiles are available or all tiles are unavailable.
bool constant
True if all tiles are availabile, false if all tiles are unavailable.
An object describing the availability of a set of elements.
This object allows a tile to be implicitly subdivided. Tile and content availability and metadata is ...
An object describing the availability of tiles and content in a subtree, as well as availability of c...
Definition Subtree.h:24
A structure serving as a unique identifier for a node in an octree.
Uniquely identifies a node in a quadtree.