cesium-native 0.43.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
28
32 Octree
33};
34
40public:
51 static std::optional<SubtreeAvailability> fromSubtree(
52 ImplicitTileSubdivisionScheme subdivisionScheme,
53 uint32_t levelsInSubtree,
54 Cesium3DTiles::Subtree&& subtree) noexcept;
55
66 static std::optional<SubtreeAvailability> createEmpty(
67 ImplicitTileSubdivisionScheme subdivisionScheme,
68 uint32_t levelsInSubtree) noexcept;
69
89 ImplicitTileSubdivisionScheme subdivisionScheme,
90 uint32_t levelsInSubtree,
91 const CesiumAsync::AsyncSystem& asyncSystem,
92 const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
93 const std::shared_ptr<spdlog::logger>& pLogger,
94 const std::string& subtreeUrl,
95 const std::vector<CesiumAsync::IAssetAccessor::THeader>& requestHeaders);
96
108
117 std::span<std::byte> view;
118 };
119
125 std::variant<SubtreeConstantAvailability, SubtreeBufferViewAvailability>;
126
143 ImplicitTileSubdivisionScheme subdivisionScheme,
144 uint32_t levelsInSubtree,
145 AvailabilityView tileAvailability,
146 AvailabilityView subtreeAvailability,
147 std::vector<AvailabilityView>&& contentAvailability,
148 Cesium3DTiles::Subtree&& subtree);
149
158 const CesiumGeometry::QuadtreeTileID& subtreeId,
159 const CesiumGeometry::QuadtreeTileID& tileId) const noexcept;
160
169 const CesiumGeometry::OctreeTileID& subtreeId,
170 const CesiumGeometry::OctreeTileID& tileId) const noexcept;
171
182 uint32_t relativeTileLevel,
183 uint64_t relativeTileMortonId) const noexcept;
184
193 const CesiumGeometry::QuadtreeTileID& subtreeId,
194 const CesiumGeometry::QuadtreeTileID& tileId,
195 bool isAvailable) noexcept;
196
205 const CesiumGeometry::OctreeTileID& subtreeId,
206 const CesiumGeometry::OctreeTileID& tileId,
207 bool isAvailable) noexcept;
208
220 uint32_t relativeTileLevel,
221 uint64_t relativeTileMortonId,
222 bool isAvailable) noexcept;
223
233 const CesiumGeometry::QuadtreeTileID& subtreeId,
234 const CesiumGeometry::QuadtreeTileID& tileId,
235 uint64_t contentId) const noexcept;
236
246 const CesiumGeometry::OctreeTileID& subtreeId,
247 const CesiumGeometry::OctreeTileID& tileId,
248 uint64_t contentId) const noexcept;
249
261 uint32_t relativeTileLevel,
262 uint64_t relativeTileMortonId,
263 uint64_t contentId) const noexcept;
264
275 const CesiumGeometry::QuadtreeTileID& subtreeId,
276 const CesiumGeometry::QuadtreeTileID& tileId,
277 uint64_t contentId,
278 bool isAvailable) noexcept;
279
290 const CesiumGeometry::OctreeTileID& subtreeId,
291 const CesiumGeometry::OctreeTileID& tileId,
292 uint64_t contentId,
293 bool isAvailable) noexcept;
294
308 uint32_t relativeTileLevel,
309 uint64_t relativeTileMortonId,
310 uint64_t contentId,
311 bool isAvailable) noexcept;
312
325 const CesiumGeometry::QuadtreeTileID& thisSubtreeID,
326 const CesiumGeometry::QuadtreeTileID& checkSubtreeID) const noexcept;
327
340 const CesiumGeometry::OctreeTileID& thisSubtreeID,
341 const CesiumGeometry::OctreeTileID& checkSubtreeID) const noexcept;
342
354 bool isSubtreeAvailable(uint64_t relativeSubtreeMortonId) const noexcept;
355
369 const CesiumGeometry::QuadtreeTileID& thisSubtreeID,
370 const CesiumGeometry::QuadtreeTileID& setSubtreeID,
371 bool isAvailable) noexcept;
372
386 const CesiumGeometry::OctreeTileID& thisSubtreeID,
387 const CesiumGeometry::OctreeTileID& setSubtreeID,
388 bool isAvailable) noexcept;
389
403 uint64_t relativeSubtreeMortonId,
404 bool isAvailable) noexcept;
405
409 const Cesium3DTiles::Subtree& getSubtree() const noexcept {
410 return this->_subtree;
411 }
412
413private:
414 bool isAvailable(
415 uint32_t relativeTileLevel,
416 uint64_t relativeTileMortonId,
417 const AvailabilityView& availabilityView) const noexcept;
418 void setAvailable(
419 uint32_t relativeTileLevel,
420 uint64_t relativeTileMortonId,
421 AvailabilityView& availabilityView,
422 bool isAvailable) noexcept;
423
424 bool isAvailableUsingBufferView(
425 uint64_t numOfTilesFromRootToParentLevel,
426 uint64_t relativeTileMortonId,
427 const AvailabilityView& availabilityView) const noexcept;
428 void setAvailableUsingBufferView(
429 uint64_t numOfTilesFromRootToParentLevel,
430 uint64_t relativeTileMortonId,
431 AvailabilityView& availabilityView,
432 bool isAvailable) noexcept;
433
434 uint32_t _powerOf2;
435 uint32_t _levelsInSubtree;
436 Cesium3DTiles::Subtree _subtree;
437 uint32_t _childCount;
438 AvailabilityView _tileAvailability;
439 AvailabilityView _subtreeAvailability;
440 std::vector<AvailabilityView> _contentAvailability;
441};
442} // namespace Cesium3DTilesContent
Supports querying and modifying the various types of availablity information included in a Cesium3DTi...
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.
static std::optional< SubtreeAvailability > createEmpty(ImplicitTileSubdivisionScheme subdivisionScheme, uint32_t levelsInSubtree) noexcept
Creates an empty instance with all tiles initially available, while all content and subtrees are init...
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.
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 Promise.h:11
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 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.