Chevron Down
Table of Contents
Chevron DownAPI Reference

Overview

logo

The @loaders.gl/3d-tiles module supports loading and traversing 3D Tiles.

References

Installation

npm install @loaders.gl/3d-tiles
npm install @loaders.gl/core

API

A standard complement of loaders and writers are provided to load the individual 3d Tile file formats:

To handle the complex dynamic tile selection and loading required to performantly render larger-than-browser-memory tilesets, additional helper classes are provided:

  • Tileset3D to work with the loaded tileset.
  • Tile3DHeader (currently undocumented) to access data for a specific tile.

Usage

Basic API usage is illustrated in the following snippet. Create a Tileset3D instance, point it a valid tileset URL, set up callbacks, and keep feeding in new camera positions:

import {Tileset3D} from '@loaders.gl/3d-tiles';
const tileset = new Tileset3D(tilesetJson, {
  url: TILESET_URL,
  onTilesetLoad: tileset => console.log('Tileset loaded'),
  onTileLoad: tileset => console.log('Tile loaded'),
  onTileUnload: tileset => console.log('Tile unloaded')
});

// initial camera view
let visibleTiles = tileset3d.traverse(cameraParameters1);

// Camera changes (pan zoom etc)
visibleTiles = tileset3d.traverse(cameraParameters2);

// Note that visibleTiles will likely not immediately include all tiles
// tiles will keep loading and file `onTileLoad` callbacks

Remarks

@loaders.gl/3d-tiles does not yet support the full 3D tiles standard. Notable omissions are:

Attribution

@loaders.gl/3d-tiles is a fork of 3D tile related code in the Cesium github repository under Apache 2 License, and is developed in collabration with the Cesium engineering team.