2017-08-01 67 views

回答

4

在three.js的新版本中,您必須使用簡單的數組和(項目)materilas而不是multimaterials。下面是例子:

var geometry = new THREE.BoxBufferGeometry(1, 1, 1); 
var materials = [ 
    new THREE.MeshDepthMaterial(), 
    new THREE.MeshNormalMaterial(), 
    new THREE.MeshBasicMaterial({ wireframe: true }), 
    new THREE.MeshLambertMaterial({ color: 0xff0000 }), 
    new THREE.MeshPhongMaterial({ color: 0x0000ff }), 
    new THREE.MeshStandardMaterial({ color: 0x00ff00 }), 
]; 
var mesh = new THREE.Mesh(geometry, materials); 

同樣重要!訪問看起來像:

if (Array.isArray(object.material)) { 
    for (var m = 0; m < object.material.length; m ++) { 
     object.material[ m ].color.set(0xffffff); 
    } 
} else { 
    object.material.color.set(0xffffff); 
} 
相關問題