cesium_dev_kit 1.1.22 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +293 -291
  3. package/README.zh-CN.md +274 -0
  4. package/SECURITY.md +21 -0
  5. package/dist/Analysis-BLpVrGfg.d.mts +143 -0
  6. package/dist/Analysis-DmO1gtgS.d.ts +143 -0
  7. package/dist/Base-DH8H9suE.d.mts +635 -0
  8. package/dist/Base-DH8H9suE.d.ts +635 -0
  9. package/dist/Base-_BOXyMdS.d.ts +43 -0
  10. package/dist/Base-skqjcPfo.d.mts +43 -0
  11. package/dist/Control-B7AMFmHe.d.ts +98 -0
  12. package/dist/Control-BrpRU7RP.d.mts +98 -0
  13. package/dist/CustomCesiumPlugin-BqgAvlhi.d.ts +29 -0
  14. package/dist/CustomCesiumPlugin-CKYQ-7i9.d.mts +29 -0
  15. package/dist/Draw-1NhPP8z3.d.mts +490 -0
  16. package/dist/Draw-DRh7yNzc.d.ts +490 -0
  17. package/dist/Graphics-CuFNsQ3b.d.ts +1565 -0
  18. package/dist/Graphics-QE3Gb43w.d.mts +1565 -0
  19. package/dist/Material-CeZ4l-tY.d.mts +165 -0
  20. package/dist/Material-Cqbyf2Pn.d.ts +165 -0
  21. package/dist/Math3d-0nO-vFbT.d.mts +179 -0
  22. package/dist/Math3d-t635PYzU.d.ts +179 -0
  23. package/dist/PassEffect-DEFyytQZ.d.ts +41 -0
  24. package/dist/PassEffect-DEgElnVk.d.mts +41 -0
  25. package/dist/Plugin-BPCX0zTu.d.mts +197 -0
  26. package/dist/Plugin-DnYT0bue.d.ts +197 -0
  27. package/dist/Primitive-BNXp-9_6.d.mts +199 -0
  28. package/dist/Primitive-UEAuUimH.d.ts +199 -0
  29. package/dist/ThreeJs-BAlEWxa1.d.mts +44 -0
  30. package/dist/ThreeJs-DpAcw_qf.d.ts +44 -0
  31. package/dist/analysis.cjs +145 -0
  32. package/dist/analysis.cjs.map +1 -0
  33. package/dist/analysis.d.mts +6 -0
  34. package/dist/analysis.d.ts +6 -0
  35. package/dist/analysis.mjs +145 -0
  36. package/dist/analysis.mjs.map +1 -0
  37. package/dist/control.cjs +140 -0
  38. package/dist/control.cjs.map +1 -0
  39. package/dist/control.d.mts +4 -0
  40. package/dist/control.d.ts +4 -0
  41. package/dist/control.mjs +140 -0
  42. package/dist/control.mjs.map +1 -0
  43. package/dist/custom-cesium-plugin.cjs +507 -0
  44. package/dist/custom-cesium-plugin.cjs.map +1 -0
  45. package/dist/custom-cesium-plugin.d.mts +4 -0
  46. package/dist/custom-cesium-plugin.d.ts +4 -0
  47. package/dist/custom-cesium-plugin.mjs +507 -0
  48. package/dist/custom-cesium-plugin.mjs.map +1 -0
  49. package/dist/default-static.cjs +3 -0
  50. package/dist/default-static.cjs.map +1 -0
  51. package/dist/default-static.d.mts +37 -0
  52. package/dist/default-static.d.ts +37 -0
  53. package/dist/default-static.mjs +3 -0
  54. package/dist/default-static.mjs.map +1 -0
  55. package/dist/draw.cjs +140 -0
  56. package/dist/draw.cjs.map +1 -0
  57. package/dist/draw.d.mts +6 -0
  58. package/dist/draw.d.ts +6 -0
  59. package/dist/draw.mjs +140 -0
  60. package/dist/draw.mjs.map +1 -0
  61. package/dist/graphics.cjs +140 -0
  62. package/dist/graphics.cjs.map +1 -0
  63. package/dist/graphics.d.mts +19 -0
  64. package/dist/graphics.d.ts +19 -0
  65. package/dist/graphics.mjs +140 -0
  66. package/dist/graphics.mjs.map +1 -0
  67. package/dist/index.cjs +1030 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.mts +338 -0
  70. package/dist/index.d.ts +338 -0
  71. package/dist/index.mjs +1030 -0
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/material.cjs +391 -0
  74. package/dist/material.cjs.map +1 -0
  75. package/dist/material.d.mts +4 -0
  76. package/dist/material.d.ts +4 -0
  77. package/dist/material.mjs +391 -0
  78. package/dist/material.mjs.map +1 -0
  79. package/dist/pass-effect.cjs +416 -0
  80. package/dist/pass-effect.cjs.map +1 -0
  81. package/dist/pass-effect.d.mts +4 -0
  82. package/dist/pass-effect.d.ts +4 -0
  83. package/dist/pass-effect.mjs +416 -0
  84. package/dist/pass-effect.mjs.map +1 -0
  85. package/dist/plugin.cjs +141 -0
  86. package/dist/plugin.cjs.map +1 -0
  87. package/dist/plugin.d.mts +4 -0
  88. package/dist/plugin.d.ts +4 -0
  89. package/dist/plugin.mjs +141 -0
  90. package/dist/plugin.mjs.map +1 -0
  91. package/dist/primitive.cjs +370 -0
  92. package/dist/primitive.cjs.map +1 -0
  93. package/dist/primitive.d.mts +4 -0
  94. package/dist/primitive.d.ts +4 -0
  95. package/dist/primitive.mjs +370 -0
  96. package/dist/primitive.mjs.map +1 -0
  97. package/dist/three.cjs +140 -0
  98. package/dist/three.cjs.map +1 -0
  99. package/dist/three.d.mts +4 -0
  100. package/dist/three.d.ts +4 -0
  101. package/dist/three.mjs +140 -0
  102. package/dist/three.mjs.map +1 -0
  103. package/package.json +289 -46
  104. package/dist/index.js +0 -1
  105. package/dist/index.min.js +0 -1
  106. package/dist/index.umd.js +0 -1
  107. package/index.js +0 -37
