PlayCanvas implementation of the 3D Tiles renderer. Manages tile loading, caching, traversal and the PlayCanvas entity hierarchy. Tile content is loaded through the engine's glTF parser.
import { TilesRenderer } from '3d-tiles-renderer/playcanvas';
// app and camera are initialized here
const URL = 'https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize_tileset.json';
const tiles = new TilesRenderer( URL, app );
tiles.setCamera( camera.camera );
tiles.group.setLocalEulerAngles( 90, 0, 0 );
app.root.addChild( tiles.group );
app.on( 'update', () => tiles.update() );On this page
Properties
app: AppBase
The PlayCanvas application the tiles are created for.
group: Entity
Root entity that all visible tiles are parented to. Add it to the scene hierarchy, and transform it to place the tileset.
cameras: Array<CameraComponent>
Cameras used to calculate the screen space error and visibility of tiles. Use
TilesRenderer#setCamera and TilesRenderer#deleteCamera to change it.
assetOptions: Object | null
Options passed to the container asset of every tile, such as glTF parser callbacks.
renderOptions: Object | null
Options passed to the render components created for every tile, such as castShadows
or layers.
Methods
new TilesRenderer(
// URL of the root tileset JSON.
url: string,
// The PlayCanvas application to create the tiles for.
app: AppBase
)addEventListener( type: string, listener: function ): voidRegisters a listener for the given event type. The listener receives the event object.
hasEventListener( type: string, listener: function ): booleanremoveEventListener( type: string, listener: function ): voidRemoves a previously registered listener.
dispatchEvent( event: Object ): voidon( type: string, listener: function ): thisAlias of TilesRenderer#addEventListener, matching the PlayCanvas event API.
off( type: string, listener: function ): thisAlias of TilesRenderer#removeEventListener, matching the PlayCanvas event API.
hasCamera( camera: CameraComponent ): booleansetCamera( camera: CameraComponent ): booleanAdds a camera used to calculate tile visibility and screen space error. The render resolution is read every frame: the size of the camera's render target in pixels, or the size of the canvas in CSS pixels.
deleteCamera( camera: CameraComponent ): booleanforEachLoadedModel(
// Called with the tile's entity and the tile.
callback: function
): voidCalls the callback for every tile with loaded content.
dispose(): voidDisposes the renderer, releasing all loaded tile content and the root entity.
Inherited
From TilesRendererBase
- Properties
- Methods