2
0
Эх сурвалжийг харах

GLTFLoader: Fix handling of GLTF files with optional KTX2 extensions

If KTX2 loader wasn't registered, we would previously fail to load GLTF
files that used BasisU; this is a problem since files that don't require
BasisU support but specify it optionally would incorrectly fail.

The tradeoff here is that the error message that we previously emitted
for cases where the extension was required is now no more; we need some
mechanism for required extensions to actually be enforced to solve this.
Arseny Kapoulkine 4 жил өмнө
parent
commit
9a7349aff8

+ 2 - 1
examples/js/loaders/GLTFLoader.js

@@ -696,7 +696,8 @@ THREE.GLTFLoader = ( function () {
 
 		if ( ! loader ) {
 
-			throw new Error( 'THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures' );
+			// Assumes that the extension is optional and that a fallback texture is present; ideally we should handle extensionsRequired better
+			return null;
 
 		}
 

+ 2 - 1
examples/jsm/loaders/GLTFLoader.js

@@ -759,7 +759,8 @@ var GLTFLoader = ( function () {
 
 		if ( ! loader ) {
 
-			throw new Error( 'THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures' );
+			// Assumes that the extension is optional and that a fallback texture is present; ideally we should handle extensionsRequired better
+			return null;
 
 		}