3DTilesRendererJS icon indicating copy to clipboard operation
3DTilesRendererJS copied to clipboard

Provide example demonstrating how to use two TileRenderers sharing a cache and queues

Open gkjohnson opened this issue 5 years ago • 4 comments

Make two tile renderers for two tilesets that share the LRUCache, download, and parse queues.

// Using the automatically instantiated priority queues and cache ensures
// we have the default priority callbacks set by the renderer.
const tilesRenderer1 = new TilesRenderer( url1 );
const {
    lruCache,
    downloadQueue,
    parseQueue
} = tilesRenderer1;

const tilesRenderer2 = new TilesRenderer( url2 );
tilesRenderer2.lruCache = lruCache;
tilesRenderer2.downloadQueue = downloadQueue;
tilesRenderer2.parseQueue= parseQueue;

// ...

function render() {

    tilesRenderer1.update();
    tilesRenderer2.update();

    renderer.render( scene, camera );

}

gkjohnson avatar Jul 11 '20 06:07 gkjohnson

Tested this with two of the same tilesets to verify it worked and added setup instructions in 049848b.

gkjohnson avatar Jul 18 '20 00:07 gkjohnson

This should have new example data for a proper demo.

gkjohnson avatar Aug 22 '20 00:08 gkjohnson

The mars demo could implement this.

gkjohnson avatar Dec 21 '23 08:12 gkjohnson

Related to #376 - if we share a download cache the sky tiles will inevitably download first because they are shallow and the sort approach ensures they download first.

gkjohnson avatar Dec 21 '23 15:12 gkjohnson