提交 c8407b4c 编写于 作者: D Don McCurdy

GLTFLoader: Use mimetype to set texture format, if set.

上级 5996fab6
...@@ -1139,6 +1139,11 @@ THREE.GLTFLoader = ( function () { ...@@ -1139,6 +1139,11 @@ THREE.GLTFLoader = ( function () {
BLEND: 'BLEND' BLEND: 'BLEND'
}; };
var MIME_TYPE_FORMATS = {
'image/png': THREE.RGBAFormat,
'image/jpeg': THREE.RGBFormat
};
/* UTILITY FUNCTIONS */ /* UTILITY FUNCTIONS */
function resolveURL( url, path ) { function resolveURL( url, path ) {
...@@ -2042,6 +2047,13 @@ THREE.GLTFLoader = ( function () { ...@@ -2042,6 +2047,13 @@ THREE.GLTFLoader = ( function () {
if ( textureDef.name !== undefined ) texture.name = textureDef.name; if ( textureDef.name !== undefined ) texture.name = textureDef.name;
// Ignore unknown mime types, like DDS files.
if ( source.mimeType in MIME_TYPE_FORMATS ) {
texture.format = MIME_TYPE_FORMATS[ source.mimeType ];
}
var samplers = json.samplers || {}; var samplers = json.samplers || {};
var sampler = samplers[ textureDef.sampler ] || {}; var sampler = samplers[ textureDef.sampler ] || {};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册