From eacd20cf0e9cec39980a5e7dff47866c61da0cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guimmara?= Date: Mon, 6 Jan 2025 15:59:05 +0100 Subject: [PATCH] feat(TilesRenderer): add the load-model-start event (#906) --- src/three/TilesRenderer.d.ts | 1 + src/three/TilesRenderer.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/three/TilesRenderer.d.ts b/src/three/TilesRenderer.d.ts index c0ed55f8a..0ac9cf079 100644 --- a/src/three/TilesRenderer.d.ts +++ b/src/three/TilesRenderer.d.ts @@ -12,6 +12,7 @@ export interface TilesRendererEventMap { 'tiles-load-start': {}; 'tiles-load-end': {}; 'load-content': {}; + 'load-model-start': { tile: Tile }; 'load-model': { scene: Object3D; tile: Tile }; 'dispose-model': { scene: Object3D; tile: Tile }; 'tile-visibility-change': { scene: Object3D; tile: Tile; visible: boolean }; diff --git a/src/three/TilesRenderer.js b/src/three/TilesRenderer.js index 237e6b752..09f0504d9 100644 --- a/src/three/TilesRenderer.js +++ b/src/three/TilesRenderer.js @@ -573,6 +573,12 @@ export class TilesRenderer extends TilesRendererBase { async parseTile( buffer, tile, extension, uri ) { + // dispatch an event indicating that this model has started loading + this.dispatchEvent( { + type: 'load-model-start', + tile, + } ); + const cached = tile.cached; cached._loadIndex ++;