Browse Source

FBXLoader: Use `getHandler()` for custom texture loaders. (#31032)

* add capable of custom texture loader

* replace factory to setXXXLoader

* Update FBXLoader.js

* fix indent

* use manager.getHandler

* fix loader variable name

* fix url

* use getHandler for all extensions

* Update FBXLoader.js

Clean up.

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
tatsuya-ogawa 9 months ago
parent
commit
e367e2b6c9
1 changed files with 2 additions and 13 deletions
  1. 2 13
      examples/jsm/loaders/FBXLoader.js

+ 2 - 13
examples/jsm/loaders/FBXLoader.js

@@ -437,21 +437,10 @@ class FBXTreeParser {
 	// load a texture specified as a blob or data URI, or via an external URL using TextureLoader
 	loadTexture( textureNode, images ) {
 
-		const nonNativeExtensions = new Set( [ 'tga', 'tif', 'tiff', 'exr', 'dds', 'hdr', 'ktx2' ] );
-
 		const extension = textureNode.FileName.split( '.' ).pop().toLowerCase();
 
-		const loader = nonNativeExtensions.has( extension ) ? this.manager.getHandler( `.${extension}` ) : this.textureLoader;
-
-		if ( ! loader ) {
-
-			console.warn(
-				`FBXLoader: ${extension.toUpperCase()} loader not found, creating placeholder texture for`,
-				textureNode.RelativeFilename
-			);
-			return new Texture();
-
-		}
+		let loader = this.manager.getHandler( `.${extension}` );
+		if ( loader === null) loader = this.textureLoader;
 
 		const loaderPath = loader.path;
 

粤ICP备19079148号