diff --git a/docs/examples/en/loaders/DRACOLoader.html b/docs/examples/en/loaders/DRACOLoader.html index a1ff9af73f94dd9baacab8e233d93b70df981303..b853bb50ebc23d7d3bb3e869d646175b7b354e40 100644 --- a/docs/examples/en/loaders/DRACOLoader.html +++ b/docs/examples/en/loaders/DRACOLoader.html @@ -34,10 +34,7 @@ var loader = new THREE.DRACOLoader(); // Specify path to a folder containing WASM/JS decoding libraries. - THREE.DRACOLoader.setDecoderPath( '/examples/js/libs/draco' ); - - // Optional: Pre-fetch Draco WASM/JS module. - THREE.DRACOLoader.getDecoderModule(); + loader.setDecoderPath( '/examples/js/libs/draco' ); // Load a Draco geometry loader.load( @@ -90,52 +87,60 @@ Creates a new [name].

-

Static Methods

+

Methods

-

[method:null setDecoderPath]( [param:String value] )

+

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

- [page:String value] — Path to folder containing the JS and WASM decoder libraries. + [page:String url] — A string containing the path/URL of the .drc file.
+ [page:Function onLoad] — A function to be called after the loading is successfully completed.
+ [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.
+

+

+ Begin loading from url and call the onLoad function with the decompressed geometry.

-

[method:null setDecoderConfig]( [param:Object config] )

+

[method:this setPath]( [param:String path] )

- [page:String config.type] - (Optional) "js" or "wasm".
+ [page:String path] — Base path.

- Provides configuration for the decoder libraries. Configuration cannot be changed - after loading the decoders. + Set the base path for the .drc file.

-

[method:Promise getDecoderModule]()

+

[method:this setCrossOrigin]( [param:String value] )

- Requests the decoder libraries, if not already loaded. + [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.

-

[method:null releaseDecoderModule]()

+

[method:this setDecoderPath]( [param:String value] )

- Disposes of the decoder library and deallocates memory. The decoder - [link:https://github.com/google/draco/issues/349 cannot be reloaded afterward]. + [page:String value] — Path to folder containing the JS and WASM decoder libraries.

-

Methods

- -

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

[method:this setDecoderConfig]( [param:Object config] )

- [page:String url] — A string containing the path/URL of the .drc file.
- [page:Function onLoad] — A function to be called after the loading is successfully completed.
- [page:Function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, that contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — (optional) A function to be called if an error occurs during loading. The function receives error as an argument.
+ [page:String config.type] - (Optional) "js" or "wasm".

- Begin loading from url and call the onLoad function with the decompressed geometry. + Provides configuration for the decoder libraries. Configuration cannot be changed + after decoding begins.

-

[method:DRACOLoader setPath]( [param:String path] )

+

[method:this setWorkerLimit]( [param:Number workerLimit] )

- [page:String path] — Base path. + [page:Number workerLimit] - Maximum number of workers to be allocated. Default is 4.

- Set the base path for the .drc file. + Sets the maximum number of [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers Web Workers] + to be used during decoding. A lower limit may be preferable if workers are also for other tasks + in the application. +

+ +

[method:this dispose]()

+

+ Disposes of the decoder resources and deallocates memory. The decoder + [link:https://github.com/google/draco/issues/349 cannot be reloaded afterward].

Source

diff --git a/examples/js/loaders/DRACOLoader.js b/examples/js/loaders/DRACOLoader.js index 2389bfedb5976e3b28ee171fccc051c1810656ca..0b0392d985db5b85f5a4acd15ccceb30d1f54e7a 100644 --- a/examples/js/loaders/DRACOLoader.js +++ b/examples/js/loaders/DRACOLoader.js @@ -6,6 +6,7 @@ THREE.DRACOLoader = function ( manager ) { this.manager = manager || THREE.DefaultLoadingManager; + this.path = ''; this.crossOrigin = 'anonymous'; this.decoderPath = ''; @@ -37,6 +38,14 @@ THREE.DRACOLoader.prototype = { constructor: THREE.DRACOLoader, + setPath: function ( path ) { + + this.path = path; + + return this; + + }, + setCrossOrigin: function ( crossOrigin ) { this.crossOrigin = crossOrigin; @@ -94,6 +103,7 @@ THREE.DRACOLoader.prototype = { var loader = new THREE.FileLoader( this.manager ); + loader.setPath( this.path ); loader.setResponseType( 'arraybuffer' ); if ( this.crossOrigin === 'use-credentials' ) { diff --git a/examples/jsm/loaders/DRACOLoader.js b/examples/jsm/loaders/DRACOLoader.js index 2debdebfb5629fc299020912bc501d9bf043166b..8ea72a48868ba6bfde8f7476127939049019d58b 100644 --- a/examples/jsm/loaders/DRACOLoader.js +++ b/examples/jsm/loaders/DRACOLoader.js @@ -13,6 +13,7 @@ var DRACOLoader = function ( manager ) { this.manager = manager || DefaultLoadingManager; + this.path = ''; this.crossOrigin = 'anonymous'; this.decoderPath = ''; @@ -44,6 +45,14 @@ DRACOLoader.prototype = { constructor: DRACOLoader, + setPath: function ( path ) { + + this.path = path; + + return this; + + }, + setCrossOrigin: function ( crossOrigin ) { this.crossOrigin = crossOrigin; @@ -101,6 +110,7 @@ DRACOLoader.prototype = { var loader = new FileLoader( this.manager ); + loader.setPath( this.path ); loader.setResponseType( 'arraybuffer' ); if ( this.crossOrigin === 'use-credentials' ) {