记录一下运用cesium中遇到的问题。
前段时间用cesium绘制了经纬网,效果还可以,后来项目中要用到深度测试加了这个属性(viewer.scene.globe.depthTestAgainstTerrain = true;),导致经纬网断线,如下图:折线排除cesium深度测试(viewer.scene.globe.depthTestAgainstTerrain = true;)干扰的解决办法
在网上找了很久,终于找到解决办法:
方法一、Set clampToGround: true
方法二、Adding a height of at least 1000 to the polyline points
方法三、Turning off viewer.scene.globe.depthTestAgainstTerrain

由于我是用Polyline和PolylineCollection绘制的,这两个类里没有clampToGround参数,所以第一种方法对我来说没有多大用处。不过PolylineGraphics类中有这个参数,用PolylineGraphics绘制的朋友可以试一下方法一。
折线排除cesium深度测试(viewer.scene.globe.depthTestAgainstTerrain = true;)干扰的解决办法
我是用的第二种方法解决的,直接给线加上1000的高度就可以了。
折线排除cesium深度测试(viewer.scene.globe.depthTestAgainstTerrain = true;)干扰的解决办法

至于第三种方法,由于要做深度测试,肯定是行不通的。
这里贴上原文地址:https://github.com/CesiumGS/cesium/issues/7783供大家参考。
有需要经纬网绘制源码的小伙伴可以参考我的上一篇文章。

相关文章:

  • 2022-12-23
  • 2021-06-03
  • 2021-12-06
  • 2021-11-14
  • 2021-06-05
  • 2022-02-26
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2021-05-10
  • 2021-12-15
  • 2022-01-19
  • 2021-11-25
  • 2022-01-15
  • 2022-12-23
  • 2021-07-09
相关资源
相似解决方案