2015-12-21 62 views
1

這是我的代碼片段 -three.js - 如何導出MultiMaterial?

materialArray=[]; 
materialArray.push(new THREE.MeshBasicMaterial({map:frontCounterTexture})); 
materialArray.push(new THREE.MeshBasicMaterial({map:frontCounterTexture})); 
materialArray.push(new THREE.MeshBasicMaterial({map:frontCounterTexture})); 
materialArray.push(new THREE.MeshBasicMaterial({map:blackTexture})); 
materialArray.push(new THREE.MeshBasicMaterial({map:blackTexture})); 
materialArray.push(new THREE.MeshBasicMaterial({map:blackTexture})); 

frontCounterMaterial=new THREE.MultiMaterial(materialArray); 
frontCounter.material=frontCounterMaterial; 

現場被使用編輯器(threejs /編輯)正確地呈現,但出口不工作。 當我做如下 -

frontCounter.toJSON() 

我得到以下 -

Uncaught TypeError: Cannot read property 'textures' of undefined(…) 

我追溯回 -

THREE.Texture.toJSON: 
if (meta.textures[ this.uuid ] !== undefined) { 

     return meta.textures[ this.uuid ]; 

    } 

我不知道如何解決這個問題,那就是導出應用了MultiMaterial的Mesh。任何幫助?

回答