cesium-native 0.43.0
Loading...
Searching...
No Matches
OctreeAvailability.h
1#pragma once
2
3#include "Availability.h"
4#include "Library.h"
5#include "OctreeTileID.h"
6#include "TileAvailabilityFlags.h"
7
8#include <cstddef>
9#include <memory>
10#include <span>
11#include <vector>
12
13namespace CesiumGeometry {
14
19class CESIUMGEOMETRY_API OctreeAvailability final {
20public:
27 OctreeAvailability(uint32_t subtreeLevels, uint32_t maximumLevel) noexcept;
28
38 uint8_t computeAvailability(const OctreeTileID& tileID) const noexcept;
39
50 const OctreeTileID& tileID,
51 AvailabilitySubtree&& newSubtree) noexcept;
52
68 const OctreeTileID& tileID,
69 const AvailabilityNode* pNode) const noexcept;
70
87 addNode(const OctreeTileID& tileID, AvailabilityNode* pParentNode) noexcept;
88
100 AvailabilityNode* pNode,
101 AvailabilitySubtree&& newSubtree) noexcept;
118 std::optional<uint32_t> findChildNodeIndex(
119 const OctreeTileID& tileID,
120 const AvailabilityNode* pParentNode) const;
121
138 const OctreeTileID& tileID,
139 AvailabilityNode* pParentNode) const;
140
146 constexpr inline uint32_t getSubtreeLevels() const noexcept {
147 return this->_subtreeLevels;
148 }
149
155 constexpr inline uint32_t getMaximumLevel() const noexcept {
156 return this->_maximumLevel;
157 }
158
164 AvailabilityNode* getRootNode() noexcept { return this->_pRoot.get(); }
165
166private:
167 uint32_t _subtreeLevels;
168 uint32_t _maximumLevel;
169 uint32_t _maximumChildrenSubtrees;
170 std::unique_ptr<AvailabilityNode> _pRoot;
171};
172
173} // namespace CesiumGeometry
An availability tree for an octree, where availability can be stored and computed based on OctreeTile...
OctreeAvailability(uint32_t subtreeLevels, uint32_t maximumLevel) noexcept
Constructs a new instance.
std::optional< uint32_t > findChildNodeIndex(const OctreeTileID &tileID, const AvailabilityNode *pParentNode) const
Find the child node index corresponding to this tile ID and parent node.
bool addLoadedSubtree(AvailabilityNode *pNode, AvailabilitySubtree &&newSubtree) noexcept
Attempts to add a loaded subtree onto the given node.
AvailabilityNode * findChildNode(const OctreeTileID &tileID, AvailabilityNode *pParentNode) const
Find the child node corresponding to this tile ID and parent node.
constexpr uint32_t getSubtreeLevels() const noexcept
Gets the number of levels in each subtree.
constexpr uint32_t getMaximumLevel() const noexcept
Gets the index of the maximum level in this implicit tileset.
uint8_t computeAvailability(const OctreeTileID &tileID, const AvailabilityNode *pNode) const noexcept
Determines the currently known availability status of the given tile.
AvailabilityNode * addNode(const OctreeTileID &tileID, AvailabilityNode *pParentNode) noexcept
Attempts to add a child subtree node onto the given parent node.
uint8_t computeAvailability(const OctreeTileID &tileID) const noexcept
Determines the currently known availability status of the given tile.
bool addSubtree(const OctreeTileID &tileID, AvailabilitySubtree &&newSubtree) noexcept
Attempts to add an availability subtree into the existing overall availability tree.
AvailabilityNode * getRootNode() noexcept
Gets a pointer to the root subtree node of this implicit tileset.
Basic geometry classes for Cesium.
Availability nodes wrap AvailabilitySubtree objects and link them together to form a downwardly trave...
The subtree data for an AvailabilityNode, containing information on tile, content,...
A structure serving as a unique identifier for a node in an octree.