@loaders/tiles exposes handy classes
Tile3D which can understand the loaded data from tile loaders (
@loaders.gl/i3s, etc.), and provide useful functions for dynamically selecting tiles for rendering under a viewport.
BoundingVolume): The root tile's bounding volume, which is also the bouding volume of the entire tileset. Check
Number): Center of tileset in fixed frame coordinates.
Number): Center of tileset in cartographic coordinates
[long, lat, elevation]
Ellipsoid): Gets an ellipsoid describing the shape of the globe.
Number): If tiles sized more than
maximumMemoryUsageare needed to for the current view, when these tiles go out of view, they will be unloaded.
maximumMemoryUsagemust be greater than or equal to zero.
modelMatrix(`Matrix4: A Matrix4 instance (4x4 transformation matrix) that transforms the entire tileset.
Tile3DHeader): The root tile header.
Stats)): An instance of a probe.gl
Statsobject that contains information on how many tiles have been loaded etc. Easy to display using a probe.gl
Object): The original tileset data this object instanced from.
true, all tiles that meet the screen space error this frame are loaded. The tileset is completely loaded for this view.
Number): The total amount of GPU memory in bytes used by the tileset. This value is estimated from geometry, texture, and batch table textures of loaded tiles. For point clouds, this value also includes per-point metadata.
String): The url to a tileset JSON file.
Number): A web mercator zoom level that displays the entire tile set bounding volume
constructor(tileset : Object, url : String [, options : Object])
tileset: The loaded tileset (parsed JSON). See Tileset Object Format.
options: Options object, but not limited to Parameters:
Matrix4) - A 4x4 transformation matrix that transforms the tileset's root tile.
Number) - The maximum amount of memory in MB that can be used by the tileset.
Ellipsoid) - The ellipsoid determining the size and shape of the globe. Callbacks:
(tileHeader : Tile3DHeader) : void) - callback when a tile node is fully loaded during the tileset traversal.
(tileHeader : Tile3DHeader) : void) - callback when a tile node is unloaded during the tileset traversal.
(tileHeader : Tile3DHeader, message : String) : void) - callback when a tile faile to load during the tileset traversal.
update(viewport: WebMercatorViewport) : Number: Execute traversal under current viewport and fetch tiles needed for current viewport and update
frameNumberof this update frame.
destroy() : void: Destroys the WebGL resources held by this object, and destroy all the tiles' resources by recursively traversing the tileset tree.
BoundingVolume): A bounding volume that encloses a tile or its content. Exactly one box, region, or sphere property is required. (
String): A unique number for the tile in the tileset. Default to the url of the tile.
String): Indicate of the tile content state. Available options
UNLOADED: Has never been requested or has been destroyed.
LOADING: Is waiting on a pending request.
PROCESSING: Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.
READY: All the resources are loaded and decoded.
FAILED: Request failed.
String): One of
empty: does not have any content to render
render: has content to render
tileset: tileset tile
Number): The depth of the tile in the tileset tree.
Object): The tile's content.This represents the actual tile's payload.
String): One of
Tile3DHeader): Parent of this tile.
String): Specifies the type of refine that is used when traversing this tile for rendering.
ADD: high-resolution children tiles should be rendered in addition to lower-resolution parent tiles when level of details of parent tiles are not sufficient for current view.
REPLACEMENT: high-resolution children tiles should replace parent tiles when lower-resolution parent tiles are not sufficient for current view.
Boolean): Whether this tile is selected for rendering in current update frame and viewport. A selected tile should has its content loaded and satifies current viewport.
Tileset3Dinstance containing this tile.
Object): The unprocessed tile header object passed in.
constructor(tileset : Object, header : Object, parentHeader : Object)
tileset: The loaded tileset (parsed JSON)
header: The loaded tile header file. See Tile Object Format.
parentHeader: The loaded parent file.
destroy(): Destroy the tile node, including destroy all the metadata and unload content.
loadContent(): Load a content of the tile.
unloadContent(): Unload a content of the tile.
This section specifies the unified data formats from tileset loader and tile loader.
The following fields are guaranteed. But different tileset loaders may have different extra fields.
|The root tile header object|
|The root tile header object|
|Indicate the type of tileset specification, |
The following fields are guaranteed. But different tile loaders may have different extra fields.
|A bounding volume that encloses a tile or its content. Exactly one box, region, or sphere property is required. (|
|An array of objects that define child tiles. Each child tile content is fully enclosed by its parent tile's bounding volume and, generally, has more details than parent. for leaf tiles, the length of this array is zero, and children may not be defined.|
|The actual payload of the tile or the url point to the actual payload.|
|Identifier of the tile, unique in a tileset|
|Used for deciding if this tile is sufficient given current viewport. Cesium tile use |
|Refinement type of the tile, |
|Type of the tile, one of |
|A matrix that transforms from the tile's local coordinate system to the parent tile's coordinate system—or the tileset's coordinate system in the case of the root tile|
After content is loaded, the following fields are guaranteed. But different tiles may have different extra content fields.
|"Center" of tile geometry in WGS84 fixed frame coordinates|
|"Origin" in lng/lat (center of tile's bounding volume)|
|Transforms tile geometry positions to fixed frame coordinates|
|Each attribute follows luma.gl accessor properties|
attributes contains following fields
|Number of points|
|Color of the tile when there are not |
|check GLTFLoader for detailed spec|
|URL||url of tile's texture|
To help applications process the
position data in the tiles, 3D Tiles category loaders are expected to provide matrices are provided to enable tiles to be used in both fixed frame or cartographic (long/lat-relative, east-north-up / ENU) coordinate systems:
Position units in both cases are in meters.
For cartographic coordinates, tiles come with a prechosen cartographic origin and precalculated model matrix. This cartographic origin is "arbitrary" (chosen based on the tiles bounding volume center). A different origin can be chosen and a transform can be calculated, e.g. using the math.gl