Hi! I’m having some struggle with loading the textures for a skybox.
I’ve been trying to understand what happens but can’t find a solution. I think that has something to do with immutability and deep copying, but can’t solve it. If someone has any hint would appreciate it very much!
My code:
let materialArray = [];
let textute_ft = THREE.TextureLoader().load('skybox/interstellar_ft.jpg');
let textute_bk = THREE.TextureLoader().load('skybox/interstellar_bk.jpg');
let textute_up = THREE.TextureLoader().load('skybox/interstellar_up.jpg');
let textute_dn = THREE.TextureLoader().load('skybox/interstellar_dn.jpg');
let textute_rt = THREE.TextureLoader().load('skybox/interstellar_rt.jpg');
let textute_lf = THREE.TextureLoader().load('skybox/interstellar_lf.jpg');
materialArray.push(new THREE.MeshBasicMaterial({map: texture_ft}));
materialArray.push(new THREE.MeshBasicMaterial({map: texture_bk}));
materialArray.push(new THREE.MeshBasicMaterial({map: texture_up}));
materialArray.push(new THREE.MeshBasicMaterial({map: texture_dn}));
materialArray.push(new THREE.MeshBasicMaterial({map: texture_rt}));
materialArray.push(new THREE.MeshBasicMaterial({map: texture_lf}));
for (i=0;i<6;i++){
materialArray[i].side = THREE.BackSide;
}
let skyboxgeo = new THREE.BoxGeometry(10000,10000,10000);
let skybox = new THREE.Mesh(skyboxgeo, materialArray);
scene.add(skybox);
The error:
Thank you very much in advance!!