Skip to content

Commit 82fa006

Browse files
authored
Final "Tile Set" -> "Tileset" migration (#1379)
* loadRootTileSet to loadRootTileset * Add function detection * processTileSet -> preprocessTileset
1 parent 983a909 commit 82fa006

5 files changed

Lines changed: 48 additions & 13 deletions

File tree

src/core/plugins/CesiumIonAuthPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class CesiumIonAuthPlugin {
7171

7272
}
7373

74-
loadRootTileSet() {
74+
loadRootTileset() {
7575

7676
// ensure we have an up-to-date token and root url, then trigger the internal
7777
// root tileset load function
@@ -81,7 +81,7 @@ export class CesiumIonAuthPlugin {
8181
.then( json => {
8282

8383
this._initializeFromAsset( json );
84-
return this.tiles.invokeOnePlugin( plugin => plugin !== this && plugin.loadRootTileSet && plugin.loadRootTileSet() );
84+
return this.tiles.invokeOnePlugin( plugin => plugin !== this && plugin.loadRootTileset && plugin.loadRootTileset() );
8585

8686
} )
8787
.catch( error => {

src/core/renderer/tiles/TilesRendererBase.js

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ export class TilesRendererBase {
198198

199199
}
200200

201+
// Warn if plugin implements deprecated loadRootTileSet method
202+
if ( plugin.loadRootTileSet && ! plugin.loadRootTileset ) {
203+
204+
console.warn( 'TilesRendererBase: Plugin implements deprecated "loadRootTileSet" method. Please rename to "loadRootTileset".' );
205+
206+
}
207+
201208
// insert the plugin based on the priority registered on the plugin
202209
const plugins = this.plugins;
203210
const priority = plugin.priority || 0;
@@ -326,7 +333,7 @@ export class TilesRendererBase {
326333
if ( this.rootLoadingState === UNLOADED ) {
327334

328335
this.rootLoadingState = LOADING;
329-
this.invokeOnePlugin( plugin => plugin.loadRootTileSet && plugin.loadRootTileSet() )
336+
this.invokeOnePlugin( plugin => plugin.loadRootTileset && plugin.loadRootTileset() )
330337
.then( root => {
331338

332339
let processedUrl = this.rootURL;
@@ -753,7 +760,15 @@ export class TilesRendererBase {
753760

754761
}
755762

756-
preprocessTileSet( json, url, parent = null ) {
763+
preprocessTileset( json, url, parent = null ) {
764+
765+
// check for deprecated function usage
766+
const proto = Object.getPrototypeOf( this );
767+
if ( Object.hasOwn( proto, 'preprocessTileSet' ) ) {
768+
769+
console.warn( `${ proto.constructor.name }: Class overrides deprecated "preprocessTileSet" method. Please rename to "preprocessTileset".` );
770+
771+
}
757772

758773
const version = json.asset.version;
759774
const [ major, minor ] = version.split( '.' ).map( v => parseInt( v ) );
@@ -775,7 +790,21 @@ export class TilesRendererBase {
775790

776791
}
777792

778-
loadRootTileSet() {
793+
preprocessTileSet( json, url, parent = null ) {
794+
795+
console.warn( 'TilesRenderer: "preprocessTileSet" has been deprecated. Use "preprocessTileset" instead.' );
796+
797+
}
798+
799+
loadRootTileset() {
800+
801+
// check for deprecated function usage
802+
const proto = Object.getPrototypeOf( this );
803+
if ( Object.hasOwn( proto, 'loadRootTileSet' ) ) {
804+
805+
console.warn( `${ proto.constructor.name }: Class overrides deprecated "loadRootTileSet" method. Please rename to "loadRootTileset".` );
806+
807+
}
779808

780809
// transform the url
781810
let processedUrl = this.rootURL;
@@ -803,7 +832,7 @@ export class TilesRendererBase {
803832
} )
804833
.then( root => {
805834

806-
this.preprocessTileSet( root, processedUrl );
835+
this.preprocessTileset( root, processedUrl );
807836
return root;
808837

809838
} );
@@ -812,6 +841,12 @@ export class TilesRendererBase {
812841

813842
}
814843

844+
loadRootTileSet() {
845+
846+
console.warn( 'TilesRenderer: "loadRootTileSet" has been deprecated. Use "loadRootTileset" instead.' );
847+
848+
}
849+
815850
requestTileContents( tile ) {
816851

817852
// If the tile is already being loaded then don't
@@ -966,7 +1001,7 @@ export class TilesRendererBase {
9661001

9671002
if ( extension === 'json' && content.root ) {
9681003

969-
this.preprocessTileSet( content, uri, tile );
1004+
this.preprocessTileset( content, uri, tile );
9701005
tile.children.push( content.root );
9711006
externalTileset = content;
9721007
isExternalTileset = true;

src/three/plugins/QuantizedMeshPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class QuantizedMeshPlugin {
122122

123123
}
124124

125-
loadRootTileSet() {
125+
loadRootTileset() {
126126

127127
const { tiles } = this;
128128

@@ -208,7 +208,7 @@ export class QuantizedMeshPlugin {
208208

209209
let baseUrl = tiles.rootURL;
210210
tiles.invokeAllPlugins( plugin => baseUrl = plugin.preprocessURL ? plugin.preprocessURL( baseUrl, null ) : baseUrl );
211-
tiles.preprocessTileSet( tileset, baseUrl );
211+
tiles.preprocessTileset( tileset, baseUrl );
212212

213213
return tileset;
214214

src/three/plugins/images/ImageFormatPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class ImageFormatPlugin {
6565

6666
}
6767

68-
async loadRootTileSet() {
68+
async loadRootTileset() {
6969

7070
const { tiles, imageSource } = this;
7171
imageSource.url = imageSource.url || tiles.rootURL;
@@ -209,7 +209,7 @@ export class ImageFormatPlugin {
209209
}
210210
};
211211

212-
tiles.preprocessTileSet( tileset, baseUrl );
212+
tiles.preprocessTileset( tileset, baseUrl );
213213

214214
return tileset;
215215

src/three/renderer/tiles/TilesRenderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ export class TilesRenderer extends TilesRendererBase {
345345
}
346346

347347
/* Overriden */
348-
loadRootTileSet( ...args ) {
348+
loadRootTileset( ...args ) {
349349

350-
return super.loadRootTileSet( ...args )
350+
return super.loadRootTileset( ...args )
351351
.then( root => {
352352

353353
// cache the gltf tileset rotation matrix

0 commit comments

Comments
 (0)