Could someone kindly review the code snippet below for three.js r53?
This code was referenced from a question posted here: How to use multiple materials in a Three.js cube?
I attempted to implement this code with slight modifications, but unfortunately I am not seeing the expected visible cubes. I have ensured that my texture images are correctly named.
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());