按照官网示例添加的天空盒,加载失败,天空变为纯黑色,控制台没有错误提示
const qingtianSkyBox=new Cesium.SkyBox({
nearGround:true,
sources:{
positiveX:'../assets/天空盒素材/Right.png',
negativeX:'../assets/天空盒素材/Left.png',
positiveY:'../assets/天空盒素材/Front.png',
negativeY:'../assets/天空盒素材/Back.png',
positiveZ:'../assets/天空盒素材/Up.png',
negativeZ:'../assets/天空盒素材/Down.png',
}
})
const defaultSkyBox=viewer.scene.skyBox
const currentSkyBox=qingtianSkyBox
scene.skyBox=currentSkyBox
scene.postRender.addEventListener(function() {
var cameraHeight = scene.camera.positionCartographic.height;
var toggleHeight = 23e4;
if(cameraHeight < toggleHeight && Cesium.defined(currentSkyBox)) {
scene.skyBox = currentSkyBox;
scene.skyAtmosphere.show = false;
} else {
scene.skyBox = defaultSkyBox;
scene.skyAtmosphere.show = true;
}
});