import { TextureLoader, MeshBasicMaterial, BackSide, DoubleSide} from 'three';

export function createPathStrings(filename: string) {
  const basePath = "assets/skybox/";
  const baseFilename = basePath + filename;    
  const fileType = ".png";
  const sides = ["ft", "bk", "up", "dn", "rt", "lf"];
  const pathStings = sides.map(side => {
    return baseFilename + "_" + side + fileType;    
  });
  return pathStings;
}


export function createMaterialArray(filename: string) {
  const skyboxImagepaths = createPathStrings(filename);
  const materialArray = skyboxImagepaths.map(image => {
    let texture = new TextureLoader().load(image);
    let material = new MeshBasicMaterial({ map: texture, side: BackSide }); 
    material.color.multiplyScalar(0.5);
    return material;
  });
  return materialArray;
}