提交 16c77e76 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #10605 from takahirox/GLTFLoaderUpdate

Stricter glTF texture support
......@@ -463,6 +463,21 @@ THREE.GLTFLoader = ( function () {
10497: THREE.RepeatWrapping
};
var WEBGL_TEXTURE_FORMATS = {
6406: THREE.AlphaFormat,
6407: THREE.RGBFormat,
6408: THREE.RGBAFormat,
6409: THREE.LuminanceFormat,
6410: THREE.LuminanceAlphaFormat
};
var WEBGL_TEXTURE_DATATYPES = {
5121: THREE.UnsignedByteType,
32819: THREE.UnsignedShort4444Type,
32820: THREE.UnsignedShort5551Type,
33635: THREE.UnsignedShort565Type
};
var WEBGL_SIDES = {
1028: THREE.BackSide, // Culling front
1029: THREE.FrontSide // Culling back
......@@ -1055,6 +1070,19 @@ THREE.GLTFLoader = ( function () {
_texture.flipY = false;
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_DATATYPES[ texture.type ] : THREE.UnsignedByteType;
if ( texture.sampler ) {
var sampler = json.samplers[ texture.sampler ];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册