Qualcuno può verificare il seguente codice per three.js r53?Verifica dell'utilizzo di più trame con cubi three.js
E 'tratto da questa domanda: How to use multiple materials in a Three.js cube?
Ho provato questo codice e poche variazioni, ma non ottengo i cubi visibili. Le mie immagini di texture sono nominate come dovrebbero essere.
var materials = [];
for (var i=0; i<6; i++) {
var img = new Image();
img.src = i + '.png';
var tex = new THREE.Texture(img);
img.tex = tex;
img.onload = function() {
this.tex.needsUpdate = true;
};
var mat = new THREE.MeshBasicMaterial({color: 0xffffff, map: tex});
materials.push(mat);
}
var cubeGeo = new THREE.CubeGeometry(400, 400, 400, 1, 1, 1, materials);
var cube = new THREE.Mesh(cubeGeo, new THREE.MeshFaceMaterial());
anche CubeGeometry rinominato per BoxGeometry (R66) – imcg
@imcg Grazie. Risposta aggiornata – WestLangley