cesium-native 0.47.0
|
Represents a group of views that collectively select tiles from a particular Tileset
.
More...
#include <Cesium3DTilesSelection/TilesetViewGroup.h>
Classes | |
struct | LoadQueueCheckpoint |
A checkpoint within this view group's load queue. More... | |
Public Types | |
using | TraversalState |
The type of the CesiumUtility::TreeTraversalState used to track tile selection states for this view group. | |
Public Member Functions | |
TilesetViewGroup () noexcept | |
Constructs a new instance. | |
TilesetViewGroup (const TilesetViewGroup &rhs) noexcept | |
Constructs a new instance as a copy of an existing one. | |
TilesetViewGroup (TilesetViewGroup &&rhs) noexcept | |
Moves an existing view group into a new one. | |
const ViewUpdateResult & | getViewUpdateResult () const |
Gets the result from the last time this view group was updated by calling Tileset::updateViewGroup . | |
ViewUpdateResult & | getViewUpdateResult () |
Gets the result from the last time this view group was updated by calling Tileset::updateViewGroup . | |
TraversalState & | getTraversalState () noexcept |
Gets an object used to track the selection state of tiles as they are traversed for this view group. | |
const TraversalState & | getTraversalState () const noexcept |
Gets an object used to track the selection state of tiles as they are traversed for this view group. | |
void | addToLoadQueue (const TileLoadTask &task) |
Adds a tile load task to this view group's load queue. | |
LoadQueueCheckpoint | saveTileLoadQueueCheckpoint () |
Saves a checkpoint of the tile load queue associated with this view group. | |
size_t | restoreTileLoadQueueCheckpoint (const LoadQueueCheckpoint &checkpoint) |
Restores a previously-saved checkpoint of the tile load queue associated with this view group. | |
size_t | getWorkerThreadLoadQueueLength () const |
Gets the number of tiles that are currently in the queue waiting to be loaded in the worker thread. | |
size_t | getMainThreadLoadQueueLength () const |
Gets the number of tiles that are currently in the queue waiting to be loaded in the main thread. | |
void | startNewFrame (const Tileset &tileset, const TilesetFrameState &frameState) |
Starts a new frame, clearing the set of tiles to be loaded so that a new set can be selected. | |
void | finishFrame (const Tileset &tileset, const TilesetFrameState &frameState) |
Finishes the current frame by making the current tile selection state the previous one and releasing references to tiles in the old previous one. | |
float | getPreviousLoadProgressPercentage () const |
Gets the previous load progress percentage for this view group as of the last time it was updated. | |
double | getWeight () const override |
void | setWeight (double weight) noexcept |
Sets the weight of this view group relative to other tile requesters. | |
bool | hasMoreTilesToLoadInWorkerThread () const override |
Tile * | getNextTileToLoadInWorkerThread () override |
bool | hasMoreTilesToLoadInMainThread () const override |
Tile * | getNextTileToLoadInMainThread () override |
![]() | |
void | unregister () noexcept |
Unregister this requester with the {link Tileset} with which it is currently registered. Once unregistered, it will not influence tile loads until registered again. | |
Additional Inherited Members | |
![]() | |
TileLoadRequester () noexcept | |
Constructs a new instance. | |
TileLoadRequester (const TileLoadRequester &rhs) noexcept | |
Constructs a new instance as a copy of an existing one. | |
TileLoadRequester (TileLoadRequester &&rhs) noexcept | |
Moves an existing instance into a new one. | |
virtual | ~TileLoadRequester () noexcept |
Destroys this instance. | |
Represents a group of views that collectively select tiles from a particular Tileset
.
Create an instance of this class and pass it repeatedly to Tileset::updateViewGroup
to select tiles suitable for rendering the tileset from a given view or set of views.
This class is intentionally decoupled from ViewState
, such that clients are responsible for managing which views are represented by any particular group.
Definition at line 34 of file TilesetViewGroup.h.
The type of the CesiumUtility::TreeTraversalState
used to track tile selection states for this view group.
Definition at line 41 of file TilesetViewGroup.h.
|
noexcept |
Constructs a new instance as a copy of an existing one.
The new instance will be equivalent to the existing one, but it will not be registered with the Cesium3DTilesSelection::Tileset
.
rhs | The view group to copy. |
|
noexcept |
Moves an existing view group into a new one.
The new instance will be registered with the Cesium3DTilesSelection::Tileset
, and the old one will be unregistered.
rhs | The view group to move from. |
void Cesium3DTilesSelection::TilesetViewGroup::addToLoadQueue | ( | const TileLoadTask & | task | ) |
Adds a tile load task to this view group's load queue.
Each tile may only be added once per call to startNewFrame
. Adding a tile multiple times will lead to an assertion in debug builds and undefined behavior in release builds.
task | The tile load task to add to the queue. |
void Cesium3DTilesSelection::TilesetViewGroup::finishFrame | ( | const Tileset & | tileset, |
const TilesetFrameState & | frameState ) |
Finishes the current frame by making the current tile selection state the previous one and releasing references to tiles in the old previous one.
This method also updates the load progress percentage returned by getPreviousLoadProgressPercentage
and makes sure credits used by this view group have been referenced on the CesiumUtility::CreditSystem
.
tileset | The tileset that is finishing the current frame. |
frameState | The state of the frame. |
|
overridevirtual |
Gets the next Tile
that this requester would like loaded in the main thread.When hasMoreTilesToLoadInMainThread
returns false, this method can and should return nullptr
. However, when that method returns true, this method must return a valid Tile
pointer.The returned tile must have a reference count greater than zero. Otherwise, the Tile would be immediately eligible for unloading, so it doesn't make sense to load it. In debug builds, this is enforced with an assertion. In release builds, unreferenced tiles are silently ignored.
Implements Cesium3DTilesSelection::TileLoadRequester.
|
overridevirtual |
Gets the next Tile
that this requester would like loaded in a worker thread.When hasMoreTilesToLoadInWorkerThread
returns false, this method can and should return nullptr
. However, when that method returns true, this method must return a valid Tile
pointer.The returned tile must have a reference count greater than zero. Otherwise, the Tile would be immediately eligible for unloading, so it doesn't make sense to load it. In debug builds, this is enforced with an assertion. In release builds, unreferenced tiles are silently ignored.
Implements Cesium3DTilesSelection::TileLoadRequester.
float Cesium3DTilesSelection::TilesetViewGroup::getPreviousLoadProgressPercentage | ( | ) | const |
Gets the previous load progress percentage for this view group as of the last time it was updated.
This method reports the progress as of the last call to finishFrame
.
The reported percentage is computed as:
\(100.0\frac{totalTilesVisited - tilesNeedingLoading}{totalTilesVisited}\)
When loading is complete, this method will return exactly 100.0.
|
inlinenoexcept |
Gets an object used to track the selection state of tiles as they are traversed for this view group.
Definition at line 87 of file TilesetViewGroup.h.
|
inlinenoexcept |
Gets an object used to track the selection state of tiles as they are traversed for this view group.
Definition at line 84 of file TilesetViewGroup.h.
ViewUpdateResult & Cesium3DTilesSelection::TilesetViewGroup::getViewUpdateResult | ( | ) |
Gets the result from the last time this view group was updated by calling Tileset::updateViewGroup
.
|
overridevirtual |
Gets the weight of this requester relative to others.Most requesters should return a weight of 1.0. When all requesters have the same weight, they will all have an equal opportunity to load tiles. If one requester's weight is 2.0 and the rest are 1.0, that requester will have twice as many opportunities to load tiles as the others.A very high weight will prevent all other requesters from loading tiles until this requester has none left to load. A very low weight (but above 0.0!) will allow all other requesters to finish loading tiles before this one starts.
Implements Cesium3DTilesSelection::TileLoadRequester.
|
overridevirtual |
Determines if this requester has any more tiles that need to be loaded in the main thread. To determine if a particular Tile
needs to be loaded in the main thread, call Tile::needsMainThreadLoading
.
Implements Cesium3DTilesSelection::TileLoadRequester.
|
overridevirtual |
Determines if this requester has any more tiles that need to be loaded in a worker thread. To determine if a particular Tile
needs to be loaded in a worker thread, call Tile::needsWorkerThreadLoading
.
Implements Cesium3DTilesSelection::TileLoadRequester.
size_t Cesium3DTilesSelection::TilesetViewGroup::restoreTileLoadQueueCheckpoint | ( | const LoadQueueCheckpoint & | checkpoint | ) |
Restores a previously-saved checkpoint of the tile load queue associated with this view group.
Restoring a checkpoint discards all tiles from the queue that were requested, with a call to addToLoadQueue
, since the checkpoint was created.
This method should only be called in between calls to startNewFrame
and finishFrame
.
checkpoint | The previously-created checkpoint. |
LoadQueueCheckpoint Cesium3DTilesSelection::TilesetViewGroup::saveTileLoadQueueCheckpoint | ( | ) |
Saves a checkpoint of the tile load queue associated with this view group.
The saved checkpoint can later be restored by calling restoreTileLoadQueueCheckpoint
.
This method should only be called in between calls to startNewFrame
and finishFrame
.
|
noexcept |
Sets the weight of this view group relative to other tile requesters.
See getWeight
for an explanation of the meaning of the weight.
weight | The new weight for this view group. |
void Cesium3DTilesSelection::TilesetViewGroup::startNewFrame | ( | const Tileset & | tileset, |
const TilesetFrameState & | frameState ) |
Starts a new frame, clearing the set of tiles to be loaded so that a new set can be selected.
tileset | The tileset that is starting the new frame. |
frameState | The state of the new frame. |