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
1 change: 0 additions & 1 deletion examples/jsm/libs/basis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Both are dependencies of `KTX2Loader`:

```js
const ktx2Loader = new KTX2Loader();
ktx2Loader.setTranscoderPath( 'examples/jsm/libs/basis/' );
ktx2Loader.detectSupport( renderer );
ktx2Loader.load( 'diffuse.ktx2', function ( texture ) {

Expand Down
1 change: 0 additions & 1 deletion examples/jsm/libs/draco/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Either variation may be used with `DRACOLoader`:
```js
var dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath('path/to/decoders/');
dracoLoader.setDecoderConfig({type: 'js'}); // (Optional) Override detection of WASM support.
```

Further [documentation on GitHub](https://github.com/google/draco/tree/master/javascript/example#static-loading-javascript-decoder).
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/loaders/DRACOLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ class DRACOLoader extends Loader {
/**
* Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins.
*
* @deprecated
* @param {{type:('js'|'wasm')}} config - The decoder config.
* @return {DRACOLoader} A reference to this loader.
*/
setDecoderConfig( config ) {

console.warn( 'THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194.' );
this.decoderConfig = config;

return this;
Expand Down
33 changes: 24 additions & 9 deletions examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ import {
import { ZSTDDecoder } from '../libs/zstddec.module.js';
import { DisplayP3ColorSpace, LinearDisplayP3ColorSpace } from '../math/ColorSpaces.js';

const WASM_BIN_URL = new URL( '../libs/basis/basis_transcoder.wasm', import.meta.url ).toString();
const WASM_JS_URL = new URL( '../libs/basis/basis_transcoder.js', import.meta.url ).toString();

const _taskCache = new WeakMap();

let _activeLoaders = 0;
Expand Down Expand Up @@ -169,9 +172,9 @@ class KTX2Loader extends Loader {
}

/**
* Sets the transcoder path.
* Sets the transcoder path to optionally set the decoder load path from a CDN.
*
* The WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory.
* By default The WASM transcoder and JS wrapper are loaded from the `examples/jsm/libs/basis` directory.
*
* @param {string} path - The transcoder path to set.
* @return {KTX2Loader} A reference to this loader.
Expand Down Expand Up @@ -280,18 +283,30 @@ class KTX2Loader extends Loader {

if ( ! this.transcoderPending ) {

// Load transcoder wrapper.
const jsLoader = new FileLoader( this.manager );
jsLoader.setPath( this.transcoderPath );
jsLoader.setWithCredentials( this.withCredentials );
const jsContent = jsLoader.loadAsync( 'basis_transcoder.js' );

// Load transcoder WASM binary.
const binaryLoader = new FileLoader( this.manager );
binaryLoader.setPath( this.transcoderPath );
binaryLoader.setResponseType( 'arraybuffer' );
binaryLoader.setWithCredentials( this.withCredentials );
const binaryContent = binaryLoader.loadAsync( 'basis_transcoder.wasm' );
binaryLoader.setResponseType( 'arraybuffer' );

let jsContent, binaryContent;
if ( this.transcoderPath === '' ) {

jsContent = jsLoader.loadAsync( WASM_JS_URL );
binaryContent = binaryLoader.loadAsync( WASM_BIN_URL );

} else {

// Load transcoder wrapper.
jsLoader.setPath( this.transcoderPath );
jsContent = jsLoader.loadAsync( 'basis_transcoder.js' );

// Load transcoder WASM binary.
binaryLoader.setPath( this.transcoderPath );
binaryContent = binaryLoader.loadAsync( 'basis_transcoder.wasm' );

}

this.transcoderPending = Promise.all( [ jsContent, binaryContent ] )
.then( ( [ jsContent, binaryContent ] ) => {
Expand Down
293 changes: 0 additions & 293 deletions examples/jsm/tsl/display/AnamorphicNode.js

This file was deleted.

Loading