/*
 * Creation de la camera, lumiere et de la skybox pour l'effet reflet (pour bubble et superTube)
 */
function skyBox(couleurs) {
    //camera cube
    cameraCube = new THREE.PerspectiveCamera(50, 1, 1, 1000);
    cameraCube.position.set(0, 0, 500);
    sceneCube = new THREE.Scene();

    renderer.autoClear = false;
    renderer.render(sceneCube, cameraCube);

    var fond = couleurs[0].replace("#", ""); //# ne passe pas dans le nom d'un fichier

    //skybox
    var path = "../img/skybox/carousel/";
    var metal = 'metal';
    var format = '.bmp'; //format panorama

//        var path = "../img/skybox/";
//        var format = '.png';
    var urls = [
        path + 'px' + format, path + 'nx' + format,
        path + 'py' + format, path + 'ny' + format,
        path + 'pz' + format, '../img/skybox/' + fond + '.png'
//                path + metal + format, path + metal + format,
//                path + metal + format, path + metal + format,
//                path + metal + format, path + metal + format
    ];
//            var textureCube = THREE.ImageUtils.loadTextureCube(urls, THREE.CubeRefractionMapping);
    var textureCube = THREE.ImageUtils.loadTextureCube(urls);

//            textureCube.format = THREE.RGBFormat;

    // Skybox
    var shader = THREE.ShaderLib[ "cube" ];
    shader.uniforms[ "tCube" ].value = textureCube;

    var material = new THREE.ShaderMaterial({
        fragmentShader: shader.fragmentShader,
        vertexShader: shader.vertexShader,
        uniforms: shader.uniforms,
        depthWrite: false,
        side: THREE.BackSide

    });
    var mesh = new THREE.Mesh(new THREE.BoxGeometry(1000, 1000, 1000), material);
    sceneCube.add(mesh);

    //lumiere
    var ambient = new THREE.AmbientLight(0xffffff);
    scene.add(ambient);

    directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
    directionalLight.position.set(2, 1.2, 10).normalize();
    scene.add(directionalLight);

    directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
    directionalLight.position.set(-2, 1.2, -10).normalize();
    scene.add(directionalLight);

    pointLight = new THREE.PointLight(0xffffff, 0.5);
    pointLight.position.set(2000, 1200, 10000);
    scene.add(pointLight);

    return textureCube;
}