function createCubeTile(x = 0, y = 0, z = 0, l = 1,i,j) {
const group = new THREE.Group();
const geometry = new THREE.PlaneGeometry();
let tex, material = null;
const planes = [];
for (let k = 0; k <6; k++){
tex = new THREE.CanvasTexture(images[k]);
tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
if (k==2||k==5){
tex.offset.set(i/4, (j+1)/4);
tex.repeat.set(1/4, -1/4);
} else {
tex.offset.set(i/4, j/4);
tex.repeat.set(1/4, 1/4);
}
material = new THREE.MeshBasicMaterial({
color: 0xffffff,
side: THREE.DoubleSide,
map: tex
});
planes.push(new THREE.Mesh(geometry, material));
}
planes[0].position.set(0,0,0.5);
planes[1].position.set(0,0,-0.5);
planes[2].position.set(0,0.5,0);
planes[3].position.set(0,-0.5,0);
planes[4].position.set(0.5,0,0);
planes[5].position.set(-0.5,0,0);
planes[2].rotation.set(Math.PI/2,0,0);
planes[3].rotation.set(Math.PI/2,0,0);
planes[4].rotation.set(0,Math.PI/2,0);
planes[5].rotation.set(Math.PI,Math.PI/2,0);
for (let k in planes){
group.add(planes[k]);
}
group.position.set(x/2,y/2,z/2)
return group;
}