xyj3d API 文档 - v1.0.0
    正在准备搜索索引...

    类 Fog

    雾(基于深度的后处理)。

    用 Cesium.PostProcessStage 自绘 GLSL 实现,同时算「距离雾」和「高度雾」: 远处的物体变淡、height 以下的区域先起雾,适合做山谷雾、晨雾。

    惰性创建:第一次 enable = true 才建后处理阶段并加入 scene.postProcessStages;enable = false 只翻 enabled(保留 GPU 资源)。 彻底释放请调用 Fog#destroy。

    const weather = new xyj3d.Weather(viewer)
    weather.fog.color = xyj3d.Color.from("#fff", 0.75)
    weather.fog.visibility = 15000
    weather.fog.height = 800
    weather.fog.heightRange = 600
    weather.fog.enable = true
    索引

    构造函数

    • 构造函数

      参数

      参数名称类型默认值描述信息
      viewerViewer—场景

      返回 Fog

    属性

    type: string

    类型

    state: string

    当前状态,取值见 State(initialized / enabled / disabled)

    enable: boolean

    是否开启。首次置 true 时惰性创建后处理阶段。

    color: Color

    雾的颜色(透明度取 alpha,默认 0.6)

    visibility: unknown

    能见度(米,默认 20000):近距离清晰、越远越白, 取 2000 这种小值就是浓雾

    height: number

    起雾高度(米,海拔),该高度以下雾最浓

    heightRange: unknown

    高度过渡范围(米):从 height 到 height + heightRange 逐渐变淡

    方法

    • 销毁:从 scene.postProcessStages 移除并 destroy() 本阶段,释放帧缓冲。 重复调用安全;销毁后再 enable = true 会重新创建。

      返回 unknown

    • 是否已销毁

      返回 boolean

      • 是否已销毁