Skip to content

Commit 27a1805

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/mvt-clean
2 parents abfe345 + 5885451 commit 27a1805

43 files changed

Lines changed: 961 additions & 639 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
- TilesRenderer now removes tiles from the download queue if they are no longer needed for rendering. Tiles will continue to process if they are mid-download or parsing.
1111
- I3DMLoader: Added support for oct-encoded normals.
1212
- TilesRenderer: Added "optimizedLoadStrategy" and "loadSiblings" options. These are experimental settings and are planned to be the default and only tile load strategy.
13+
- R3F: added "EllipsoidContext" with "ellipsoid" and "frame" fields
14+
- Export FeatureTable, BatchTable classes.
15+
- TilingScheme: "tileSplitX" and "tileSplitY" variables per tile
16+
- XYZImageFormat: add "projection" option and ability to set tile settings per-level.
17+
- DebugTilesPlugin: add "update" function so settings can be updated without updating tiles.
18+
- LoadRegionPlugin: Added "calculateDistance" function to regions, used for tile load sorting
1319

1420
### Changed
1521
- ImageOverlayPlugin: Textures are now assumed to be straight alpha.
1622
- ImageOverlayPlugin: Refactor image overlays to afford drawing directly to region textures.
1723
- GeoJSONOverlay: Add "redraw" function to redraw the geojson once it's changed
24+
- Renamed the "cached" tile subfield to "engineData".
25+
- Moved a number of tile fields into "traversal" and "internal" subfields on "tile" object.
26+
- ImplicitTilingPlugin: Moved implicit tiling fields onto a new "implicitTilingData" object.
27+
- DebugTilesPlugin: Replaced "getTileInformationFromActiveObject" function with "getTileFromObject3D".
28+
- DebugTilesPlugin: Add transparent mesh to box helper visualization.
29+
- TilesRenderer: Moved "update-before", "update-after" events to TilesRendererBase.
30+
- Plugins: moved handling of "doTilesNeedUpdate" to TilesRendererBase.
31+
- TilesRenderer: "dispose-model" even is now fired before "dispose" is called on sub objects.
32+
33+
### Fixed
34+
- Fix mouse offset in Controls.
35+
- Fixed case where DebugTilesPlugin could throw an error when toggling "enabled".
36+
- DebugTilesPlugin: Fixed case where "enabled" was not resepected if set to false on creation.
1837

1938
## [0.4.19] - 2025.12.19
2039
### Changed

example/three/cesiumCompare.js

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,16 @@ function render() {
9393

9494
cesiumViewer.update();
9595

96+
updateThreeStats();
97+
updateCesiumStats();
98+
99+
}
100+
101+
function updateThreeStats() {
102+
96103
let shallowTilesLoaded, loadedGeometryTiles, allLoadedTiles;
97104
let textureBytes, geometryBytes;
98105

99-
// update three stats
100106
loadedGeometryTiles = 0;
101107
textureBytes = 0;
102108
geometryBytes = 0;
@@ -135,7 +141,7 @@ function render() {
135141
shallowTilesLoaded = 0;
136142
traverse( threeViewer.root, t => {
137143

138-
if ( t.__hasRenderableContent && t.__loadingState !== 0 ) {
144+
if ( t.internal && t.internal.hasRenderableContent && t.internal.loadingState !== 0 ) {
139145

140146
shallowTilesLoaded ++;
141147
return true;
@@ -147,14 +153,16 @@ function render() {
147153
allLoadedTiles = 0;
148154
traverse( threeViewer.root, ( t, d ) => {
149155

150-
if ( t.__hasContent && t.__loadingState !== 0 ) {
156+
if ( t.internal && t.internal.hasContent && t.internal.loadingState !== 0 ) {
151157

152158
allLoadedTiles ++;
153159

154160
}
155161

156162
} );
157163

164+
const { loadStart, loadEnd } = threeViewer;
165+
const loadDelta = loadEnd - loadStart;
158166
clearStats( threeStats );
159167
writeStats( threeStats, 'visible tiles', threeViewer.tiles.visibleTiles.size );
160168
writeStats( threeStats, 'loaded tiles', allLoadedTiles );
@@ -164,8 +172,18 @@ function render() {
164172
writeStats( threeStats, 'total memory', ( threeViewer.tiles.lruCache.cachedBytes * 1e-6 ).toFixed( 3 ) + ' MB' );
165173
writeStats( threeStats, 'geometry memory', ( geometryBytes * 1e-6 ).toFixed( 3 ) + ' MB' );
166174
writeStats( threeStats, 'texture memory', ( textureBytes * 1e-6 ).toFixed( 3 ) + ' MB' );
175+
writeStats( threeStats, 'load start', loadStart.toFixed( 0 ) + ' ms' );
176+
writeStats( threeStats, 'load end', ( loadDelta < 0 ? '--' : loadEnd.toFixed( 0 ) + ' ms' ) );
177+
writeStats( threeStats, 'load delta', ( loadDelta < 0 ? '--' : loadDelta.toFixed( 0 ) + ' ms' ) );
178+
writeStats( threeStats, 'total load time', threeViewer.totalLoadTime.toFixed( 0 ) + ' ms' );
179+
writeStats( threeStats, 'perf', ( 100 * threeViewer.totalLoadTime / cesiumViewer.totalLoadTime ).toFixed( 2 ) + '%' );
167180

168-
// update cesium stats
181+
}
182+
183+
function updateCesiumStats() {
184+
185+
let shallowTilesLoaded, allLoadedTiles;
186+
let textureBytes, geometryBytes;
169187

170188
shallowTilesLoaded = 0;
171189
traverse( cesiumViewer.root, t => {
@@ -204,6 +222,8 @@ function render() {
204222

205223
} );
206224

225+
const { loadStart, loadEnd } = cesiumViewer;
226+
const loadDelta = loadEnd - loadStart;
207227
clearStats( cesiumStats );
208228
writeStats( cesiumStats, 'visible tiles', cesiumViewer.tiles.statistics.selected );
209229
writeStats( cesiumStats, 'loaded tiles', allLoadedTiles );
@@ -213,6 +233,10 @@ function render() {
213233
writeStats( cesiumStats, 'total memory', ( cesiumViewer.tiles.totalMemoryUsageInBytes * 1e-6 ).toFixed( 3 ) + ' MB' );
214234
writeStats( cesiumStats, 'geometry memory', ( geometryBytes * 1e-6 ).toFixed( 3 ) + ' MB' );
215235
writeStats( cesiumStats, 'texture memory', ( textureBytes * 1e-6 ).toFixed( 3 ) + ' MB' );
236+
writeStats( cesiumStats, 'load start', loadStart.toFixed( 0 ) + ' ms' );
237+
writeStats( cesiumStats, 'load end', ( loadDelta < 0 ? '--' : loadEnd.toFixed( 0 ) + ' ms' ) );
238+
writeStats( cesiumStats, 'load delta', ( loadDelta < 0 ? '--' : loadDelta.toFixed( 0 ) + ' ms' ) );
239+
writeStats( cesiumStats, 'total load time', cesiumViewer.totalLoadTime.toFixed( 0 ) + ' ms' );
216240

217241
}
218242

@@ -320,6 +344,25 @@ async function initThree() {
320344

321345
} );
322346

347+
let start = 0;
348+
tiles.addEventListener( 'tiles-load-start', e => {
349+
350+
start = performance.now();
351+
if ( performance.now() - threeViewer.loadEnd > 100 ) {
352+
353+
threeViewer.loadStart = start;
354+
355+
}
356+
357+
} );
358+
359+
tiles.addEventListener( 'tiles-load-end', e => {
360+
361+
threeViewer.loadEnd = performance.now();
362+
threeViewer.totalLoadTime += performance.now() - start;
363+
364+
} );
365+
323366
scene.add( tiles.group );
324367

325368
// lights
@@ -359,6 +402,9 @@ async function initThree() {
359402
window.addEventListener( 'resize', onWindowResize, false );
360403

361404
threeViewer = {
405+
totalLoadTime: 0,
406+
loadStart: 0,
407+
loadEnd: 0,
362408
tiles,
363409
camera,
364410
renderer,
@@ -447,7 +493,35 @@ async function initCesium() {
447493
// height,
448494
// } );
449495

496+
let loading = false;
497+
let start = 0;
498+
tileset.loadProgress.addEventListener( ( pending, processing ) => {
499+
500+
const total = pending + processing;
501+
if ( total !== 0 && ! loading ) {
502+
503+
loading = true;
504+
start = performance.now();
505+
if ( start - threeViewer.loadEnd > 100 ) {
506+
507+
cesiumViewer.loadStart = start;
508+
509+
}
510+
511+
} else if ( total === 0 && loading ) {
512+
513+
loading = false;
514+
cesiumViewer.loadEnd = performance.now();
515+
cesiumViewer.totalLoadTime += performance.now() - start;
516+
517+
}
518+
519+
} );
520+
450521
cesiumViewer = {
522+
totalLoadTime: 0,
523+
loadStart: 0,
524+
loadEnd: 0,
451525
tiles: tileset,
452526
viewer,
453527
camera,

example/three/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ function reinstantiateTiles() {
9797
ktx2loader.detectSupport( renderer );
9898

9999
tiles = new TilesRenderer( url );
100-
tiles.registerPlugin( new DebugTilesPlugin() );
101100
tiles.registerPlugin( new ImplicitTilingPlugin() );
102101
tiles.registerPlugin( new GLTFExtensionsPlugin( {
103102
rtc: true,
@@ -109,9 +108,11 @@ function reinstantiateTiles() {
109108
geospatialRotationParent.add( tiles.group );
110109

111110
// Used with CUSTOM_COLOR
112-
tiles.customColorCallback = ( tile, object ) => {
111+
const debugPlugin = new DebugTilesPlugin();
112+
tiles.registerPlugin( debugPlugin );
113+
debugPlugin.customColorCallback = ( tile, object ) => {
113114

114-
const depthIsEven = tile.__depth % 2 === 0;
115+
const depthIsEven = tile.internal.depth % 2 === 0;
115116
const hex = depthIsEven ? 0xff0000 : 0xffffff;
116117
object.traverse( c => {
117118

example/three/src/plugins/overlays/TextureOverlayPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export class TextureOverlayPlugin {
283283
// public functions
284284
getTileKey( tile ) {
285285

286-
return new URL( tile.content.uri, tile.__basePath + '/' ).toString();
286+
return new URL( tile.content.uri, tile.internal.basePath + '/' ).toString();
287287

288288
}
289289

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/plugins/GoogleCloudAuthPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class GoogleCloudAuthPlugin {
6767

6868
this._visibilityChangeCallback = ( { tile, visible } ) => {
6969

70-
const copyright = tile.cached.metadata?.asset?.copyright || '';
70+
const copyright = tile.engineData.metadata?.asset?.copyright || '';
7171
if ( visible ) {
7272

7373
this._attributionsManager.addAttributions( copyright );

src/core/plugins/ImplicitTilingPlugin.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,28 @@ export class ImplicitTilingPlugin {
1818

1919
if ( tile.implicitTiling ) {
2020

21-
tile.__hasUnrenderableContent = true;
22-
tile.__hasRenderableContent = false;
21+
tile.internal.hasUnrenderableContent = true;
22+
tile.internal.hasRenderableContent = false;
2323

24-
// Declare some properties
25-
tile.__subtreeIdx = 0; // Idx of the tile in its subtree
26-
tile.__implicitRoot = tile; // Keep this tile as an Implicit Root Tile
24+
tile.implicitTilingData = {
25+
// Keep this tile as an Implicit Root Tile
26+
root: tile,
2727

28-
// Coords of the tile
29-
tile.__x = 0;
30-
tile.__y = 0;
31-
tile.__z = 0;
32-
tile.__level = 0;
28+
// Idx of the tile in its subtree
29+
subtreeIdx: 0,
30+
31+
// Coords of the tile
32+
x: 0,
33+
y: 0,
34+
z: 0,
35+
level: 0,
36+
};
3337

3438
} else if ( /.subtree$/i.test( tile.content?.uri ) ) {
3539

3640
// Handling content uri pointing to a subtree file
37-
tile.__hasUnrenderableContent = true;
38-
tile.__hasRenderableContent = false;
41+
tile.internal.hasUnrenderableContent = true;
42+
tile.internal.hasRenderableContent = false;
3943

4044
}
4145

@@ -46,7 +50,7 @@ export class ImplicitTilingPlugin {
4650
if ( /^subtree$/i.test( extension ) ) {
4751

4852
const loader = new SUBTREELoader( tile );
49-
loader.workingPath = tile.__basePath;
53+
loader.workingPath = tile.internal.basePath;
5054
loader.fetchOptions = this.tiles.fetchOptions;
5155
return loader.parse( buffer );
5256

@@ -59,12 +63,12 @@ export class ImplicitTilingPlugin {
5963
if ( tile && tile.implicitTiling ) {
6064

6165
const implicitUri = tile.implicitTiling.subtrees.uri
62-
.replace( '{level}', tile.__level )
63-
.replace( '{x}', tile.__x )
64-
.replace( '{y}', tile.__y )
65-
.replace( '{z}', tile.__z );
66+
.replace( '{level}', tile.implicitTilingData.level )
67+
.replace( '{x}', tile.implicitTilingData.x )
68+
.replace( '{y}', tile.implicitTilingData.y )
69+
.replace( '{z}', tile.implicitTilingData.z );
6670

67-
return new URL( implicitUri, tile.__basePath + '/' ).toString();
71+
return new URL( implicitUri, tile.internal.basePath + '/' ).toString();
6872

6973
}
7074

@@ -84,7 +88,7 @@ export class ImplicitTilingPlugin {
8488

8589
} );
8690
tile.children.length = 0;
87-
tile.__childrenProcessed = 0;
91+
tile.internal.childrenProcessed = 0;
8892

8993
}
9094

0 commit comments

Comments
 (0)