我的github

1.3.Camera.js

              if (cartographic.height < height) {
                    cartographic.height = height;
                    if (mode === SceneMode.SCENE3D) {
                        ellipsoid.cartographicToCartesian(cartographic, this.position);
                    } else {
                        projection.project(cartographic, this.position);
                    }
                    heightUpdated = true;
                }

改为

                if (cartographic.height < height) {
                    if (M.underEarth.enable && cartographic.height > (height - M.underEarth.enableDepth)){
                        return;
                    }
                    cartographic.height = height;
                    if (mode === SceneMode.SCENE3D) {
                        ellipsoid.cartographicToCartesian(cartographic, this.position);
                    } else {
                        projection.project(cartographic, this.position);
                    }
                    heightUpdated = true;
                }

主要是监测到进入地下不自己弹出来的问题

参考:https://www.shuzhiduo.com/A/rV57QjWazP/

第一步:

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(, , , );

viewer.scene.globe.imageryLayers.get().alpha = 0.5;

viewer.scene.globe.depthTestAgainstTerrain = !;

viewer.scene.highDynamicRange = !;

viewer.scene.skyAtmosphere.show = !;

viewer.scene.skyBox.show = !;

var blueBox = viewer.entities.add({

name: 'Blue box',

position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, ),

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

 

posted on 2021-12-13 16:06  XiaoNiuFeiTian  阅读(1619)  评论(0编辑  收藏  举报