提交 f8dc0a93 编写于 作者: M Mr.doob

ObjectLoader: Refactored MultiMatrial cache code.

上级 f6360326
......@@ -453,8 +453,8 @@ Object.assign( ObjectLoader.prototype, {
parseMaterials: function ( json, textures ) {
var cache = {}; // MultiMaterial
var materials = {};
var cache = {};
if ( json !== undefined ) {
......@@ -468,25 +468,24 @@ Object.assign( ObjectLoader.prototype, {
if ( data.type === 'MultiMaterial' ) {
// Deprecated
var array = [];
for ( var j = 0; j < data.materials.length; j ++ ) {
if ( cache[ data.materials[ j ].uuid ] ) {
for ( var j = 0; j < data.materials.length; j ++ ) {
array.push( cache[ data.materials[ j ].uuid ] );
var material = data.materials[ j ];
} else {
if ( cache[ material.uuid ] === undefined ) {
var mat = loader.parse( data.materials[ j ] );
cache[ data.materials[ j ].uuid ] = mat;
array.push( mat );
cache[ material.uuid ] = loader.parse( material );
}
array.push( cache[ material.uuid ] );
}
materials[ data.uuid ] = array;
cache[ data.uuid ] = array;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册