Browse Source

onPreprocessURL -> preprocessURL

Garrett Johnson 4 năm trước cách đây
mục cha
commit
69e347d8fc
3 tập tin đã thay đổi với 12 bổ sung12 xóa
  1. 8 8
      README.md
  2. 1 1
      example/ionExample.js
  3. 3 3
      src/base/TilesRendererBase.js

+ 8 - 8
README.md

@@ -315,6 +315,14 @@ autoDisableRendererCulling = true : Boolean
 
 If true then all tile meshes automatically have their [frustumCulled](https://threejs.org/docs/index.html#api/en/core/Object3D.frustumCulled) field set to false. This is useful particularly when using one camera because the tiles renderer automatically performs it's own frustum culling on visible tiles. If [displayActiveTiles](#displayActiveTiles) is true or multiple cameras are being used then you may consider setting this to false.
 
+### .onPreprocessURL
+
+```js
+onPreprocessURL = null : ( uri : string | URL ) => string | URL;
+```
+
+Function to preprocess the url for each individual tile geometry or child tile set to be loaded. If null then the url is used directly.
+
 ### .lruCache
 
 ```js
@@ -440,14 +448,6 @@ forEachLoadedModel( callback : ( scene : Object3D, tile : object ) => void ) : v
 
 Fires the callback for every loaded scene in the hierarchy with the associatd tile as the second argument. This can be used to update the materials of all loaded meshes in the tile set.
 
-### .onPreprocessURL
-
-```js
-onPreprocessURL : (uri: string | URL) => URL;
-```
-
-Function to preprocess the url for each individual tile.
-
 ### .onLoadTileSet
 
 ```js

+ 1 - 1
example/ionExample.js

@@ -176,7 +176,7 @@ function reinstantiateTiles() {
 				tiles.fetchOptions.headers = {};
 				tiles.fetchOptions.headers.Authorization = `Bearer ${json.accessToken}`;
 
-				tiles.onPreprocessURL = uri => {
+				tiles.preprocessURL = uri => {
 
 					uri = new URL( uri );
 					uri.searchParams.append( 'v', version );

+ 3 - 3
src/base/TilesRendererBase.js

@@ -39,7 +39,7 @@ export class TilesRendererBase {
 		this.rootURL = url;
 		this.fetchOptions = {};
 
-		this.onPreprocessURL = null;
+		this.preprocessURL = null;
 
 		const lruCache = new LRUCache();
 		lruCache.unloadPriorityCallback = priorityCallback;
@@ -429,7 +429,7 @@ export class TilesRendererBase {
 
 				}
 
-				const uri = this.onPreprocessURL ? this.onPreprocessURL( tile.content.uri ) : tile.content.uri;
+				const uri = this.preprocessURL ? this.preprocessURL( tile.content.uri ) : tile.content.uri;
 				return this.fetchTileSet( uri, Object.assign( { signal }, this.fetchOptions ), tile );
 
 			} )
@@ -461,7 +461,7 @@ export class TilesRendererBase {
 
 				}
 
-				const uri = this.onPreprocessURL ? this.onPreprocessURL( tile.content.uri ) : tile.content.uri;
+				const uri = this.preprocessURL ? this.preprocessURL( tile.content.uri ) : tile.content.uri;
 				return fetch( uri, Object.assign( { signal }, this.fetchOptions ) );
 
 			} )