zoukankan      html  css  js  c++  java
  • 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 = [
        123.3, 34.3, 123.4, 33.3]
     const holesArray = [
        123.3, 33.5, 123.8, 33.9]
     
    
  • 相关阅读:
    bzoj2395: [Balkan 2011]Timeismoney
    bzoj2725: [Violet 6]故乡的梦&&bzoj4400: tjoi2012 桥
    bzoj3047: Freda的传呼机&bzoj2125: 最短路
    bzoj2734: [HNOI2012]集合选数
    bzoj2728: [HNOI2012]与非
    bzoj2730: [HNOI2012]矿场搭建
    bzoj2727: [HNOI2012]双十字
    蓝桥杯-计蒜客之节假日
    蔡基姆拉尔森计算公式
    最长公共子串与最长公共子序列
  • 原文地址:https://www.cnblogs.com/marvelousone/p/11408271.html
Copyright © 2011-2022 走看看