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