4 #include "RasterOverlayCollection.h"
5 #include "SampleHeightResult.h"
7 #include "TilesetContentLoader.h"
8 #include "TilesetExternals.h"
9 #include "TilesetLoadFailureDetails.h"
10 #include "TilesetOptions.h"
11 #include "ViewState.h"
12 #include "ViewUpdateResult.h"
14 #include <CesiumAsync/AsyncSystem.h>
15 #include <CesiumUtility/IntrusivePointer.h>
17 #include <rapidjson/fwd.h>
27 class TilesetContentManager;
28 class TilesetMetadata;
29 class TilesetHeightQuery;
30 class TilesetHeightRequest;
31 class TilesetSharedAssetSystem;
39 class CESIUM3DTILESSELECTION_API
Tileset final {
51 std::unique_ptr<TilesetContentLoader>&& pCustomLoader,
52 std::unique_ptr<Tile>&& pRootTile,
63 const std::string& url,
80 const std::string& ionAccessToken,
82 const std::string& ionAssetEndpointUrl =
"https://api.cesium.com/");
101 CesiumAsync::SharedFuture<
void>& getAsyncDestructionCompleteEvent();
113 const std::vector<
CesiumUtility::Credit>& getTilesetCredits() const noexcept;
119 void setShowCreditsOnScreen(
bool showCreditsOnScreen) noexcept;
132 return this->_externals;
140 return this->_asyncSystem;
145 return this->_asyncSystem;
160 return this->_options.ellipsoid;
165 return this->_options.ellipsoid;
176 const
Tile* getRootTile() const noexcept;
205 updateViewOffline(const std::vector<
ViewState>& frustums);
218 updateView(const std::vector<
ViewState>& frustums,
float deltaTime = 0.0f);
223 int32_t getNumberOfTilesLoaded() const;
229 float computeLoadProgress() noexcept;
236 void forEachLoadedTile(const std::function<
void(
Tile& tile)>& callback);
242 int64_t getTotalDataBytes() const noexcept;
317 struct TraversalDetails {
325 bool allAreRenderable =
true;
336 bool anyWereRenderedLastFrame =
false;
356 uint32_t notYetRenderableCount = 0;
367 const std::vector<ViewState>& frustums;
368 std::vector<double> fogDensities;
369 int32_t lastFrameNumber;
370 int32_t currentFrameNumber;
373 TraversalDetails _renderLeaf(
374 const FrameState& frameState,
377 ViewUpdateResult& result);
378 TraversalDetails _renderInnerTile(
379 const FrameState& frameState,
381 ViewUpdateResult& result);
382 bool _kickDescendantsAndRenderTile(
383 const FrameState& frameState,
385 ViewUpdateResult& result,
386 TraversalDetails& traversalDetails,
387 size_t firstRenderedDescendantIndex,
388 size_t workerThreadLoadQueueIndex,
389 size_t mainThreadLoadQueueIndex,
391 double tilePriority);
393 _checkOcclusion(
const Tile& tile,
const FrameState& frameState);
395 TraversalDetails _visitTile(
396 const FrameState& frameState,
399 bool ancestorMeetsSse,
402 ViewUpdateResult& result);
406 bool shouldVisit =
true;
414 const FrameState& frameState,
415 bool cullWithChildrenBounds,
416 CullResult& cullResult);
418 const FrameState& frameState,
419 const std::vector<double>& distances,
420 CullResult& cullResult);
422 const std::vector<ViewState>& frustums,
424 const std::vector<double>& distances,
425 bool culled)
const noexcept;
427 TraversalDetails _visitTileIfNeeded(
428 const FrameState& frameState,
430 bool ancestorMeetsSse,
432 ViewUpdateResult& result);
433 TraversalDetails _visitVisibleChildrenNearToFar(
434 const FrameState& frameState,
436 bool ancestorMeetsSse,
438 ViewUpdateResult& result);
455 bool _loadAndRenderAdditiveRefinedTile(
457 ViewUpdateResult& result,
461 void _processWorkerThreadLoadQueue();
462 void _processMainThreadLoadQueue();
464 void _unloadCachedTiles(
double timeBudget) noexcept;
465 void _markTileVisited(Tile& tile) noexcept;
467 void _updateLodTransitions(
468 const FrameState& frameState,
470 ViewUpdateResult& result)
const noexcept;
472 TilesetExternals _externals;
475 TilesetOptions _options;
477 int32_t _previousFrameNumber;
478 ViewUpdateResult _updateResult;
480 enum class TileLoadPriorityGroup {
501 struct TileLoadTask {
514 TileLoadPriorityGroup group;
523 bool operator<(
const TileLoadTask& rhs)
const noexcept {
524 if (this->group == rhs.group)
525 return this->priority < rhs.priority;
527 return this->group > rhs.group;
531 std::vector<TileLoadTask> _mainThreadLoadQueue;
532 std::vector<TileLoadTask> _workerThreadLoadQueue;
533 std::vector<Tile*> _heightQueryLoadQueue;
539 std::vector<double> _distances;
543 std::vector<const TileOcclusionRendererProxy*> _childOcclusionProxies;
546 _pTilesetContentManager;
548 std::list<TilesetHeightRequest> _heightRequests;
550 void addTileToLoadQueue(
552 TileLoadPriorityGroup priorityGroup,
555 static TraversalDetails createTraversalDetailsForSingleTile(
556 const FrameState& frameState,
558 const TileSelectionState& lastFrameSelectionState);
560 Tileset(
const Tileset& rhs) =
delete;
561 Tileset& operator=(
const Tileset& rhs) =
delete;
A collection of RasterOverlay instances that are associated with a Tileset.
CesiumUtility::DoublyLinkedList< Tile, &Tile::_loadedTilesLinks > LoadedLinkedList
A CesiumUtility::DoublyLinkedList for tile objects.
External interfaces used by a Tileset.
Contains assets that are potentially shared across multiple Tilesets.
A 3D Tiles tileset, used for streaming massive heterogeneous 3D geospatial datasets.
Tileset(const TilesetExternals &externals, int64_t ionAssetID, const std::string &ionAccessToken, const TilesetOptions &options=TilesetOptions(), const std::string &ionAssetEndpointUrl="https://api.cesium.com/")
Constructs a new instance with the given asset ID on Cesium ion.
Tileset(const TilesetExternals &externals, const std::string &url, const TilesetOptions &options=TilesetOptions())
Constructs a new instance with a given tileset.json URL.
CesiumAsync::AsyncSystem & getAsyncSystem() noexcept
Returns the CesiumAsync::AsyncSystem that is used for dispatching asynchronous tasks.
Tile * getRootTile() noexcept
Gets the root tile of this tileset.
CesiumGeospatial::Ellipsoid & getEllipsoid() noexcept
Gets the CesiumGeospatial::Ellipsoid used by this tileset.
~Tileset() noexcept
Destroys this tileset.
const CesiumAsync::AsyncSystem & getAsyncSystem() const noexcept
Returns the CesiumAsync::AsyncSystem that is used for dispatching asynchronous tasks.
Tileset(const TilesetExternals &externals, std::unique_ptr< TilesetContentLoader > &&pCustomLoader, std::unique_ptr< Tile > &&pRootTile, const TilesetOptions &options=TilesetOptions())
Constructs a new instance with a given custom tileset loader.
const TilesetExternals & getExternals() const noexcept
Gets the TilesetExternals that summarize the external interfaces used by this tileset.
const TilesetOptions & getOptions() const noexcept
Gets the TilesetOptions of this tileset.
TilesetOptions & getOptions() noexcept
Gets the TilesetOptions of this tileset.
const CesiumGeospatial::Ellipsoid & getEllipsoid() const
Gets the CesiumGeospatial::Ellipsoid used by this tileset.
The state of the view that is used during the traversal of a tileset.
Reports the results of Tileset::updateView.
A system for managing asynchronous requests and tasks.
A quadratic surface defined in Cartesian coordinates.
Classes that implement the 3D Tiles standard.
Classes that support asynchronous operations.
Classes for geospatial computations in Cesium.
Utility classes for Cesium.
The result of sampling heights with Tileset::sampleHeightMostDetailed.
Additional options for configuring a Tileset.