cesium-native 0.43.0
Loading...
Searching...
No Matches
TileOcclusionRendererProxy.h
1#pragma once
2
3#include "Library.h"
4#include "Tile.h"
5
6#include <cstdint>
7#include <unordered_map>
8#include <vector>
9
10namespace Cesium3DTilesSelection {
11
15enum class CESIUM3DTILESSELECTION_API TileOcclusionState {
27
32
37};
38
43class CESIUM3DTILESSELECTION_API TileOcclusionRendererProxy {
44public:
58
59protected:
69 virtual void reset(const Tile* pTile) = 0;
70
71private:
72 bool _usedLastFrame = false;
73 TileOcclusionRendererProxy* _pNext = nullptr;
74};
75
81class CESIUM3DTILESSELECTION_API TileOcclusionRendererProxyPool {
82public:
89 TileOcclusionRendererProxyPool(int32_t maximumPoolSize);
90
95
100
112 fetchOcclusionProxyForTile(const Tile& tile, int32_t currentFrame);
113
121
122protected:
129
135 virtual void destroyProxy(TileOcclusionRendererProxy* pProxy) = 0;
136
137private:
138 // Singly linked list representing the free proxies in the pool
139 TileOcclusionRendererProxy* _pFreeProxiesHead;
140 int32_t _currentSize;
141 int32_t _maxSize;
142 // The currently used proxies in the pool
143 std::unordered_map<const Tile*, TileOcclusionRendererProxy*>
144 _tileToOcclusionProxyMappings;
145};
146
147} // namespace Cesium3DTilesSelection
A pool of TileOcclusionRendererProxy objects. Allows quick remapping of tiles to occlusion renderer p...
TileOcclusionRendererProxyPool(int32_t maximumPoolSize)
Constructs a new instance.
virtual ~TileOcclusionRendererProxyPool()
Destroys this pool.
void pruneOcclusionProxyMappings()
Prunes the occlusion proxy mappings and removes any mappings that were unused the last frame....
virtual TileOcclusionRendererProxy * createProxy()=0
Create a TileOcclusionRendererProxy.
const TileOcclusionRendererProxy * fetchOcclusionProxyForTile(const Tile &tile, int32_t currentFrame)
Get the TileOcclusionRendererProxy mapped to the tile. Attempts to create a new mapping if one does n...
virtual void destroyProxy(TileOcclusionRendererProxy *pProxy)=0
Destroy a TileOcclusionRendererProxy that is done being used.
An interface for client renderers to use to represent tile bounding volumes that should be occlusion ...
virtual TileOcclusionState getOcclusionState() const =0
Get the occlusion state for this tile. If this is OcclusionUnavailable, the traversal may decide to w...
virtual void reset(const Tile *pTile)=0
Reset this proxy to target a new tile. If nullptr, this proxy is back in the pool and will not be use...
A tile in a Tileset.
Definition Tile.h:97
Classes that implement the 3D Tiles standard.
TileOcclusionState
The occlusion state of a tile as reported by the renderer proxy.
@ Occluded
The tile's bounding volume is known by the renderer to be occluded.
@ OcclusionUnavailable
The renderer does not yet know if the tile's bounding volume is occluded or not.
@ NotOccluded
The tile's bounding volume is known by the renderer to be visible.