|
@@ -125,31 +125,16 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),
|
|
|
|
|
|
loader.load( url, ( buffer ) => {
|
|
|
|
|
|
- var taskKey = JSON.stringify( url );
|
|
|
-
|
|
|
// Check for an existing task using this buffer. A transferred buffer cannot be transferred
|
|
|
// again from this thread.
|
|
|
if ( BasisTextureLoader.taskCache.has( buffer ) ) {
|
|
|
|
|
|
var cachedTask = BasisTextureLoader.taskCache.get( buffer );
|
|
|
|
|
|
- if ( cachedTask.key === taskKey ) {
|
|
|
+ if ( cachedTask.url === url ) {
|
|
|
|
|
|
return cachedTask.promise.then( onLoad ).catch( onError );
|
|
|
|
|
|
- } else if ( buffer.byteLength === 0 ) {
|
|
|
-
|
|
|
- // Technically, it would be possible to wait for the previous task to complete,
|
|
|
- // transfer the buffer back, and decode again with the second configuration. That
|
|
|
- // is complex, and I don't know of any reason to decode a Basis buffer twice in
|
|
|
- // different ways, so this is left unimplemented.
|
|
|
- throw new Error(
|
|
|
-
|
|
|
- 'THREE.BasisTextureLoader: Unable to re-decode a buffer with different ' +
|
|
|
- 'settings. Buffer has already been transferred.'
|
|
|
-
|
|
|
- );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -246,12 +231,10 @@ BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),
|
|
|
|
|
|
} );
|
|
|
|
|
|
- var taskKey = JSON.stringify( url );
|
|
|
-
|
|
|
// Cache the task result.
|
|
|
BasisTextureLoader.taskCache.set( buffer, {
|
|
|
|
|
|
- key: taskKey,
|
|
|
+ url: url,
|
|
|
promise: texturePending
|
|
|
|
|
|
} );
|