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;
}
});
参考官网示例修改的天空盒,星空正常加载,近地面天空盒变为纯黑色,没有加载出我的素材,控制台也没有报错