cesium-native
cesium-native copied to clipboard
First Refactoring for Tileset Json, Implicit Quadtree, and Implicit Octree
Open this as draft since I still needs to finish unit testings and add comments to the API. This will be merged into a staging branch rather than main, to prevent any mistakes
Overview
This PR is the first patch to resolve #481. The main purposes of this PR are:
- Clean up any existing tile loading codes from Tileset and Tile
- Hook the new loading architecture to the traversal system
- Only tackle tileset json, implicit quadtree, and octree for now. Raster overlay and Quantized mesh will be in different PRs
This is the new diagram for the new loading architecture:
What's new compared to #481?
-
TileContent
- Previously,
Tile
ownsTileContentLoadResult
struct and check the existing of some of the fields in this struct to determine if the tile is external, empty, or renderable (link). The new refactor is more explicit about it by usingTileEmptyContent
,TileExternalContent
, orTileRenderContent
. I think this is a lot more easy to debug and better-documented
- Previously,
-
TilesetContentManager
- Previously Tileset and Tile are used to set the state machine of Tile. Now only TilesetContentManager will take care of that. Its responsibilities consists of loading tile content (by using
TilesetContentLoader
), managing tile loading state machine, and unloading tile. No ones except the TilesetContentManager can set the state of the tile now - Tileset uses this interface to stream tile in during traversal process
- Previously Tileset and Tile are used to set the state machine of Tile. Now only TilesetContentManager will take care of that. Its responsibilities consists of loading tile content (by using
-
TilesetContentLoader
- It will be only used to load tile gltf and external tileset
What's removed?
-
TileContentFactory and TileContentLoader:
- They are now changed to
GltfConverters
. The interface will no longer acceptIAssetRequest
and returnFuture<Model>
. Instead, it accepts only binary content and convert it directly to gltf Model. Resolving external buffers and images are taken care of byTilesetContentManager
- They are now changed to
-
TileContext:
- it is removed, and the responsibility is moved to
TilesetContentManager
- it is removed, and the responsibility is moved to
-
Tileset:
- All the loading functions:
requestTileContent()
,requestAvailabilitySubtree()
, andloadTilesFromJson
are removed, and their implementations are moved to different correspondingTilesetContentLoaders
-
LoadIonAssetEndpoint
,LoadTilesetDotJson
,LoadTileFromJson
,LoadSubtree
helper structs are now removed and their implementations are moved to different correspondingTilesetContentLoaders
. - All the loading responsibilities are moved to
TilesetContentManager
which is the only object that manages tile loading states and usesTilesetContentLoader
to load tile content. - Tileset will no longer own
Cesium Ion Asset ID
andCesium Ion Token
. This information is moved toCesiumIonTilesetContentLoader
which is an implementation ofTilesetContentLoader
interface - Tileset will no longer own the tileset url. This information is moved to
TilesetJsonLoader
which is an implementation ofTilesetContentLoader
interface - Tileset will no longer keep track of the statistic, e.g Number of loading tiles. This information is moved to
TilesetContentManager
which will take care all aspects of loading tiles. -
ImplicitTraversal
previously was used to create children for implicit tiles during the traversal. This responsibility is now taken care of byTilesetContentLoader
, so it is removed.
- All the loading functions:
-
Tile:
-
loadContent()
,unloadContent()
,processLoadedContent()
are removed. Loading tile is the responsibilities ofTilesetContentLoader
now - The state machine is now moved to
TilesetContentManager
which is the only class that can do it. No ones can set the state of the tile now - Raster overlay and upsample are removed for now and will be added back in different PRs
-