效果
可视域在三维中是比较常用的分析功能,很多领域中都能应用到。

代码
创建起终点,模拟相机的视锥绘制视锥体,创建点光源添加阴影效果。

可视域分析代码

class Viewshed {

  /**
   * 通视分析构造函数
   * @method constructor
   * @param viewer Cesium.Viewer 对象
   * 
   */
  constructor(viewer) {
    this._viewer = viewer;
    this._scene = viewer.scene;
    this._camera = this._scene.camera;
    this.context = this._scene.context;


this._visibleColor = Cesium.Color.LIME;
this._inVisibleColor = Cesium.Color.RED;
this._offsetDist = 0.2;
this._viewPoint = null;
this.timeId;
//视点位置
this.cameraPosition = null;
//标识符
this.startAnalyze = false;
//阴影参数
this.shadowOptions;
this.handler;
//聚光灯光源
this.spotLightCamera;
//光源参数
this.radii;
this.heading;
this.roll;
this.pitch;
this.tempFrustum;
this.normalShaderFun = null;
this.normalShader;
this.lightSwitch = false;
this.testOn = false;

this.entities = [];
this.activeShapePoints = [];
this._showDistance = true;
this._s



此内容 登录注册 后可见
1 年 后

老师,用的时候报了一个错误, Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.问题大概出在什么地方呢...

此内容 登录注册 后可见
    13 天 后

    vip888 后来我修复以后,还遇到另一个问题,就是功能在检测到没有地形的地方(这些地方是天地图的影像图层),虽然是平地但是视域分析显示看不到,请问您遇到过吗

    此内容 登录注册 后可见

      hlisonChou 我没试过1.100以后的版本,1.9左右版本一般只要有3dtiles就可以,可能是你开了深度检测,没地形的时候开启深度检测是会出问题的。

      此内容 登录注册 后可见
        4 个月 后
        4 个月 后

        Can you share the fully working version of the code?

        您能分享代码的完整工作版本吗?...

        此内容 登录注册 后可见

        可以分享一下完整的代码吗?

        Can you share the full code of the code?...

        此内容 登录注册 后可见
          1 个月 后
          说点什么吧...