未验证 提交 4e9b6b21 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #16993 from looeee/fbxloader_tga

FBXLoader: better support for TGA textures
...@@ -288,27 +288,15 @@ THREE.FBXLoader = ( function () { ...@@ -288,27 +288,15 @@ THREE.FBXLoader = ( function () {
case 'tga': case 'tga':
if ( typeof THREE.TGALoader !== 'function' ) { if ( THREE.Loader.Handlers.get( '.tga' ) === null ) {
console.warn( 'FBXLoader: THREE.TGALoader is required to load TGA textures' ); console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName );
return;
} else {
if ( THREE.Loader.Handlers.get( '.tga' ) === null ) {
var tgaLoader = new THREE.TGALoader();
tgaLoader.setPath( this.textureLoader.path );
THREE.Loader.Handlers.add( /\.tga$/i, tgaLoader );
}
type = 'image/tga';
break;
} }
type = 'image/tga';
break;
default: default:
console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' ); console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' );
...@@ -417,7 +405,7 @@ THREE.FBXLoader = ( function () { ...@@ -417,7 +405,7 @@ THREE.FBXLoader = ( function () {
if ( loader === null ) { if ( loader === null ) {
console.warn( 'FBXLoader: TGALoader not found, creating empty placeholder texture for', fileName ); console.warn( 'FBXLoader: TGA loader not found, creating placeholder texture for', textureNode.RelativeFilename );
texture = new THREE.Texture(); texture = new THREE.Texture();
} else { } else {
...@@ -428,7 +416,7 @@ THREE.FBXLoader = ( function () { ...@@ -428,7 +416,7 @@ THREE.FBXLoader = ( function () {
} else if ( extension === 'psd' ) { } else if ( extension === 'psd' ) {
console.warn( 'FBXLoader: PSD textures are not supported, creating empty placeholder texture for', fileName ); console.warn( 'FBXLoader: PSD textures are not supported, creating placeholder texture for', textureNode.RelativeFilename );
texture = new THREE.Texture(); texture = new THREE.Texture();
} else { } else {
...@@ -1554,6 +1542,7 @@ THREE.FBXLoader = ( function () { ...@@ -1554,6 +1542,7 @@ THREE.FBXLoader = ( function () {
}, },
// Parse single node mesh geometry in FBXTree.Objects.Geometry // Parse single node mesh geometry in FBXTree.Objects.Geometry
parseMeshGeometry: function ( relationships, geoNode, deformers ) { parseMeshGeometry: function ( relationships, geoNode, deformers ) {
......
...@@ -64,7 +64,6 @@ import { ...@@ -64,7 +64,6 @@ import {
VertexColors VertexColors
} from "../../../build/three.module.js"; } from "../../../build/three.module.js";
import { Zlib } from "../libs/inflate.module.min.js"; import { Zlib } from "../libs/inflate.module.min.js";
import { TGALoader } from "../loaders/TGALoader.js";
import { NURBSCurve } from "../curves/NURBSCurve.js"; import { NURBSCurve } from "../curves/NURBSCurve.js";
...@@ -337,27 +336,15 @@ var FBXLoader = ( function () { ...@@ -337,27 +336,15 @@ var FBXLoader = ( function () {
case 'tga': case 'tga':
if ( typeof TGALoader !== 'function' ) { if ( Loader.Handlers.get( '.tga' ) === null ) {
console.warn( 'FBXLoader: TGALoader is required to load TGA textures' ); console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName );
return;
} else {
if ( Loader.Handlers.get( '.tga' ) === null ) {
var tgaLoader = new TGALoader();
tgaLoader.setPath( this.textureLoader.path );
Loader.Handlers.add( /\.tga$/i, tgaLoader );
}
type = 'image/tga';
break;
} }
type = 'image/tga';
break;
default: default:
console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' ); console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' );
...@@ -466,7 +453,7 @@ var FBXLoader = ( function () { ...@@ -466,7 +453,7 @@ var FBXLoader = ( function () {
if ( loader === null ) { if ( loader === null ) {
console.warn( 'FBXLoader: TGALoader not found, creating empty placeholder texture for', fileName ); console.warn( 'FBXLoader: TGA loader not found, creating placeholder texture for', textureNode.RelativeFilename );
texture = new Texture(); texture = new Texture();
} else { } else {
...@@ -477,7 +464,7 @@ var FBXLoader = ( function () { ...@@ -477,7 +464,7 @@ var FBXLoader = ( function () {
} else if ( extension === 'psd' ) { } else if ( extension === 'psd' ) {
console.warn( 'FBXLoader: PSD textures are not supported, creating empty placeholder texture for', fileName ); console.warn( 'FBXLoader: PSD textures are not supported, creating placeholder texture for', textureNode.RelativeFilename );
texture = new Texture(); texture = new Texture();
} else { } else {
...@@ -1603,6 +1590,7 @@ var FBXLoader = ( function () { ...@@ -1603,6 +1590,7 @@ var FBXLoader = ( function () {
}, },
// Parse single node mesh geometry in FBXTree.Objects.Geometry // Parse single node mesh geometry in FBXTree.Objects.Geometry
parseMeshGeometry: function ( relationships, geoNode, deformers ) { parseMeshGeometry: function ( relationships, geoNode, deformers ) {
......
...@@ -87,7 +87,7 @@ var files = [ ...@@ -87,7 +87,7 @@ var files = [
{ path: 'loaders/DRACOLoader.js', dependencies: [], ignoreList: [ 'LoadingManager' ] }, { path: 'loaders/DRACOLoader.js', dependencies: [], ignoreList: [ 'LoadingManager' ] },
{ path: 'loaders/EXRLoader.js', dependencies: [], ignoreList: [] }, { path: 'loaders/EXRLoader.js', dependencies: [], ignoreList: [] },
{ path: 'loaders/EquirectangularToCubeGenerator.js', dependencies: [], ignoreList: [] }, { path: 'loaders/EquirectangularToCubeGenerator.js', dependencies: [], ignoreList: [] },
{ path: 'loaders/FBXLoader.js', dependencies: [ { name: 'Zlib', path: 'libs/inflate.module.min.js' }, { name: 'TGALoader', path: 'loaders/TGALoader.js' }, { name: 'NURBSCurve', path: 'curves/NURBSCurve.js' } ], ignoreList: [] }, { path: 'loaders/FBXLoader.js', dependencies: [ { name: 'Zlib', path: 'libs/inflate.module.min.js' }, { name: 'NURBSCurve', path: 'curves/NURBSCurve.js' } ], ignoreList: [] },
{ path: 'loaders/GCodeLoader.js', dependencies: [], ignoreList: [] }, { path: 'loaders/GCodeLoader.js', dependencies: [], ignoreList: [] },
{ path: 'loaders/GLTFLoader.js', dependencies: [], ignoreList: [ 'NoSide', 'Matrix2', 'Camera', 'Texture' ] }, { path: 'loaders/GLTFLoader.js', dependencies: [], ignoreList: [ 'NoSide', 'Matrix2', 'Camera', 'Texture' ] },
{ path: 'loaders/HDRCubeTextureLoader.js', dependencies: [ { name: 'RGBELoader', path: 'loaders/RGBELoader.js' } ], ignoreList: [] }, { path: 'loaders/HDRCubeTextureLoader.js', dependencies: [ { name: 'RGBELoader', path: 'loaders/RGBELoader.js' } ], ignoreList: [] },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册