cesium动态水面(水面几何挖洞)

animatingWater() {
    let viewer = this.props.viewer;
    //河道多边形
    let position = Cesium.Cartesian3.fromDegreesArray(riverArray);
    let holes = Cesium.Cartesian3.fromDegreesArray(holesArray);
    var x = {
      positions: position,
      //由于挖的这个洞,是x本身的一种数组集合,所以每一个对象里,又是一个x的形式
      holes: [{ positions: holes }]
    };
    // // new Cesium.PolygonHierarchy(),
    var polygon1 = new Cesium.PolygonGeometry({
      polygonHierarchy: x,
      // hierarchy:x,
      // extrudedHeight:0, //与height不能同时存在,否则height不生效
      height: 19.0,
      // perPositionHeight:false,
      // outline: true,
      // outlineWidth: 100,
      // fill: false,
      // arcType: Cesium.ArcType.RHUMB,
      // material: Cesium.Color.RED,
      vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT
    });
    River1 = new Cesium.Primitive({
      geometryInstances: new Cesium.GeometryInstance({
        geometry: polygon1
      }),
      appearance: new Cesium.EllipsoidSurfaceAppearance({
        aboveGround: true
      }),
      show: true
    });
    var River1_Material = new Cesium.Material({
      fabric: {
        type: 'Water',
        uniforms: {
          // baseWaterColor:new Cesium.Color('#1E90FF'),00BFFF #40E0D0
          blendColor: new Cesium.Color("#008B45"),
          normalMap: waterNormals,
          frequency: 100.0,
          animationSpeed: 0.005,
          amplitude: 10.0,
        }
      }
    });
    River1.appearance.material = River1_Material;
    viewer.scene.primitives.add(River1);
  }
//水体坐标格式
 const riverArray = [
    118.23398069450448, 33.953187522423235, 118.23398845952485, 33.953059535040296]
 const holesArray = [
    118.23339517412681, 33.953153320913984, 118.22892645014714, 33.95289219246603]
 

你可能感兴趣的:(cesium动态水面(水面几何挖洞))