未验证 提交 ef17d6e8 编写于 作者: M Michael Herzog 提交者: GitHub

Merge pull request #17983 from TyLindberg/draco_preload

DRACOLoader: Add preload method
......@@ -36,6 +36,9 @@
// Specify path to a folder containing WASM/JS decoding libraries.
loader.setDecoderPath( '/examples/js/libs/draco/' );
// Optional: Pre-fetch Draco WASM/JS module.
loader.preload();
// Load a Draco geometry
loader.load(
// resource URL
......@@ -128,6 +131,11 @@
in the application.
</p>
<h3>[method:this preload]()</h3>
<p>
Requests the decoder libraries, if not already loaded.
</p>
<h3>[method:this dispose]()</h3>
<p>
Disposes of the decoder resources and deallocates memory. The decoder
......
......@@ -36,6 +36,9 @@
// Specify path to a folder containing WASM/JS decoding libraries.
loader.setDecoderPath( '/examples/js/libs/draco/' );
// Optional: Pre-fetch Draco WASM/JS module.
loader.preload();
// Load a Draco geometry
loader.load(
// resource URL
......@@ -128,6 +131,11 @@
in the application.
</p>
<h3>[method:this preload]()</h3>
<p>
Requests the decoder libraries, if not already loaded.
</p>
<h3>[method:this dispose]()</h3>
<p>
Disposes of the decoder resources and deallocates memory. The decoder
......
......@@ -220,6 +220,14 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
},
preload: function () {
this._initDecoder();
return this;
},
_initDecoder: function () {
if ( this.decoderPending ) return this.decoderPending;
......
......@@ -12,6 +12,7 @@ export class DRACOLoader extends Loader {
setDecoderPath( path: string ): DRACOLoader;
setDecoderConfig( config: object ): DRACOLoader;
setWorkerLimit( workerLimit: number ): DRACOLoader;
preload(): DRACOLoader;
dispose(): DRACOLoader;
}
......@@ -227,6 +227,14 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
},
preload: function () {
this._initDecoder();
return this;
},
_initDecoder: function () {
if ( this.decoderPending ) return this.decoderPending;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册