Vue.js2+Cesium1.103.0 八、动态光墙效果

Vue.js2+Cesium1.103.0 八、动态光墙效果

Demo

<template>
  <div
    id="cesium-container"
    style="width: 100%; height: 100%;"
  />
</template>

<script>
/* eslint-disable no-undef */
import '@/utils/dynamicWallMaterialProperty.js'
export default {
  data() {
    return {}
  },
  computed: {},
  watch: {},
  mounted() {
    window.$InitMap()

    // viewer.camera.flyTo({
    //   destination: Cesium.Rectangle.fromDegrees(
    //     108.93447869899144,
    //     34.21942105070211,
    //     108.98528666210252,
    //     34.24828003352733
    //   )
    // })

    const tileset = new Cesium.Cesium3DTileset({
      url: 'https://lab.earthsdk.com/model/f15b9e90ac2d11e99dbd8fd044883638/tileset.json', // 大雁塔
      debugShowMemoryUsage: false
    })
    viewer.scene.primitives.add(tileset)
    viewer.zoomTo(tileset)

    addWall(
      [
        108.95816733886228, 34.22253637959828, 108.95820680817125,
        34.21706473291823, 108.96123913566905, 34.21706546799099,
        108.96179243633605, 34.21702583001026
      ],
      [470, 470, 470, 470],
      [420, 420, 420, 420],
      '#ffff00',
      require('@/assets/images/gradation.png'),
      1000
    )
    addWall(
      [
        108.9590995, 34.2201324, 108.9598067, 34.2201193, 108.9598333,
        34.2195012, 108.9590877, 34.2195194, 108.9590995, 34.2201324
      ],
      [470, 470, 470, 470, 470],
      [420, 420, 420, 420, 420],
      '#20E8E980',
      require('@/assets/images/gradation.png'),
      1000
    )

    function addWall(
      positions,
      maximumHeights,
      minimumHeights,
      color,
      image,
      duration
    ) {
      const entity = viewer.entities.add({
        wall: {
          positions: Cesium.Cartesian3.fromDegreesArray(positions),
          maximumHeights: maximumHeights,
          minimumHeights: minimumHeights,
          // disableDepthTestDistance: Number.POSITIVE_INFINITY,
          // heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
          material: new Cesium.DynamicWallMaterialProperty({
            color: Cesium.Color.fromCssColorString(color),
            trailImage: image,
            duration: duration
          })
        }
      })
      return entity
    }
  },
  methods: {}
}
</script>

  <style></style>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值