import createSkyboxImage from "./createSkyboxImage.js";

// Cesium ion access token.
Cesium.Ion.defaultAccessToken =
    "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4M2ZhYzM4My1lN2NhLTRjNTktODY1OC1jZDdmOTU3Y2ZjMGEiLCJpZCI6MTMwNTAsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NjI0NzA5NzB9.rRTs6chsWJdo9KNYe5VjJj2fUzMHeniIJvFQOd0aLJU";

console.log("Cesium 启动");

const viewer = new Cesium.Viewer("cesiumContainer");


const width = 3522;
const py = createSkyboxImage(2, width);
/*
const py = createImage( width);
const pz = createImage( width);
const nx = createImage( width);
const ny = createImage( width);
const nz = createImage( width);
*/

//  自定义的天空盒
viewer.scene.skyBox = new Cesium.SkyBox({
    sources: {
        
        positiveX: "./Skybox/SkyCube2k/skyCube2k_px.jpg",
        negativeX: "./Skybox/SkyCube2k/skyCube2k_mx.jpg",
        positiveY: "./Skybox/SkyCube2k/skyCube2k_py.jpg",
        negativeY: "./Skybox/SkyCube2k/skyCube2k_my.jpg",
        positiveZ: "./Skybox/SkyCube2k/skyCube2k_pz.jpg",
        negativeZ: "./Skybox/SkyCube2k/skyCube2k_mz.jpg",
/*
        positiveX: px,
        negativeX: nx,
        positiveY: py,
        negativeY: ny,
        positiveZ: pz,  
        negativeZ: nz,
                */
    },
});


 // 创建下载链接
 const link = document.createElement('a');
 link.download = 'px.jpg';
 link.href = py;

 // 模拟点击下载链接
 document.body.appendChild(link);
 link.click();
 document.body.removeChild(link);



// 显示帧率
viewer.scene.debugShowFramesPerSecond = true;