cesium地下模式(地表透明)1


cesium沒有提供地下功能,實現地下模式需要以下三步。

1.修改cesium源碼,在GlobeSurfaceTileProvider.js文件里修改一行代碼

command.pass = Pass.GLOBE;

改為

command.pass = Pass.TRANSLUCENT;

2.重新打包

npm run minifyRelease

3.在沙盒里加入以下代碼

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.scene.globe.baseColor = new Cesium.Color(0, 0, 0, 0);
viewer.scene.globe.imageryLayers.get(0).alpha = 0.5;
viewer.scene.globe.depthTestAgainstTerrain = !0;
viewer.scene.highDynamicRange = !1;
viewer.scene.skyAtmosphere.show = !1;
viewer.scene.skyBox.show = !1;
var blueBox = viewer.entities.add({
    name: 'Blue box',
    position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 5),
    box: {
        dimensions: new Cesium.Cartesian3(100.0, 100.0, 5000.0),
        material: Cesium.Color.RED
    }
});
viewer.zoomTo(blueBox);

 將會看到以下樣式

 

 

 還有以下問題沒有解決?

1.進入地下會自動彈上來問題

2.地下看地上長方體並沒有遮擋的感覺

3.白色網格

解決這個問題將會在下一篇博客。

https://www.cnblogs.com/SmilingEye/p/11473987.html

 

參考:

火星示例:http://cesium.marsgis.cn/cesium-example/editor.html#42_underground

問題解決最開始來源:https://stackoverflow.com/questions/41541223/how-to-display-data-underground-in-cesium-js


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM