美文网首页
超图webgl添加流光线

超图webgl添加流光线

作者: 花影_62b4 | 来源:发表于2020-11-03 11:14 被阅读0次
效果图 colors1.png

addLoad() {

      let pos1 = [

        118.07187295999599,

        36.94404904612924,

        24.33621978350808,

        118.07255297591854,

        36.94397882628565,

        24.317250291145577,

        118.07313872136622,

        36.94393280498323,

        24.285724286655544,

        118.07388008866477,

        36.943889794954906,

        24.275611045165753,

        118.07461835990738,

        36.943804448746285,

        24.31308141680151,

        118.07511761833722,

        36.94377729205221,

        24.3634941775598,

        118.07589994063973,

        36.94370840291612,

        24.478692444024517,

        118.07686513588554,

        36.94363922585948,

        24.324540626340994,

        118.07770429875909,

        36.94353567164247,

        24.378282361258407,

        118.07872230762662,

        36.94345715426436,

        24.56056228049799,

        118.0794804613066,

        36.9433765735383,

        24.487728210193033,

        118.08013131871887,

        36.94333704981415,

        24.477644610676105,

        118.08017393408909,

        36.94376786761706,

        24.44591429286694,

        118.08018813454125,

        36.94429667044136,

        24.31700847052678,

        118.08022651177846,

        36.94487106450389,

        24.185985390459066,

        118.08018999005853,

        36.94537889273716,

        24.07649086916988,

        118.0801626054073,

        36.94578720973594,

        24.01327148222909,

        118.08018385937811,

        36.94638289595944,

        24.91015111760378,

        118.08024545676929,

        36.94697441789053,

        24.820048955388383,

        118.08024208106417,

        36.94760882984712,

        24.740837454586618,

        118.08015246133999,

        36.947913936316624,

        24.730905975351167,

        118.07962599457676,

        36.94791634204142,

        24.569177518618297,

        118.07915444367787,

        36.94791421085646,

        24.433943930028526,

        118.0786621438234,

        36.94793347427117,

        24.430709555675087,

        118.07777628957948,

        36.947894325484704,

        33.46460538454509,

        118.07713441750222,

        36.94793824449395,

        24.487543677792523,

        118.07654883124802,

        36.94794630065163,

        24.444630844315114,

        118.07585978596784,

        36.947959883437136,

        24.449561581046172,

        118.07511385087616,

        36.947954918513645,

        24.290981153046577,

        118.07454164571489,

        36.947958835305805,

        24.25097381437232,

        118.07406952618899,

        36.9479538652957,

        24.322919423343492,

        118.07331394435478,

        36.9479576813552,

        24.416750452286717,

        118.07264086591735,

        36.94798458963384,

        24.600947847742507,

        118.07199536591351,

        36.947954153155585,

        24.785922335258437,

        118.07198420901216,

        36.94747147788645,

        24.79493328494028,

        118.07192395744428,

        36.946842804334075,

        24.88431264587084,

        118.07191473603741,

        36.946300015270495,

        24.816451682228173,

        118.07191364874913,

        36.9457054810611,

        24.015195702606096,

        118.0718379218424,

        36.94514047624753,

        24.1493919980008,

        118.07186168202536,

        36.944544567409835,

        24.303439719606857,

        118.07183801697177,

        36.94419755567717,

        24.334249784539768,

      ];

      viewer_g.entities.add({

        polyline: {

          positions: Cesium.Cartesian3.fromDegreesArrayHeights(pos1),

          width: 40.0,

          material: new Cesium.PolylineTrailMaterialProperty({

            period: 10.0,

            // constantSpeed:5.0,

            color: Cesium.Color.DARKORANGE,

            trailLength: 0.3,

          }),

        },

      });

      function PolylineTrailLinkMaterialProperty(color, duration) {

        this._definitionChanged = new Cesium.Event();

        this._color = undefined;

        this._colorSubscription = undefined;

        this.color = color;

        this.duration = duration;

        this._time = new Date().getTime();

      }

      Object.defineProperties(PolylineTrailLinkMaterialProperty.prototype, {

        isConstant: {

          get: function () {

            return false;

          },

        },

        definitionChanged: {

          get: function () {

            return this._definitionChanged;

          },

        },

        color: Cesium.createPropertyDescriptor("color"),

      });

      PolylineTrailLinkMaterialProperty.prototype.getType = function (time) {

        return "PolylineTrailLink2";

      };

      PolylineTrailLinkMaterialProperty.prototype.getValue = function (

        time,

        result

      ) {

        if (!Cesium.defined(result)) {

          result = {};

        }

        result.color = Cesium.Property.getValueOrClonedDefault(

          this._color,

          time,

          Cesium.Color.WHITE,

          result.color

        );

        result.image = Cesium.Material.PolylineTrailLinkImage;

        result.time =

          ((new Date().getTime() - this._time) % this.duration) / this.duration;

        return result;

      };

      PolylineTrailLinkMaterialProperty.prototype.equals = function (other) {

        return (

          this === other ||

          (other instanceof PolylineTrailLinkMaterialProperty &&

            Property.equals(this._color, other._color))

        );

      };

      Cesium.PolylineTrailLinkMaterialProperty = PolylineTrailLinkMaterialProperty;

      Cesium.Material.PolylineTrailLinkType = "PolylineTrailLink2";

      Cesium.Material.PolylineTrailLinkImage = "/public/image/colors1.png";

      Cesium.Material.PolylineTrailLinkSource =

        "czm_material czm_getMaterial(czm_materialInput materialInput)\n\

                                                      {\n\

                                                           czm_material material = czm_getDefaultMaterial(materialInput);\n\

                                                           vec2 st = materialInput.st*40.0;\n\

                                                           vec4 colorImage = texture2D(image, vec2(fract(st.s - time*40.0), fract(st.t)));\n\

                                                           material.alpha = colorImage.a * color.a;\n\

                                                           material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\

                                                           return material;\n\

                                                       }";

      Cesium.Material._materialCache.addMaterial(

        Cesium.Material.PolylineTrailLinkType,

        {

          fabric: {

            type: Cesium.Material.PolylineTrailLinkType,

            uniforms: {

              color: new Cesium.Color(1.0, 0.0, 0.0, 0.5),

              image: Cesium.Material.PolylineTrailLinkImage,

              time: 0,

            },

            source: Cesium.Material.PolylineTrailLinkSource,

          },

          translucent: function (material) {

            return true;

          },

        }

      );

      viewer_g.entities.add({

        polyline: {

          positions: Cesium.Cartesian3.fromDegreesArrayHeights(pos1),

          width: 5.0,

          material: new Cesium.PolylineTrailLinkMaterialProperty(

             Cesium.Color.RED,

             10000

           ),

        },

      });

    },

相关文章

  • 超图webgl添加流光线

    addLoad(){ letpos1=[ 118.07187295999599, 36.9440490461292...

  • 添加光线

    1.使用光线笔刷 2.径向滤镜 ①复制背景图层到图层1,Ctrl+L调整色阶,只留下窗户的亮部区域 ②使用黑色画笔...

  • 基于超图(Cesium)的webgl demo开发

    加载场景/图层 要求: 进入页面默认展示完整地球,2.5s后打开默认场景与图层(以飞行方式进入); 自动生成左侧图...

  • WebGL入门

    初识WebGL 01-手动绘制一个WebGL图形 实现的步骤: 添加一个画布元素 获取到画布元素的基于webgl上...

  • 新一代三维GIS技术以及成功案例

    以二三维一体化技术为基础框架,超图软件融合了倾斜摄影、BIM、激光点云等三维技术,集成了WebGL、VR、3D 打...

  • webgl 学习笔记

    webgl 介绍 webgl 是在传统的html文件的系统上,添加了 GLSLes(主要是编写着色器的配置) we...

  • 超图

    在数学领域,超图是图的延伸,它的边可以连接任意多个顶点。 超图可以表示为:H = (X, E)。其中: X是顶点的...

  • webgl实现发光线框(glow wireframe)效果

    在之前这篇文章,WebGL 单通道wireframe渲染我们介绍了webgl如何实现单通道wireframe的效果...

  • 超图随机游走的关键词提取

    1什么是超图? 图模型很好理解,由若干条边连接定点组成的图,我们称之为图。那么什么是超图呢?超图和图最大的不同是:...

  • WebGL漫游之旅(一)

    原文链接:WebGL漫游之旅(一) 一、WebGL基本概念 WebGL (Web Graphics Library...

网友评论

      本文标题:超图webgl添加流光线

      本文链接:https://www.haomeiwen.com/subject/vlebvktx.html