Parcourir la source

Support Texture format in GLTFLoader

Takahiro il y a 8 ans
Parent
commit
cfacb47f9a
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  1. 9 0
      examples/js/loaders/GLTFLoader.js

+ 9 - 0
examples/js/loaders/GLTFLoader.js

@@ -1072,6 +1072,15 @@ THREE.GLTFLoader = ( function () {
 
 							if ( texture.name !== undefined ) _texture.name = texture.name;
 
+							_texture.format = texture.format !== undefined ? WEBGL_TEXTURE_FORMATS[ texture.format ] : THREE.RGBAFormat;
+
+							if ( texture.internalFormat !== undefined && _texture.format !== WEBGL_TEXTURE_FORMATS[ texture.internalFormat ] ) {
+
+								console.warn( 'THREE.GLTFLoader: Three.js doesn\'t support texture internalFormat which is different from texture format. ' +
+								              'internalFormat will be forced to be the same value as format.' );
+
+							}
+
 							_texture.type = texture.type !== undefined ? WEBGL_TEXTURE_TYPES[ texture.type ] : THREE.UnsignedByteType;
 
 							if ( texture.sampler ) {