From cfacb47f9ab14e17d926a2cea888df4ab0f69a0e Mon Sep 17 00:00:00 2001 From: Takahiro Date: Wed, 18 Jan 2017 21:08:19 -0800 Subject: [PATCH] Support Texture format in GLTFLoader --- examples/js/loaders/GLTFLoader.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index ee9d9f2471..bfcfedb9d9 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/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 ) { -- GitLab