cesium-native icon indicating copy to clipboard operation
cesium-native copied to clipboard

First Refactoring for Tileset Json, Implicit Quadtree, and Implicit Octree

Open baothientran opened this issue 2 years ago • 0 comments

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: Refactor

What's new compared to #481?

  • TileContent

    • Previously, Tile owns TileContentLoadResult 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 using TileEmptyContent, TileExternalContent, or TileRenderContent. I think this is a lot more easy to debug and better-documented
  • 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
  • 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 accept IAssetRequest and return Future<Model>. Instead, it accepts only binary content and convert it directly to gltf Model. Resolving external buffers and images are taken care of by TilesetContentManager
  • TileContext:

    • it is removed, and the responsibility is moved to TilesetContentManager
  • Tileset:

    • All the loading functions: requestTileContent(), requestAvailabilitySubtree(), and loadTilesFromJson are removed, and their implementations are moved to different corresponding TilesetContentLoaders
    • LoadIonAssetEndpoint, LoadTilesetDotJson, LoadTileFromJson, LoadSubtree helper structs are now removed and their implementations are moved to different corresponding TilesetContentLoaders.
    • All the loading responsibilities are moved to TilesetContentManager which is the only object that manages tile loading states and uses TilesetContentLoader to load tile content.
    • Tileset will no longer own Cesium Ion Asset ID and Cesium Ion Token. This information is moved to CesiumIonTilesetContentLoader which is an implementation of TilesetContentLoader interface
    • Tileset will no longer own the tileset url. This information is moved to TilesetJsonLoader which is an implementation of TilesetContentLoader 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 by TilesetContentLoader, so it is removed.
  • Tile:

    • loadContent(), unloadContent(), processLoadedContent() are removed. Loading tile is the responsibilities of TilesetContentLoader 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

baothientran avatar May 31 '22 17:05 baothientran