@@ -0,0 +1,391 @@
1
+ var P=class extends Error{constructor(l,p,g={}){super(`[cesium_dev_kit:${l}] ${p}`),this.name="CesiumDevKitError",this.code=l,this.details=g.details,this.cause=g.cause,Object.setPrototypeOf(this,new.target.prototype);}};function M(e,l){let p=l!=null&&l.scope?`[cesium_dev_kit:${l.scope}]`:"[cesium_dev_kit]";console.warn(p,e,l!=null?l:"");}var I=class{constructor(l){this.viewer=null;this.Cesium=l,this.init_data();}init_data(){this.viewer=null;}init({containerId:l,viewerConfig:p,extraConfig:g,MapImageryList:t,imageryProvider:n,viewer:r}){let a=l,u={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},d=this.findCesiumProvider(n),s=g==null?void 0:g.AccessToken;s&&(this.Cesium.Ion.defaultAccessToken=s),u=Object.assign(u,p);let i=r||new this.Cesium.Viewer(a,{...u,...d});if(g&&!g.logo){let o=i.cesiumWidget.creditContainer;o.style.display="none";}if(g&&g.depthTest&&(i.scene.globe.depthTestAgainstTerrain=true),t&&t.length>0)for(let o=0;o<t.length;o++)this.addImageryProvider(i,t[o].type,t[o].option||t[o].classConfig);if(!r){let o=typeof document=="undefined"?null:a&&a.nodeType===1?a:document.getElementById(a);this.bindContainerResize(i,o);}return this.viewer=i,i}bindContainerResize(l,p){if(typeof ResizeObserver=="undefined"||!p)return;let g=()=>{try{(typeof l.isDestroyed!="function"||!l.isDestroyed())&&l.resize();}catch(r){M(r,{scope:"Controller.bindContainerResize"});}},t=new ResizeObserver(g);t.observe(p),typeof requestAnimationFrame=="function"&&requestAnimationFrame(g);let n=l.destroy.bind(l);l.destroy=function(){try{t.disconnect();}catch(r){M(r,{scope:"Controller.bindContainerResize.disconnect"});}return n()};}addImageryProvider(l,p,g){l.imageryLayers.addImageryProvider(this.createCesiumProvider({type:p,option:g}));}findCesiumProvider(l){let p={};if(!l)return p;for(let g in l){let t=l[g];if(t&&t.type){p[g]=this.createCesiumProvider(t);continue}p[g]=l[g];}return p}createCesiumProvider(l){switch(l.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[l.type](l.option);case "UrlTemplateImageryProvider":return new this.Cesium[l.type](l.option);case "TileMapServiceImageryProvider":return new this.Cesium[l.type](l.option)}}};function U(e,l){if(!l)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(l)||l.startsWith("data:")||l.startsWith("/"))return l;let p=(e||"").replace(/\/+$/,"");return p?p+"/"+l.replace(/^\/+/,""):l}function b(e=""){return {baseService:e,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var ie=Object.assign((e,l)=>e!=null?e:l,{EMPTY_OBJECT:Object.freeze({})}),H=ie;function V(e){function l(...p){let g=e();return new g(...p)}return l.prototype=e().prototype,Object.defineProperty(l,"__cesiumDevKitCreateModule",{value:e,enumerable:false,configurable:false,writable:false}),l}function L(e){let l=e==null?void 0:e.__cesiumDevKitCreateModule;return typeof l=="function"?l():e}function X(e){if(e)try{if(typeof e.isDestroyed=="function"&&e.isDestroyed())return;typeof e.destroy=="function"&&e.destroy();}catch(l){console.warn("[cesium_dev_kit] failed to dispose viewer:",l);}}var w=new WeakMap;function B(e,l){if(!e||typeof l!="function")return;let p=w.get(e);p?p.push(l):w.set(e,[l]);}function W(e,l){if(!e||!l||e===l)return;let p=w.get(e);if(!p||p.length===0)return;w.delete(e);let g=w.get(l);g?g.push(...p):w.set(l,p);}function F(e){if(!e||typeof e!="object"&&typeof e!="function")return;let l=w.get(e);if(l){w.delete(e);for(let p=l.length-1;p>=0;p--)try{l[p]();}catch(g){console.warn("[cesium_dev_kit] cleanup failed:",g);}}}function ae(e){e&&typeof e.destroy!="function"&&Object.defineProperty(e,"destroy",{value:function(){F(this);},enumerable:false,configurable:true,writable:true});}function oe(){let e={},l;class p{constructor(t,n,r){if(t){this._viewer=t,e=n,l=r||b(),this._drawLayer=new e.CustomDataSource("drawLayer"),t&&t.dataSources.add(this._drawLayer);let a=this._drawLayer;ae(this),B(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._drawLayer===a&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new e.Entity}_objHasOwnProperty(t,n,r){return t.hasOwnProperty(n)?t[n]:r}getDfSt(t){if(!l)return;let n=l,r=t.reduce((a,u)=>a?a[u]:n[u],void 0);if(r!=null)return typeof r!="string"?r:U(n.baseService,r)}setOneSkyBox(){return new e.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new e.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new e.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new e.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new e.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new e.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(t){t=t||{};var n=`uniform sampler2D colorTexture;
2
+ in vec2 v_textureCoordinates;
3
+ uniform float scale;
4
+ uniform vec3 offset;
5
+ void main() {
6
+ vec4 color = texture(colorTexture, v_textureCoordinates);
7
+ out_FragColor = vec4(color.r*0.2,color.g * 0.4,color.b*0.6, 1.0);
8
+ }
9
+ `;return this._viewer.scene.postProcessStages.add(new e.PostProcessStage({name:"darkEffect",fragmentShader:n,uniforms:{scale:1,offset(){return t.offset||new e.Cartesian3(.1,.2,.3)}}}))}setBlurBloom(t){if(this._viewer&&t){var n=`uniform float height;
10
+ uniform float width;
11
+ uniform sampler2D colorTexture1;
12
+
13
+ in vec2 v_textureCoordinates;
14
+
15
+ const int SAMPLES = 9;
16
+ void main()
17
+ {
18
+ vec2 st = v_textureCoordinates;
19
+ float wr = float(1.0 / width);
20
+ float hr = float(1.0 / height);
21
+ vec4 result = vec4(0.0);
22
+ int count = 0;
23
+ for(int i = -SAMPLES; i <= SAMPLES; ++i){
24
+ for(int j = -SAMPLES; j <= SAMPLES; ++j){
25
+ vec2 offset = vec2(float(i) * wr, float(j) * hr);
26
+ result += texture(colorTexture1, st + offset);
27
+ }
28
+ }
29
+ result = result / float(count);
30
+ out_FragColor = result;
31
+ }
32
+ `;return this._viewer.scene.postProcessStages.add(new e.PostProcessStage({name:"blur_x_direction",fragmentShader:n,uniforms:{width:t.width,height:t.height,colorTexture1:"Bright"}}))}}setRainEffect(){if(this._viewer){var t=`uniform sampler2D colorTexture;
33
+ in vec2 v_textureCoordinates;
34
+
35
+ float hash(float x){
36
+ return fract(sin(x*23.3)*13.13);
37
+ }
38
+
39
+ void main(){
40
+ float time = czm_frameNumber / 60.0;
41
+ vec2 resolution = czm_viewport.zw;
42
+ vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);
43
+ vec3 c=vec3(.6,.7,.8);
44
+ float a=-.4;
45
+ float si=sin(a),co=cos(a);
46
+ uv*=mat2(co,-si,si,co);
47
+ uv*=length(uv+vec2(0,4.9))*.3+1.;
48
+ float v=1.-sin(hash(floor(uv.x*100.))*2.);
49
+ float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;
50
+ c*=v*b;
51
+ out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1), 0.2);
52
+ }
53
+ `;return this._viewer.scene.postProcessStages.add(new e.PostProcessStage({name:"rainEffect",fragmentShader:t}))}}setSnowEffect(){if(this._viewer){var t=`uniform sampler2D colorTexture;
54
+ in vec2 v_textureCoordinates;
55
+ float snow(vec2 uv,float scale){
56
+ float time = czm_frameNumber / 60.0;
57
+ float w=smoothstep(1.,0.,-uv.y*(scale/10.));
58
+ if(w<.1)return 0.;
59
+ uv+=time/scale;
60
+ uv.y+=time*2./scale;
61
+ uv.x+=sin(uv.y+time*.5)/scale;
62
+ uv*=scale;
63
+ vec2 s=floor(uv),f=fract(uv),p;
64
+ float k=3.,d;
65
+ p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;
66
+ d=length(p);
67
+ k=min(d,k);
68
+ k=smoothstep(0.,k,sin(f.x+f.y)*0.01);
69
+ return k*w;
70
+ }
71
+
72
+ void main(){
73
+ vec2 resolution = czm_viewport.zw;
74
+ vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);
75
+ vec3 finalColor=vec3(0);
76
+ float c = 0.0;
77
+ c+=snow(uv,30.)*.0;
78
+ c+=snow(uv,20.)*.0;
79
+ c+=snow(uv,15.)*.0;
80
+ c+=snow(uv,10.);
81
+ c+=snow(uv,8.);
82
+ c+=snow(uv,6.);
83
+ c+=snow(uv,5.);
84
+ finalColor=(vec3(c));
85
+ out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);
86
+
87
+ }
88
+ `;return this._viewer.scene.postProcessStages.add(new e.PostProcessStage({name:"snowEffect",fragmentShader:t}))}}setFogEffect(){if(this._viewer){var t=`float getDistance(sampler2D depthTexture, vec2 texCoords)
89
+ {
90
+ float depth = czm_unpackDepth(texture(depthTexture, texCoords));
91
+ if (depth == 0.0) {
92
+ return czm_infinity;
93
+ }
94
+ vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);
95
+ return -eyeCoordinate.z / eyeCoordinate.w;
96
+ }
97
+ float interpolateByDistance(vec4 nearFarScalar, float distance)
98
+ {
99
+ float startDistance = nearFarScalar.x;
100
+ float startValue = nearFarScalar.y;
101
+ float endDistance = nearFarScalar.z;
102
+ float endValue = nearFarScalar.w;
103
+ float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
104
+ return mix(startValue, endValue, t);
105
+ }
106
+ vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
107
+ {
108
+ return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
109
+ }
110
+ uniform sampler2D colorTexture;
111
+ uniform sampler2D depthTexture;
112
+ uniform vec4 fogByDistance;
113
+ uniform vec4 fogColor;
114
+ in vec2 v_textureCoordinates;
115
+ void main(void)
116
+ {
117
+ float distance = getDistance(depthTexture, v_textureCoordinates);
118
+ vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
119
+ float blendAmount = interpolateByDistance(fogByDistance, distance);
120
+ vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);
121
+ out_FragColor = alphaBlend(finalFogColor, sceneColor);
122
+ }
123
+ `;return this._viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:t,uniforms:{fogByDistance:new e.Cartesian4(10,0,200,.3),fogColor:e.Color.AZURE}}))}}setDefSceneConfig(){this._viewer&&(this._viewer.scene.sun.show=false,this._viewer.scene.moon.show=false,this._viewer.scene.fxaa=true,this._viewer.scene.globe.depthTestAgainstTerrain=true,this._viewer.scene.undergroundMode=false,this._viewer.scene.terrainProvider.isCreateSkirt=false,this._viewer.scene.skyAtmosphere.show=false,this._viewer.scene.globe.showGroundAtmosphere=false,this._viewer.scene.globe.enableLighting=true,this._viewer.scene.fog.enabled=false,this._viewer.cesiumWidget.creditContainer.style.display="none");}setBloomLightScene(){this._viewer&&(this._viewer.scene.postProcessStages.bloom.enabled=true,this._viewer.scene.postProcessStages.bloom.uniforms.contrast=119,this._viewer.scene.postProcessStages.bloom.uniforms.brightness=-0.4,this._viewer.scene.postProcessStages.bloom.uniforms.glowOnly=false,this._viewer.scene.postProcessStages.bloom.uniforms.delta=.9,this._viewer.scene.postProcessStages.bloom.uniforms.sigma=3.78,this._viewer.scene.postProcessStages.bloom.uniforms.stepSize=5,this._viewer.scene.postProcessStages.bloom.uniforms.isSelected=false);}removePostProcessStage(t){t&&(Array.isArray(t)?t.forEach(n=>{this._viewer.scene.postProcessStages.contains(n)&&this._viewer.scene.postProcessStages.remove(n);}):this._viewer.scene.postProcessStages.contains(t)&&this._viewer.scene.postProcessStages.remove(t));}setView(t){if(this._viewer&&t&&t.position){if(t.distance){var n=new e.Cartesian3(0,t.distance,window.opt.distance);t.position=e.Cartesian3.add(t.position,n,new e.Cartesian3);}this._viewer.scene.camera.setView({destination:t.position,orientation:t.orientation||{heading:e.Math.toRadians(90),pitch:e.Math.toRadians(90),roll:e.Math.toRadians(0)}});}}flyTo(t){if(this._viewer&&t&&t.position){if(t.distance){var n=new e.Cartesian3(0,t.distance,0);t.position=e.Cartesian3.add(t.position,n,new e.Cartesian3);}this._viewer.scene.camera.flyTo({destination:t.position,orientation:t.orientation||{heading:e.Math.toRadians(90),pitch:e.Math.toRadians(90),roll:e.Math.toRadians(0)},easingFunction:t.easingFunction||e.EasingFunction.LINEAR_NONE,duration:t.duration||3,complete:t.callback});}}transformCartesianToWGS84(t){var n,r,a;if(this._viewer&&t){if(t.x===void 0&&(t.lng!==void 0||t.lon!==void 0))return {lng:Number((n=t.lng)!=null?n:t.lon),lat:Number(t.lat),alt:Number((a=(r=t.alt)!=null?r:t.height)!=null?a:0)};let u=e.Cartographic.fromCartesian(t);return {lng:e.Math.toDegrees(u.longitude),lat:e.Math.toDegrees(u.latitude),alt:u.height}}}transformWGS84ArrayToCartesianArray(t,n){if(this._viewer&&t){var r=this;return t?t.map(function(a){return r.transformWGS84ToCartesian(a,n)}):[]}}transformWGS84ToCartesian(t,n){if(this._viewer)return t?e.Cartesian3.fromDegrees(t.lng||t.lon,t.lat,t.alt=n||t.alt,e.Ellipsoid.WGS84):e.Cartesian3.ZERO}transformCartesianArrayToWGS84Array(t){if(this._viewer){var n=this;return t?t.map(function(r){return n.transformCartesianToWGS84(r)}).filter(function(r){return !!r}):[]}}transformWGS84ToCartographic(t){return t?e.Cartographic.fromDegrees(t.lng||t.lon,t.lat,t.alt):e.Cartographic.ZERO}lnglatArrayToCartesians(t){if(!t||t.length<1)return [];let n=[];for(let r=0;r<t.length;r++){let a=e.Cartesian3.fromDegrees(Number(t[r][0]),Number(t[r][1]),Number(t[r][2]||0));n.push(a);}return n}setCameraEotateHeading(t){if(t){let n=this._viewer,r=e.Cartesian3.fromDegrees(t.lng,t.lat,t.height),a=e.Math.toRadians(-30),u=360/30,d=5e3,s=e.JulianDate.fromDate(new Date);n.clock.startTime=s.clone(),n.clock.currentTime=s.clone(),n.clock.clockRange=e.ClockRange.CLAMPED,n.clock.clockStep=e.ClockStep.SYSTEM_CLOCK;let i=n.camera.heading,o=function(){let m=e.JulianDate.secondsDifference(n.clock.currentTime,n.clock.startTime),y=e.Math.toRadians(m*u)+i;n.scene.camera.setView({destination:r,orientation:{heading:y,pitch:a}}),n.scene.camera.moveBackward(d),e.JulianDate.compare(n.clock.currentTime,n.clock.stopTime)>=0&&n.clock.onTick.removeEventListener(o);};n.clock.onTick.addEventListener(o),B(this,()=>{n.clock.onTick.removeEventListener(o);});}}getCatesian3FromPX(t){if(this._viewer&&t){var n=this._viewer.scene.pick(t),r=null,a=false,u=false;if(n instanceof e.Cesium3DTileFeature&&(a=true),a&&(r=this._viewer.scene.pickPosition(t),r)){let s=e.Cartographic.fromCartesian(r);s.height<0&&(s.height=0);let i=e.Math.toDegrees(s.longitude),o=e.Math.toDegrees(s.latitude),c=s.height;r=this.transformWGS84ToCartesian({lng:i,lat:o,alt:c});}if(!n){var d=this._viewer.scene.camera.getPickRay(t);if(!d)return null;r=this._viewer.scene.globe.pick(d,this._viewer.scene),u=true;}if(n&&!a&&(r=this._viewer.scene.pickPosition(t),r)){let s=e.Cartographic.fromCartesian(r);s.height<0&&(s.height=0);let i=e.Math.toDegrees(s.longitude),o=e.Math.toDegrees(s.latitude),c=s.height;r=this.transformWGS84ToCartesian({lng:i,lat:o,alt:c});}if(!a&&!u&&!n&&(r=this._viewer.scene.camera.pickEllipsoid(t,this._viewer.scene.globe.ellipsoid)),r){let s=this.transformCartesianToWGS84(r);return s.alt<0&&(r=this.transformWGS84ToCartesian(s,.1)),r}return false}}getCameraPosition(){if(this._viewer){var t=this._viewer.scene.camera.pickEllipsoid(new e.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(t){var n=e.Ellipsoid.WGS84.cartesianToCartographic(t),r=n.longitude*180/Math.PI,a=n.latitude*180/Math.PI,u=this._viewer.camera._direction,d=e.Math.toDegrees(u.x),s=e.Math.toDegrees(u.y),i=e.Math.toDegrees(u.z),o=this._viewer.camera.positionCartographic.height,c=e.Math.toDegrees(this._viewer.camera.heading),m=e.Math.toDegrees(this._viewer.camera.pitch),y=e.Math.toDegrees(this._viewer.camera.roll),f=this._viewer.camera.computeViewRectangle(),v=f.west/Math.PI*180,S=f.north/Math.PI*180,k=f.east/Math.PI*180,z=f.south/Math.PI*180,O=(v+k)/2,T=(S+z)/2;return {lon:r,lat:a,height:o,heading:c,pitch:m,roll:y,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:O,y:T},direction:new e.Cartesian3(d,s,i)}}}}pickUpPosition(t){return this.getCatesian3FromPX(t.position)}getHandlerClickPosition(t){if(this._viewer){let n=this._viewer.scene,r=this._viewer,a=n.camera.pickEllipsoid(t.position,n.globe.elliposid),u={cameraPosistion:r.camera.position,heading:r.camera.heading,pitch:r.camera.pitch,roll:r.camera.roll},d=e.Cartographic.fromCartesian(a);d.height<0&&(d.height=0);let s={alt:d.height,lat:e.Math.toDegrees(d.latitude),lon:e.Math.toDegrees(d.longitude)},i=n.pickPosition(t.position),o=e.Cartographic.fromCartesian(i),c={height:o.height,latitude:e.Math.toDegrees(o.latitude),longitude:e.Math.toDegrees(o.longitude)};return {wgs84Coor:s,graphicCoor:c,cameraPosition:u}}}updateCameraState(t){this._viewer.scene._screenSpaceCameraController.enableRotate=t,this._viewer.scene._screenSpaceCameraController.enableTranslate=t,this._viewer.scene._screenSpaceCameraController.enableZoom=t,this._viewer.scene._screenSpaceCameraController.enableTilt=t,this._viewer.scene._screenSpaceCameraController.enableLook=t;}bindHandleEvent({leftClick:t,mouseMove:n,doubleClick:r,leftDown:a,mouseWheel:u,leftUp:d}){if(this._viewer){var s=new e.ScreenSpaceEventHandler(this._viewer.canvas);B(this,()=>{s&&!s.isDestroyed()&&s.destroy();}),t&&s.setInputAction(function(i){t(i,s);},e.ScreenSpaceEventType.LEFT_CLICK),n&&s.setInputAction(function(i){n(i,s);},e.ScreenSpaceEventType.MOUSE_MOVE),r&&s.setInputAction(function(i){r(i,s);},e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),a&&s.setInputAction(function(i){a(i,s);},e.ScreenSpaceEventType.LEFT_DOWN),u&&s.setInputAction(function(i){u(i,s);},e.ScreenSpaceEventType.WHEEL),d&&s.setInputAction(function(i){d(i,s);},e.ScreenSpaceEventType.LEFT_UP);}}bindHandelEvent(t){return this.bindHandleEvent(t)}getHandlePosition(t){if(this._viewer){var n=new e.ScreenSpaceEventHandler(this._viewer.scene.canvas),r=this;B(this,()=>{n&&!n.isDestroyed()&&n.destroy();}),n.setInputAction(function(a){var u=r._viewer.scene.camera.pickEllipsoid(a.endPosition,r._viewer.scene.globe.ellipsoid);typeof t=="function"&&t(r.transformCartesianToWGS84(u),n);},e.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(t){return this.getHandlePosition(t)}saveSceneImages(){if(this._viewer){let d=function(s){for(var i=s.split(","),o=i[0].match(/:(.*?);/)[1],c=atob(i[1]),m=c.length,y=new Uint8Array(m);m--;)y[m]=c.charCodeAt(m);return new Blob([y],{type:o})};var t=this._viewer.scene.canvas,n=t.toDataURL("image/png").replace("image/png","image/octet-stream"),r=document.createElement("a"),a=d(n),u=URL.createObjectURL(a);r.download="scene.png",r.href=u,r.click();}}_installAmapImageryProvider(){let t="https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",n="https://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";function r(a){return a.url=a.style==="img"?t:n,a.subdomains||(a.subdomains=["01","02","03","04"]),new e.UrlTemplateImageryProvider(a)}e.Scene.AmapImageryProvider=r;}_installTdtImageryProvider(){let t="https://{s}.tianditu.gov.cn/{layer}_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER={layer}&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk={key}";function n(r){return new e.WebMapTileServiceImageryProvider({url:t.replace(/\{layer\}/g,r.style||"vec").replace(/\{key\}/g,r.key||""),layer:r.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}e.Scene.TdtImageryProvider=n;}_installTencentImageryProvider(){let t="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229",n="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1";function r(a){return a.layer==="img"?(a.url||(a.url=t),a.subdomains||(a.subdomains=["0","1","2"]),a.customTags={sx(u,d,s,i){return d>>4},sy(u,d,s,i){return (1<<i)-s>>4}}):a.url||(a.url=n),new e.UrlTemplateImageryProvider(a)}e.Scene.TencentImageryProvider=r;}_installGoogleImageryProvider(){let t="https://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",n="https://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali",r="https://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile";function a(u){return u.url=u.style==="img"?n:u.style==="ter"?r:t,u.subdomains||(u.subdomains=["1","2","3","4","5"]),new e.UrlTemplateImageryProvider(u)}e.Scene.GoogleImageryProvider=a;}_installGooGleImageryProvider(){return this._installGoogleImageryProvider()}_installBaiduImageryProvider(){var t="https://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function n(a){t=a.url||t,this._url=t,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1,this._tilingScheme=new e.WebMercatorTilingScheme({rectangleSouthwestInMeters:new e.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new e.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=a.style||"normal",this._ready=true;}Object.defineProperties(n.prototype,{url:{get(){return this._url}},token:{get(){return this._token}},tileWidth:{get(){if(!this.ready)throw new e.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get(){if(!this.ready)throw new e.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get(){if(!this.ready)throw new e.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},minimumLevel:{get(){if(!this.ready)throw new e.DeveloperError("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get(){if(!this.ready)throw new e.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get(){if(!this.ready)throw new e.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},ready:{get(){return !!this._url}},credit:{get(){return this._credit}},readyPromise:{get(){return this._readyPromise.promise}},usingPrecachedTiles:{get(){return this._useTiles}},hasAlphaChannel:{get(){return true}},layers:{get(){return this._layers}}});function r(a,u,d,s,i){var o=a._url+"&x={x}&y={y}&z={z}&customid={style}",c=a._tilingScheme.getNumberOfXTilesAtLevel(s),m=a._tilingScheme.getNumberOfYTilesAtLevel(s);return o=o.replace("{x}",String(u-c/2)).replace("{y}",String(m/2-d-1)).replace("{z}",String(s)).replace("{style}",i),o}n.prototype.getTileCredits=function(a,u,d){},n.prototype.requestImage=function(a,u,d){if(!this.ready)throw new e.DeveloperError("requestImage must not be called before the imagery provider is ready.");var s=r(this,a,u,d,this._style);return e.ImageryProvider.loadImage(this,s)},e.Scene.BaiduImageryProvider=n;}_installGroundSkyBox(){var t=e.BoxGeometry,n=e.Cartesian3,r=e.defaultValue||H,a=e.defined,u=e.destroyObject,d=e.DeveloperError,s=e.GeometryPipeline,i=e.Matrix3,o=e.Matrix4,c=e.Transforms,m=e.VertexFormat,y=e.BufferUsage,f=e.CubeMap,v=e.DrawCommand,S=e.loadCubeMap,k=e.RenderState,z=e.VertexArray,O=e.BlendingState,T=e.SceneMode,q=e.ShaderProgram,K=e.ShaderSource,J=`uniform samplerCube u_cubeMap;
124
+ in vec3 v_texCoord;
125
+ void main()
126
+ {
127
+ vec4 color = texture(u_cubeMap, normalize(v_texCoord));
128
+ out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
129
+ }
130
+ `,$=`in vec3 position;
131
+ out vec3 v_texCoord;
132
+ uniform mat3 u_rotateMatrix;
133
+ void main()
134
+ {
135
+ vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
136
+ gl_Position = czm_projection * vec4(p, 1.0);
137
+ v_texCoord = position.xyz;
138
+ }
139
+ `,Q=typeof o.getRotation=="function"?o.getRotation.bind(o):o.getMatrix3.bind(o);function D(_){this.sources=_.sources,this._sources=void 0,this.show=r(_.show,true),this._command=new v({modelMatrix:o.clone(o.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var ee=new i;D.prototype.update=function(_,j){var x=this;if(this.show&&!(_.mode!==T.SCENE3D&&_.mode!==T.MORPHING)&&_.passes.render){var E=_.context;if(this._sources!==this.sources){this._sources=this.sources;var h=this.sources;if(!a(h.positiveX)||!a(h.negativeX)||!a(h.positiveY)||!a(h.negativeY)||!a(h.positiveZ)||!a(h.negativeZ))throw new d("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof h.positiveX!=typeof h.negativeX||typeof h.positiveX!=typeof h.positiveY||typeof h.positiveX!=typeof h.negativeY||typeof h.positiveX!=typeof h.positiveZ||typeof h.positiveX!=typeof h.negativeZ)throw new d("this.sources properties must all be the same type.");typeof h.positiveX=="string"?S(E,this._sources).then(function(re){x._cubeMap=x._cubeMap&&x._cubeMap.destroy(),x._cubeMap=re;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:E,source:h}));}var C=this._command;if(C.modelMatrix=c.eastNorthUpToFixedFrame(_.camera._positionWC),!a(C.vertexArray)){C.uniformMap={u_cubeMap(){return x._cubeMap},u_rotateMatrix(){return Q(C.modelMatrix,ee)}};var G=t.createGeometry(t.fromDimensions({dimensions:new n(2,2,2),vertexFormat:m.POSITION_ONLY})),te=this._attributeLocations=s.createAttributeLocations(G);C.vertexArray=z.fromGeometry({context:E,geometry:G,attributeLocations:te,bufferUsage:y._DRAW}),C.renderState=k.fromCache({blending:O.ALPHA_BLEND});}if(!a(C.shaderProgram)||this._useHdr!==j){var ne=new K({defines:[j?"HDR":""],sources:[J]});C.shaderProgram=q.fromCache({context:E,vertexShaderSource:$,fragmentShaderSource:ne,attributeLocations:this._attributeLocations}),this._useHdr=j;}if(a(this._cubeMap))return C}},D.prototype.isDestroyed=function(){return false},D.prototype.destroy=function(){var _=this._command;return _.vertexArray=_.vertexArray&&_.vertexArray.destroy(),_.shaderProgram=_.shaderProgram&&_.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),u(this)},e.Scene.GroundSkyBox=D;}removeHandlerByName(t=[]){t.forEach(n=>{this._viewer.screenSpaceEventHandler.removeInputAction(e.ScreenSpaceEventType[n]);});}}return p}var A=V(oe);function se(e,l,p,g){function t(n,r){let a={},u=L(r),d=[];if(Array.isArray(n))n.forEach(i=>{let o=L(i),c=new o(e,l,p,g);s(o,u),d.push(c);}),a=new u(e,l,p,g),d.forEach(i=>Object.assign(a,i)),d.forEach(i=>W(i,a));else {let i=L(n),o=new i(e,l,p,g);s(i,u),a=new u(e,l,p,g),Object.assign(a,o),W(o,a);}function s(i,o){let c=Object.getOwnPropertyNames(i.prototype);for(let m=0,y=c.length;m<y;m++)c[m]!=="constructor"&&(o.prototype[c[m]]=i.prototype[c[m]]);}return a}return t}function le({cesiumGlobal:e,threeGlobal:l,containerId:p,threeContainerId:g,viewerConfig:t={},extraConfig:n={},MapImageryList:r=[],defaultStatic:a,baseExtendsCom:u=[],extendsCom:d,extendsComName:s,viewer:i}){if(!e)throw new P("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!p&&!i)throw new P("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let c=new I(e).init({containerId:p,viewerConfig:t,extraConfig:n,MapImageryList:r,viewer:i}),m=!i,v=se(c,e,a,l?{threeGlobal:l,containerId:p,threeContainerId:g}:"")(u,d),S=false;return {viewer:c,[s]:v,dispose:()=>{if(!S){S=true;try{typeof v.destroy=="function"?v.destroy():F(v);}catch(k){M(k,{scope:"singleImport.dispose"});}m&&X(c);}}}}function Z(e,l,p){function g(t){return le({...t,baseExtendsCom:e,extendsCom:l,extendsComName:p})}return g}function ce(){let e=null;class p{constructor(t,n,r){t&&(e=n,this._installMaterial());}_installMaterial(){this._installWaveCircleMaterial(),this._installCircleFadeMaterial(),this._installCityLineMaterial(),this._installWarnMaterial(),this._installFlowMaterial(),this._installPolylineTrailLinkMaterial();}addMaterialLineGraphics(t){if(this._viewer&&t&&t.image){var n=this.createGraphics();return n.polyline={positions:t.positions,material:new e.PolylineCustomMaterialProperty({color:t.color||e.Color.RED,duration:t.duration||500}),width:t.width},this._viewer.entities.add(n)}}getCustomMaterialLine(t){if(this._viewer&&t&&t.image)return this._initPolylineCustomMaterialProperty(t)}_initPolylineCustomMaterialProperty(t){if(t){var n=e.Color,r=e.defaultValue,a=e.defined,u=Object.defineProperties,d=e.Event,s=e.createPropertyDescriptor,i=e.Property,o=e.Material,c=n.WHITE,m=t.MaterialType||"wallType"+parseInt(String(Math.random()*1e3));let y=function(f){f=r(f,r.EMPTY_OBJECT),this._definitionChanged=new d,this._color=void 0,this._colorSubscription=void 0,this.color=f.color||e.Color.BLUE,this.duration=f.duration||1e3,this._time=void 0;};return u(y.prototype,{isvarant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}},color:s("color")}),y.prototype.getType=function(){return m},y.prototype.getValue=function(f,v){return a(v)||(v={}),v.color=i.getValueOrClonedDefault(this._color,f,c,v.color),v.image=t.image,this._time===void 0&&(this._time=f.secondsOfDay),v.time=(f.secondsOfDay-this._time)*1e3/this.duration,v},y.prototype.equals=function(f){return this===f||f instanceof y&&i.equals(this._color,f._color)},o._materialCache.addMaterial(m,{fabric:{type:m,uniforms:{color:t.color||new e.Color(1,0,0,.5),image:t.image,time:t.time||0},source:this._getDynamicLineShader({get:true})},translucent:function(){return true}}),new y(t)}}addMaterialWallGraphics(t){if(this._viewer&&t&&t.image){var n=this.createGraphics();return n.wall={positions:t.positions,material:this.getCustomMaterialWall(t),width:t.width},this._viewer.entities.add(n)}}getCustomMaterialWall(t){if(this._viewer&&t&&t.image)return this._initWallCustomMaterialProperty(t)}_initWallCustomMaterialProperty(t){var n=e.Color,r=e.defaultValue,a=e.defined,u=Object.defineProperties,d=e.Event,s=e.createPropertyDescriptor,i=e.Property,o=e.Material,c=t.MaterialType||"wallType"+parseInt(String(Math.random()*1e3));let m=function(y){y=r(y,r.EMPTY_OBJECT),this._definitionChanged=new d,this._color=void 0,this._colorSubscription=void 0,this.color=y.color||n.BLUE,this.duration=y.duration||3e3,this._time=new Date().getTime();};return u(m.prototype,{isvarant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}},color:s("color")}),m.prototype.getType=function(){return c},m.prototype.getValue=function(y,f){return a(f)||(f={}),f.color=i.getValueOrClonedDefault(this._color,y,n.WHITE,f.color),f.image=t.image,f.time=(new Date().getTime()-this._time)%this.duration/this.duration,f},m.prototype.equals=function(y){return this===y||y instanceof m&&i.equals(this._color,y._color)},o._materialCache.addMaterial(c,{fabric:{type:c,uniforms:{color:new n(1,0,0,.5),image:t.image,time:0},source:this._getDirectionWallShader({get:true,count:t.count,freely:t.freely,direction:t.direction})},translucent:function(){return true}}),new m(t)}_installWaveCircleMaterial(){var t=this,n=e.Color,r=e.defaultValue,a=Object.defineProperties,u=e.Event,d=e.Property,s=e.Material;function i(o){o=o||{},this._definitionChanged=new u,this._color=void 0,this._colorSubscription=void 0,this._duration=void 0,this._durationSubscription=void 0,this.color=r(o.color,n.fromBytes(0,255,255,255)),this.duration=r(o.duration,45),this.count=Math.max(r(o.count,2),1),this.gradient=r(o.gradient,.1),this.gradient<0?this.gradient=0:this.gradient>1&&(this.gradient=1);}a(i.prototype,{isConstant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}}}),i.prototype.getType=function(){return s.CircleWaveType},i.prototype.getValue=function(o,c){return c||(c={}),c.color=d.getValueOrUndefined(this._color,o),c.duration=this._duration,c.count=this.count,c.gradient=this.gradient,c},i.prototype.equals=function(o){return this===o||o instanceof i&&d.equals(this._color,o._color)},a(i.prototype,{color:e.createPropertyDescriptor("color"),duration:e.createPropertyDescriptor("duration")}),e.Scene.CircleWaveMaterialProperty=i,s.CircleWaveType="CircleWave",s._materialCache.addMaterial(s.CircleWaveType,{fabric:{type:s.CircleWaveType,uniforms:{color:new n(1,0,0,.7),duration:45,count:1,gradient:.1},source:t._getDynamicCircleShader({get:true})},translucent:function(){return true}});}_installCircleFadeMaterial(){var t=e.Color,n=e.defaultValue,r=Object.defineProperties,a=e.Event,u=e.Property,d=e.Material,s=new t(0,0,0,0);function i(o){o=n(o,n.EMPTY_OBJECT),this._definitionChanged=new a,this._color=void 0,this._colorSubscription=void 0,this.color=n(o.color,s),this._duration=o.duration||1e3,this._time=void 0;}r(i.prototype,{isConstant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}}}),i.prototype.getType=function(){return d.CircleFadeMaterialType},i.prototype.getValue=function(o,c){return c||(c={}),c.color=u.getValueOrClonedDefault(this._color,o,s,c.color),this._time===void 0&&(this._time=new Date().getTime()),c.time=(new Date().getTime()-this._time)/this._duration,c},i.prototype.equals=function(o){return this===o||o instanceof i&&u.equals(this._color,o._color)},r(i.prototype,{color:e.createPropertyDescriptor("color")}),e.Scene.CircleFadeMaterialProperty=i,d.CircleFadeMaterialType="CircleFadeMaterial",d._materialCache.addMaterial(d.CircleFadeMaterialType,{fabric:{type:d.CircleFadeMaterialType,uniforms:{color:new t(1,0,0,1),time:1},source:this._getCircleFadeShader({get:true})},translucent:function(){return true}});}_installCityLineMaterial(){var t=e.Color,n=e.defaultValue,r=e.defined,a=Object.defineProperties,u=e.Event,d=e.createPropertyDescriptor,s=e.Property,i=e.Material,o=t.WHITE;function c(m){m=n(m,n.EMPTY_OBJECT),this._definitionChanged=new u,this._color=void 0,this._colorSubscription=void 0,this.color=m.color||e.Color.BLUE,this.duration=m.duration||1e3,this._time=void 0,this._img=m.imgUrl||i.PolylineCityLinkImage;}a(c.prototype,{isvarant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}},color:d("color")}),c.prototype.getType=function(){return i.PolylineCityLinkType},c.prototype.getValue=function(m,y){return r(y)||(y={}),y.color=s.getValueOrClonedDefault(this._color,m,o,y.color),y.image=this._img,this._time===void 0&&(this._time=m.secondsOfDay),y.time=(m.secondsOfDay-this._time)*1e3/this.duration,y},c.prototype.equals=function(m){return this===m||m instanceof c&&s.equals(this._color,m._color)},e.Scene.PolylineCityLinkMaterialProperty=c,i.PolylineCityLinkType="PolylineCityLink",i.PolylineCityLinkImage=this.getDfSt(["material","PolylineCityLinkMaterialProperty"])||"static/data/images/Textures/meteor_01.png",i._materialCache.addMaterial(i.PolylineCityLinkType,{fabric:{type:i.PolylineCityLinkType,uniforms:{color:new t(1,0,0,1),image:i.PolylineCityLinkImage,time:0},source:this._getDynamicLightLineShader({get:true})},translucent:function(){return true}});}_installWarnMaterial(){var t=e.Color,n=e.defaultValue,r=e.defined,a=Object.defineProperties,u=e.Event,d=e.createPropertyDescriptor,s=e.Property,i=e.Material;function o(c){c=n(c,n.EMPTY_OBJECT),this._definitionChanged=new u,this._color=void 0,this._colorSubscription=void 0,this.color=c.color||t.BLUE,this.duration=c.duration||3e3,this._time=new Date().getTime();}a(o.prototype,{isvarant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}}}),o.prototype.getType=function(){return i.WarnLinkType},o.prototype.getValue=function(c,m){return r(m)||(m={}),m.color=s.getValueOrClonedDefault(this._color,c,t.WHITE,m.color),m.image=i.WarnLinkImage,m.time=(new Date().getTime()-this._time)%this.duration/this.duration,m},o.prototype.equals=function(c){return this===c||c instanceof o&&s.equals(this._color,c._color)},a(o.prototype,{color:d("color")}),e.Scene.WarnLinkMaterialProperty=o,i.WarnLinkType="WarnWallLinkType",i.WarnLinkImage=this.getDfSt(["material","WarnLinkMaterialProperty"])||"static/data/images/Textures/jsx2.png",i._materialCache.addMaterial(i.WarnLinkType,{fabric:{type:i.WarnLinkType,uniforms:{color:new t(1,0,0,.5),image:i.WarnLinkImage,time:0},source:this._getDirectionWallShader({get:true,count:10,freely:"cross",direction:"-"})},translucent:function(){return true}});}_installFlowMaterial(){var t=e.Color,n=e.defaultValue,r=Object.defineProperties,a=e.Event,u=e.createPropertyDescriptor,d=e.Property,s=e.Material;function i(o){o=n(o,n.EMPTY_OBJECT),this._definitionChanged=new a,this._color=void 0,this._colorSubscription=void 0,this.color=o.color||t.fromBytes(0,255,255,255),this._duration=void 0,this._durationSubscription=void 0,this.duration=n(o.duration,45);}r(i.prototype,{isConstant:{get:function(){return false}},definitionChanged:{get:function(){return this._definitionChanged}}}),i.prototype.getType=function(){return s.PolylineFlowType},i.prototype.getValue=function(o,c){return c||(c={}),c.color=d.getValueOrClonedDefault(this._color,o,e.Color.WHITE,c.color),c.duration=this._duration,c},i.prototype.equals=function(o){return this===o||o instanceof i&&d.equals(this._color,o._color)},r(i.prototype,{color:u("color"),duration:u("duration")}),e.Scene.PolylineFlowMaterialProperty=i,s.PolylineFlowType="PolylineFlow",s._materialCache.addMaterial(s.PolylineFlowType,{fabric:{type:s.PolylineFlowType,uniforms:{color:new t(1,1,2,.7),duration:45},source:this._getFlowLineShader({get:true})},translucent:function(){return true}});}_installPolylineTrailLinkMaterial(){var t=e.Color,n=e.defaultValue,r=Object.defineProperties,a=e.createPropertyDescriptor,u=e.Event,d=e.Property,s=e.Material,i=this.getDfSt(["primitive","WaterPrimitive"]);function o(c){c=n(c,n.EMPTY_OBJECT),this._definitionChanged=new u,this._color=void 0,this.color=c.color||e.Color.WHITE,this.image=c.image||i,this._colorSubscription=void 0,this.duration=c.duration||3e3,this._time=new Date().getTime(),this.speed=c.speed,this.isTranslucent=function(){return true};}r(o.prototype,{isConstant:{get:function(){return false},configurable:true},definitionChanged:{get:function(){return this._definitionChanged},configurable:true},color:a("color"),duration:a("duration")}),o.prototype.getType=function(){return s.PolylineTrailLinkType},o.prototype.getValue=function(c,m){return e.defined(m)||(m={}),m.color=d.getValueOrClonedDefault(this._color,c,this.color,m.color),m.image=s.PolylineTrailLinkImage,m.time=(new Date().getTime()-this._time)%this.duration/this.duration*this.speed,m},o.prototype.equals=function(c){return this===c||c instanceof o&&d.equals(this._color,c._color)},s.PolylineTrailLinkSource=`
140
+ uniform vec4 color;
141
+ uniform float time;
142
+ uniform sampler2D image;
143
+ czm_material czm_getMaterial(czm_materialInput materialInput)
144
+ {
145
+ czm_material material = czm_getDefaultMaterial(materialInput);
146
+ vec2 st = materialInput.st;
147
+ vec4 colorImage = texture(image, vec2(fract(st.s - time), st.t));
148
+ material.alpha = colorImage.a * color.a;
149
+ material.diffuse = (colorImage.rgb+color.rgb)/2.0;
150
+ return material;
151
+ }`,e.Scene.PolylineTrailLinkMaterial=o,s.PolylineTrailLinkType="PolylineTrailLinkMaterial",s.PolylineTrailLinkImage=this.image||i||"static/data/images/Textures/river.png",s._materialCache.addMaterial(s.PolylineTrailLinkType,{fabric:{type:s.PolylineTrailLinkType,uniforms:{color:new t(1,1,1,1),image:s.PolylineTrailLinkImage,time:-20},source:s.PolylineTrailLinkSource},translucent:function(){return true}});}}return p}var N=V(ce);var R=function(){};R.prototype={_getFlowLineShader:function(){return `uniform vec4 color;
152
+ uniform float duration;
153
+
154
+ czm_material czm_getMaterial(czm_materialInput materialInput){
155
+ czm_material material = czm_getDefaultMaterial(materialInput);
156
+ vec2 st = materialInput.st;
157
+ float t =fract(czm_frameNumber / duration);
158
+ t *= 1.03;
159
+ float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s);
160
+ alpha += 0.1;
161
+ vec4 fragColor;
162
+ fragColor.rgb = (color.rgb) / 0.5;
163
+ fragColor = czm_gammaCorrect(fragColor);
164
+ material.diffuse = fragColor.rgb;
165
+ material.alpha = alpha;
166
+ material.emission = fragColor.rgb;
167
+ return material;
168
+ }
169
+ `},_getDynamicLineShader:function(e){if(e&&e.get)return `czm_material czm_getMaterial(czm_materialInput materialInput)
170
+ {
171
+ czm_material material = czm_getDefaultMaterial(materialInput);
172
+ vec2 st = materialInput.st;
173
+
174
+ if(texture(image, vec2(0.0, 0.0)).a == 1.0){
175
+ discard;
176
+ }else{
177
+ material.alpha = texture(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;
178
+ }
179
+
180
+ material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);
181
+
182
+ return material;
183
+ }
184
+ `},_getDynamicLightLineShader:function(e){if(e&&e.get)return `czm_material czm_getMaterial(czm_materialInput materialInput)
185
+ {
186
+ czm_material material = czm_getDefaultMaterial(materialInput);
187
+ vec2 st = materialInput.st;
188
+
189
+ vec4 colorImage = texture(image, vec2(fract(1.0 *st.s - time), fract(st.t)));
190
+
191
+ vec4 fragColor;
192
+ fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;
193
+ fragColor = czm_gammaCorrect(fragColor);
194
+ material.diffuse = colorImage.rgb;
195
+ material.alpha = colorImage.a;
196
+ material.emission = fragColor.rgb;
197
+
198
+ return material;
199
+ }
200
+ `},_getDirectionWallShader:function(e){if(e&&e.get){var l=`czm_material czm_getMaterial(czm_materialInput materialInput)
201
+ {
202
+ czm_material material = czm_getDefaultMaterial(materialInput);
203
+ vec2 st = materialInput.st;
204
+
205
+ `;return e.freely=="vertical"?l+="vec4 colorImage = texture(image, vec2(fract(float("+e.count+")*st.t "+e.direction+` time), fract(st.s)));
206
+ `:l+="vec4 colorImage = texture(image, vec2(fract(float("+e.count+")*st.s "+e.direction+` time), fract(st.t)));
207
+ `,l+=`vec4 fragColor;
208
+ fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;
209
+ fragColor = czm_gammaCorrect(fragColor);
210
+ `,l+=` material.diffuse = colorImage.rgb;
211
+ material.alpha = colorImage.a;
212
+ material.emission = fragColor.rgb;
213
+
214
+ return material;
215
+ }
216
+ `,l}},_getCircleFadeShader:function(e){if(e&&e.get)return `czm_material czm_getMaterial(czm_materialInput materialInput)
217
+
218
+ {
219
+
220
+ czm_material material = czm_getDefaultMaterial(materialInput);
221
+
222
+ material.diffuse = 1.5 * color.rgb;
223
+
224
+ vec2 st = materialInput.st;
225
+
226
+ float dis = distance(st, vec2(0.5, 0.5));
227
+
228
+ float per = fract(time);
229
+
230
+ if(dis > per * 0.5){
231
+
232
+ //material.alpha = 0.0;
233
+
234
+ discard;
235
+
236
+ }else {
237
+
238
+ material.alpha = color.a * dis / per / 2.0;
239
+
240
+ }
241
+
242
+ return material;
243
+
244
+ }`},_getDynamicCircleShader:function(e){if(e&&e.get)return `uniform vec4 color;
245
+ uniform float duration;
246
+ uniform float count;
247
+ uniform float gradient;
248
+
249
+ czm_material czm_getMaterial(czm_materialInput materialInput)
250
+ {
251
+ czm_material material = czm_getDefaultMaterial(materialInput);
252
+ material.diffuse = 1.5 * color.rgb;
253
+ vec2 st = materialInput.st;
254
+ vec3 str = materialInput.str;
255
+ float dis = distance(st, vec2(0.5, 0.5));
256
+ float per = fract(czm_frameNumber / duration);
257
+ if(abs(str.z) > 0.001){
258
+ discard;
259
+ }
260
+ if(dis > 0.5){
261
+ discard;
262
+ } else {
263
+ float perDis = 0.5 / count;
264
+ float disNum;
265
+ float bl = .0;
266
+ for (int i = 0; i <= 10; i++) {
267
+ if (float(i) <= count) {
268
+ disNum = perDis * float(i) - dis + per / count;
269
+ if (disNum > 0.0) {
270
+ if (disNum < perDis) {
271
+ bl = 1.0 - disNum / perDis;
272
+ } else if (disNum - perDis < perDis) {
273
+ bl = 1.0 - abs(1.0 - disNum / perDis);
274
+ }
275
+ material.alpha = pow(bl, gradient);
276
+ }
277
+ }
278
+ }
279
+ }
280
+ return material;
281
+ }
282
+ `},_getRadarScanShader:function(e){if(e&&e.get)return `uniform sampler2D colorTexture;
283
+ uniform sampler2D depthTexture;
284
+ in vec2 v_textureCoordinates;
285
+ uniform vec4 u_scanCenterEC;
286
+ uniform vec3 u_scanPlaneNormalEC;
287
+ uniform vec3 u_scanLineNormalEC;
288
+ uniform float u_radius;
289
+ uniform vec4 u_scanColor;
290
+
291
+ vec4 toEye(in vec2 uv, in float depth){
292
+ vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));
293
+ vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);
294
+ posInCamera =posInCamera / posInCamera.w;
295
+ return posInCamera;
296
+ }
297
+
298
+ bool isPointOnLineRight(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){
299
+ vec3 v01 = testPt - ptOnLine;
300
+ normalize(v01);
301
+ vec3 temp = cross(v01, lineNormal);
302
+ float d = dot(temp, u_scanPlaneNormalEC);
303
+ return d > 0.5;
304
+ }
305
+
306
+ vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){
307
+ vec3 v01 = point -planeOrigin;
308
+ float d = dot(planeNormal, v01) ;
309
+ return (point - planeNormal * d);
310
+ }
311
+
312
+ float distancePointToLine(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){
313
+ vec3 tempPt = pointProjectOnPlane(lineNormal, ptOnLine, testPt);
314
+ return length(tempPt - ptOnLine);
315
+ }
316
+
317
+ float getDepth(in vec4 depth){
318
+ float z_window = czm_unpackDepth(depth);
319
+ z_window = czm_reverseLogDepth(z_window);
320
+ float n_range = czm_depthRange.near;
321
+ float f_range = czm_depthRange.far;
322
+ return (2.0 * z_window - n_range - f_range) / (f_range - n_range);
323
+ }
324
+
325
+ void main(){
326
+ out_FragColor = texture(colorTexture, v_textureCoordinates);
327
+ float depth = getDepth( texture(depthTexture, v_textureCoordinates));
328
+ vec4 viewPos = toEye(v_textureCoordinates, depth);
329
+ vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);
330
+ float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);
331
+ float twou_radius = u_radius * 2.0;
332
+ if(dis < u_radius){
333
+ float f0 = 1.0 -abs(u_radius - dis) / u_radius;
334
+ f0 = pow(f0, 64.0);
335
+ vec3 lineEndPt = vec3(u_scanCenterEC.xyz) + u_scanLineNormalEC * u_radius;
336
+ float f = 0.0;
337
+ if(isPointOnLineRight(u_scanCenterEC.xyz, u_scanLineNormalEC.xyz, prjOnPlane.xyz)){
338
+ float dis1= length(prjOnPlane.xyz - lineEndPt);
339
+ f = abs(twou_radius -dis1) / twou_radius;
340
+ f = pow(f, float(`+e.width+`));
341
+ }
342
+ if(float(`+e.border+`) > 0.0){
343
+ out_FragColor = mix(out_FragColor, u_scanColor, f + f0);
344
+ } else {
345
+ out_FragColor = mix(out_FragColor, u_scanColor, f);
346
+ }
347
+ }
348
+ }
349
+ `},_getCircleScanShader:function(e){if(e&&e.get)return `uniform sampler2D colorTexture;
350
+ uniform sampler2D depthTexture;
351
+ in vec2 v_textureCoordinates;
352
+ uniform vec4 u_scanCenterEC;
353
+ uniform vec3 u_scanPlaneNormalEC;
354
+ uniform float u_radius;
355
+ uniform vec4 u_scanColor;
356
+
357
+ vec4 toEye(in vec2 uv, in float depth){
358
+ vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));
359
+ vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);
360
+ posInCamera =posInCamera / posInCamera.w;
361
+ return posInCamera;
362
+ }
363
+
364
+ vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){
365
+ vec3 v01 = point - planeOrigin;
366
+ float d = dot(planeNormal, v01) ;
367
+ return (point - planeNormal * d);
368
+ }
369
+
370
+ float getDepth(in vec4 depth){
371
+ float z_window = czm_unpackDepth(depth);
372
+ z_window = czm_reverseLogDepth(z_window);
373
+ float n_range = czm_depthRange.near;
374
+ float f_range = czm_depthRange.far;
375
+ return (2.0 * z_window - n_range - f_range) / (f_range - n_range);
376
+ }
377
+
378
+ void main(){
379
+ out_FragColor = texture(colorTexture, v_textureCoordinates);
380
+ float depth = getDepth(texture(depthTexture, v_textureCoordinates));
381
+ vec4 viewPos = toEye(v_textureCoordinates, depth);
382
+ vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);
383
+ float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);
384
+ if(dis < u_radius){
385
+ float f = 1.0 - abs(u_radius - dis) / u_radius;
386
+ f = pow(f, float(`+e.border+`));
387
+ out_FragColor = mix(out_FragColor, u_scanColor, f);
388
+ }
389
+ }
390
+ `}};var Le=Z([A,R],N,"material");export{Le as Material};//# sourceMappingURL=material.mjs.map
391
+ //# sourceMappingURL=material.mjs.map