Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions examples/jsm/loaders/DRACOLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {

const _taskCache = new WeakMap();

const WASM_BIN_URL = new URL( '../libs/draco/draco_decoder.wasm', import.meta.url ).toString();
const WASM_JS_URL = new URL( '../libs/draco/draco_wasm_wrapper.js', import.meta.url ).toString();
const JS_URL = new URL( '../libs/draco/draco_decoder.js', import.meta.url ).toString();

/**
* A loader for the Draco format.
*
Expand Down Expand Up @@ -358,14 +362,31 @@ class DRACOLoader extends Loader {
const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js';
const librariesPending = [];

if ( useJS ) {
if ( this.decoderPath === '' ) {

if ( useJS ) {

librariesPending.push( this._loadLibrary( 'draco_decoder.js', 'text' ) );
librariesPending.push( this._loadLibrary( JS_URL, 'text' ) );

} else {

librariesPending.push( this._loadLibrary( WASM_JS_URL, 'text' ) );
librariesPending.push( this._loadLibrary( WASM_BIN_URL, 'arraybuffer' ) );

}

} else {

librariesPending.push( this._loadLibrary( 'draco_wasm_wrapper.js', 'text' ) );
librariesPending.push( this._loadLibrary( 'draco_decoder.wasm', 'arraybuffer' ) );
if ( useJS ) {

librariesPending.push( this._loadLibrary( 'draco_decoder.js', 'text' ) );

} else {

librariesPending.push( this._loadLibrary( 'draco_wasm_wrapper.js', 'text' ) );
librariesPending.push( this._loadLibrary( 'draco_decoder.wasm', 'arraybuffer' ) );

}

}

Expand Down
2 changes: 0 additions & 2 deletions examples/webgl_tonemapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@
.setPath( 'textures/equirectangular/' );

const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath( 'jsm/libs/draco/gltf/' );

const gltfLoader = new GLTFLoader();
gltfLoader.setDRACOLoader( dracoLoader );
gltfLoader.setPath( 'models/gltf/' );
Expand Down
Loading