mirror of
https://gitee.com/ice-gl/icegl-three-vue-tres.git
synced 2025-04-05 06:22:43 +08:00
2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
import{a as E,l as L,y as K,x as G,g as Q}from"./trescientos-214666d1.js";import{p as ee,A as C,D as x,C as y,q as j,r as oe,s as B,t as D,o as I,O as z,u as X,V as M,v as O,w as R,x as W,b as T,y as ne,z as te,c as ie,G as ae,H as se,J as pe,T as re,m as me,l as le}from"./three.module-d47ac97c.js";import{Y as k,j as b,ae as $,o as g,s as S,B as P,aa as U,I as h,U as d,ak as ce,c as V,a as w,ai as q,aj as H,_ as Y,al as F}from"./vendor-19b019cc.js";const ue=d("TresPerspectiveCamera",{position:[0,50,300],fov:40,far:800,plane:1},null,-1),de=["position"],fe=d("TresPointsMaterial",{color:"#66ffff",size:1.1,transparency:!0,opacity:.8},null,-1),he=k({__name:"starts",setup(s){const o={clearColor:"#000000",alpha:!0,useLegacyLights:!0,antialias:!0},e=b();let n,a=null;$(()=>{e.value&&(e.value.context.renderer.value.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),e.value.context.renderer.value.autoClear=!1,e.value.context.renderer.value.setClearColor(0,0),a=e.value.context.scene.value,n=e.value.context.camera.value,a.fog=new ee(1776411,1e-4),n.position.z=800/2)});const r=window.innerWidth/2,i=window.innerHeight/2;let m=0,t=0;function p(l){m=l.clientX-r,t=l.clientY-i}document.addEventListener("mousemove",p,!1);const c=new Float32Array(45e3*3);for(let l=0;l<45e3;l++)c[l*3+0]=Math.random()*2e3-1e3,c[l*3+1]=Math.random()*2e3-1e3,c[l*3+2]=Math.random()*2e3-1e3;const{onLoop:_}=E();return _(()=>{n&&(n.position.x+=(m-n.position.x)*.005,n.position.y+=(-t-n.position.y)*.005,n.lookAt(a.position))}),(l,f)=>(g(),S(h(L),U({ref_key:"TresCanvasRef",ref:e},o,{"window-size":""}),{default:P(()=>[ue,d("TresPoints",null,[d("TresBufferGeometry",{args:[1e3,100,50],position:[h(c),3]},null,8,de),fe])]),_:1},16))}}),J=s=>(q("data-v-b13303a3"),s=s(),H(),s),_e={class:"position-absolute w-full h-full"},ve=J(()=>d("TresPerspectiveCamera",{position:[0,100,420],fov:50,aspect:1,near:1,far:1e4},null,-1)),we=["rotation-x"],ge=J(()=>d("TresPlaneGeometry",{args:[400,400]},null,-1)),xe=["map","alphaMap","blending","side"],ye=k({__name:"circle",async setup(s){let o,e;const n={clearColor:"#000000",alpha:!0,useLegacyLights:!0,antialias:!0,logarithmicDepthBuffer:!0,precision:"highp",premultipliedAlpha:!1},a=([o,e]=ce(()=>K({map:"./plugins/earthSample/image/menuA/quan_01.png"})),o=await o,e(),o),{onLoop:r}=E();r(({delta:t})=>{m.value&&(m.value.rotation.z-=.005)});const i=b(),m=b();return $(()=>{if(i.value&&i.value.context){i.value.context.renderer.value.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),i.value.context.renderer.value.autoClear=!0,i.value.context.renderer.value.autoClearColor=new y(1,0,0,0),i.value.context.renderer.value.setClearColor(0,0);const t=i.value.context.scene.value;i.value.context.camera.value,t.fog=new j(4095,100,1e3)}m.value}),(t,p)=>(g(),V("div",_e,[w(h(L),U({class:"TresCanvasNoPointerEvents",ref_key:"TresCanvasRef",ref:i},n),{default:P(()=>[ve,w(h(G),{autoRotate:!1}),d("TresMesh",{ref_key:"quanMeshRef",ref:m,position:[0,0,0],"rotation-x":2*Math.PI/360*100},[ge,d("TresMeshBasicMaterial",{color:"#ffffff",map:h(a).map,alphaMap:h(a).map,blending:h(C),side:h(x),depthTest:.2,opacity:1,depthWrite:!1,transparent:!0,alphaTest:0},null,8,xe)],8,we)]),_:1},16)]))}});const Me=Y(ye,[["__scopeId","data-v-b13303a3"]]),N=[{name:"中国",position:[116.2,39.55]},{name:"中非共和国",position:[18.35,4.23]},{name:"智利",position:[-70.4,-33.24]},{name:"乍得",position:[14.59,12.1]},{name:"赞比亚",position:[28.16,-15.28]},{name:"越南",position:[105.55,21.05]},{name:"约旦",position:[35.52,31.57]},{name:"英属维尔京群岛",position:[-64.37,18.27]},{name:"英国",position:[-.05,51.36]},{name:"印度尼西亚",position:[106.49,-6.09]},{name:"印度",position:[77.13,28.37]},{name:"意大利",position:[12.29,41.54]},{name:"以色列",position:[35.12,31.47]},{name:"伊朗",position:[51.3,35.44]},{name:"伊拉克",position:[44.3,33.2]},{name:"亚美尼亚",position:[44.31,40.1]},{name:"牙买加",position:[-76.5,18]},{name:"匈牙利",position:[19.05,47.29]},{name:"新西兰",position:[174.46,-41.19]},{name:"新喀里多尼亚",position:[166.3,-22.17]},{name:"希腊",position:[23.46,37.58]},{name:"西班牙",position:[-3.45,40.25]},{name:"乌兹别克斯坦",position:[69.1,41.2]},{name:"乌拉圭",position:[-56.11,-34.5]},{name:"乌克兰",position:[30.28,50.3]},{name:"乌干达",position:[32.3,.2]},{name:"文莱",position:[115,4.52]},{name:"委内瑞拉",position:[-66.55,10.3]},{name:"危地马拉",position:[-90.22,14.4]},{name:"瓦努阿图",position:[168.18,-17.45]},{name:"土库曼斯坦",position:[57.5,38]},{name:"土耳其",position:[32.54,39.57]},{name:"图瓦卢",position:[179.13,-8.31]},{name:"突尼斯",position:[10.11,36.5]},{name:"汤加",position:[-174,-21.1]},{name:"坦桑尼亚",position:[35.45,-6.08]},{name:"泰国",position:[100.35,13.45]},{name:"塔吉克斯坦",position:[68.48,38.33]},{name:"索马里",position:[45.25,2.02]},{name:"所罗门群岛",position:[159.57,-9.27]},{name:"苏里南",position:[-55.1,5.5]},{name:"苏丹",position:[32.35,15.31]},{name:"斯威士兰",position:[31.06,-26.18]},{name:"斯洛文尼亚",position:[14.33,46.04]},{name:"斯洛伐克",position:[17.07,48.1]},{name:"圣文森特和格林纳丁斯",position:[-61.1,13.1]},{name:"圣皮埃尔和密克隆",position:[-56.12,46.46]},{name:"圣马力诺",position:[12.3,43.55]},{name:"圣卢西亚",position:[-60.58,14.02]},{name:"圣基茨和尼维斯",position:[-62.43,17.17]},{name:"圣多美和普林西比",position:[6.39,.1]},{name:"沙特阿拉伯",position:[46.42,24.41]},{name:"塞浦路斯",position:[33.25,35.1]},{name:"塞内加尔",position:[-17.29,14.34]},{name:"塞拉利昂",position:[-13.17,8.3]},{name:"萨摩亚",position:[-171.5,-13.5]},{name:"萨尔瓦多",position:[-89.1,13.4]},{name:"瑞士",position:[7.28,46.57]},{name:"瑞典",position:[18.03,59.2]},{name:"葡萄牙",position:[-9.1,38.42]},{name:"帕劳",position:[134.28,7.2]},{name:"诺福克岛",position:[168.43,-45.2]},{name:"挪威",position:[10.45,59.55]},{name:"尼日利亚",position:[7.32,9.05]},{name:"尼日尔",position:[2.06,13.27]},{name:"尼加拉瓜",position:[-86.2,12.06]},{name:"尼泊尔",position:[85.2,27.45]},{name:"南斯拉夫",position:[20.37,44.5]},{name:"纳米比亚",position:[17.04,-22.35]},{name:"墨西哥",position:[-99.1,19.2]},{name:"莫桑比克",position:[32.32,-25.58]},{name:"摩尔多瓦共和国",position:[28.5,47.02]},{name:"缅甸",position:[96.2,16.45]},{name:"秘鲁",position:[-77,-12]},{name:"孟加拉国",position:[90.26,23.43]},{name:"美属维尔京群岛",position:[-64.56,18.21]},{name:"美属萨摩亚",position:[-170.43,-14.16]},{name:"美国",position:[-77.02,39.91]},{name:"毛里塔尼亚",position:[57.3,-20.1]},{name:"马约特岛",position:[45.14,-12.48]},{name:"马提尼克岛",position:[-61.02,14.36]},{name:"马其顿",position:[21.26,42.01]},{name:"马里",position:[-7.55,12.34]},{name:"马来西亚",position:[101.41,3.09]},{name:"马拉维",position:[33.48,-14]},{name:"马耳他",position:[14.31,35.54]},{name:"马尔代夫",position:[73.28,4]},{name:"马达加斯加",position:[47.31,-18.55]},{name:"罗马尼亚",position:[26.1,44.27]},{name:"卢旺达",position:[30.04,-1.59]},{name:"卢森堡",position:[6.09,49.37]},{name:"列支敦士登",position:[9.31,47.08]},{name:"利比里亚",position:[-10.47,6.18]},{name:"立陶宛",position:[25.19,54.38]},{name:"黎巴嫩",position:[35.31,33.53]},{name:"老挝",position:[102.36,17.58]},{name:"莱索托",position:[27.3,-29.18]},{name:"拉脱维亚",position:[24.08,56.53]},{name:"肯尼亚",position:[36.48,-1.17]},{name:"克罗地亚",position:[15.58,45.5]},{name:"科威特",position:[48,29.3]},{name:"科特迪瓦",position:[-5.17,6.49]},{name:"科摩罗",position:[43.16,-11.4]},{name:"开曼群岛",position:[-81.24,19.2]},{name:"卡塔尔",position:[51.35,25.15]},{name:"喀麦隆",position:[11.35,3.5]},{name:"津巴布韦",position:[31.02,-17.43]},{name:"捷克共和国",position:[14.22,50.05]},{name:"柬埔寨",position:[104.55,11.33]},{name:"加蓬",position:[9.26,.25]},{name:"加纳",position:[-.06,5.35]},{name:"加拿大",position:[-75.42,45.27]},{name:"几内亚比绍",position:[-15.45,11.45]},{name:"几内亚",position:[-13.49,9.29]},{name:"吉尔吉斯斯坦",position:[74.46,42.54]},{name:"吉布提",position:[42.2,11.08]},{name:"基里巴斯",position:[173,1.3]},{name:"洪都拉斯",position:[-87.14,14.05]},{name:"赫德岛和麦当劳群岛",position:[74,-53]},{name:"荷属安的列斯",position:[-69,12.05]},{name:"荷兰",position:[4.54,52.23]},{name:"韩国",position:[126.58,37.31]},{name:"海地",position:[-72.2,18.4]},{name:"哈萨克斯坦",position:[71.3,51.1]},{name:"圭亚那",position:[-58.12,6.5]},{name:"瓜德罗普岛",position:[-61.44,16]},{name:"古巴",position:[-82.22,23.08]},{name:"根西岛",position:[-2.33,49.26]},{name:"格鲁吉亚",position:[44.5,41.43]},{name:"格陵兰",position:[-51.35,64.1]},{name:"哥斯达黎加",position:[-84.02,9.55]},{name:"哥伦比亚",position:[-74,4.34]},{name:"刚果",position:[15.12,-4.09]},{name:"刚果(扎伊尔)",position:[15.15,-4.2]},{name:"冈比亚",position:[-16.4,13.28]},{name:"福克兰群岛(马尔维纳斯群岛)",position:[-59.51,-51.4]},{name:"佛得角",position:[-23.34,15.02]},{name:"芬兰",position:[25.03,60.15]},{name:"斐济",position:[178.3,-18.06]},{name:"菲律宾",position:[121.03,14.4]},{name:"法属圭亚那",position:[-52.18,5.05]},{name:"法属波利尼西亚",position:[-149.34,-17.32]},{name:"法罗群岛",position:[-6.56,62.05]},{name:"法国",position:[2.2,48.5]},{name:"厄立特里亚",position:[38.55,15.19]},{name:"厄瓜多尔",position:[-78.35,-.15]},{name:"俄罗斯",position:[37.35,55.45]},{name:"多米尼加共和国",position:[-69.59,18.3]},{name:"多米尼加",position:[-61.24,15.2]},{name:"多哥",position:[1.2,6.09]},{name:"东帝汶",position:[125.34,-8.29]},{name:"德国",position:[13.25,52.3]},{name:"丹麦",position:[12.34,55.41]},{name:"赤道几内亚",position:[8.5,3.45]},{name:"朝鲜",position:[125.3,39.09]},{name:"布隆迪",position:[29.18,-3.16]},{name:"布基纳法索",position:[-1.3,12.15]},{name:"不丹",position:[89.45,27.31]},{name:"博茨瓦纳",position:[25.57,-24.45]},{name:"伯利兹",position:[-88.3,17.18]},{name:"玻利维亚",position:[-68.1,-16.2]},{name:"波斯尼亚和黑塞哥维那",position:[18.26,43.52]},{name:"波兰",position:[21,52.13]},{name:"波多黎各",position:[-66.07,18.28]},{name:"冰岛",position:[-21.57,64.1]},{name:"比利时",position:[4.21,50.51]},{name:"比勒陀利亚",position:[28.12,-25.44]},{name:"贝宁",position:[2.42,6.23]},{name:"北马里亚纳群岛",position:[145.45,15.12]},{name:"保加利亚",position:[23.2,42.45]},{name:"白俄罗斯",position:[27.3,53.52]},{name:"巴西",position:[-47.55,-15.47]},{name:"巴拿马",position:[-79.25,9]},{name:"巴林",position:[50.3,26.1]},{name:"巴拉圭",position:[-57.3,-25.1]},{name:"巴基斯坦",position:[73.1,33.4]},{name:"巴哈马",position:[-77.2,25.05]},{name:"巴布亚新几内亚",position:[147.08,-9.24]},{name:"巴巴多斯",position:[-59.3,13.05]},{name:"澳大利亚",position:[149.08,-35.15]},{name:"奥地利",position:[16.22,48.12]},{name:"安提瓜和巴布达",position:[-61.48,17.2]},{name:"安哥拉",position:[13.15,-8.5]},{name:"安道尔",position:[1.32,42.31]},{name:"爱沙尼亚",position:[24.48,59.22]},{name:"爱尔兰",position:[-6.15,53.21]},{name:"埃塞俄比亚",position:[38.42,9.02]},{name:"埃及",position:[31.14,30.01]},{name:"阿塞拜疆",position:[49.56,40.29]},{name:"阿曼",position:[58.36,23.37]},{name:"阿鲁巴",position:[-70.02,12.32]},{name:"阿联酋",position:[54.22,24.28]},{name:"阿拉伯叙利亚共和国",position:[36.18,33.3]},{name:"阿拉伯利比亚民众国",position:[13.07,32.49]},{name:"阿根廷",position:[-60,-36.3]},{name:"阿富汗",position:[69.11,34.28]},{name:"阿尔及利亚",position:[3.08,36.42]},{name:"阿尔巴尼亚",position:[19.49,41.18]}],Pe=s=>{const o=new X;o.radius=100;const e=s[0],n=s[1],a=(e+90)*(Math.PI/180),r=(90-n)*(Math.PI/180);o.phi=r,o.theta=a;const i=new M;return i.setFromSpherical(o),i},Ce=(s,o)=>{const e=new z,a=["#66ffff","#66aaaa"][o],r=new O(2,6),i=new R({color:a,side:x,transparent:!0,opacity:1}),t=new O(3,6).getAttribute("position"),p=new Float32Array(t.count*3-3);for(let v=3;v<t.array.length;v++)p[v-3]=t.array[v];const c=new W;c.setAttribute("position",new T(p,3));const _=new R({color:a,side:x,blending:C}),l=new ne(c,_),f=new I(r,i);return f.position.copy(s),l.position.copy(s),f.lookAt(new M(0,0,0)),l.lookAt(new M(0,0,0)),e.add(l),e.add(f),e},be=s=>{const o=new B().load("./plugins/earthSample/image/menuA/lightray.jpg"),e=new R({map:o,alphaMap:o,transparent:!0,depthTest:!0,depthWrite:!0,alphaTest:.3,opacity:.9,side:x,color:16777215,blending:C}),n=50*Math.random(),a=new te(6,n),r=new ie,i=new I(a,e);r.makeRotationX(Math.PI/2),r.setPosition(new M(0,0,n/-2)),a.applyMatrix4(r);const m=i.clone();return m.rotation.z=Math.PI/2,i.add(m),i.position.copy(s),i.lookAt(0,0,0),i},Ae=s=>{for(let o=0;o<N.length;o++){const e=Pe(N[o].position),n=Math.floor(2*Math.random());s.add(Ce(e,n)),s.add(be(e))}},Re=(s,o,e,n)=>{const a=Math.trunc(n.width*s),r=Math.trunc(n.height*o);return e.data[4*(r*e.width+a)]===0},Te=(s,o,e)=>{const n=[],a=[],r=[];for(let t=0;t<2;t++){n[t]={positions:[]},r[t]={sizes:[]};const p=new ae;p.size=5,p.color=new y(10092543),p.map=new B().load("/icegl-three-vue-tresplugins/earthSample/image/menuA/circle.png"),p.depthWrite=!1,p.transparent=!0,p.opacity=.2,p.side=se,p.blending=C;const c=t/2;p.t_=c*Math.PI*2,p.speed_=.05,p.min_=.2*Math.random()+.5,p.delta_=.1*Math.random()+.1,p.opacity_coef_=1,a.push(p)}const i=new X;i.radius=100;for(let t=200,p=0;p<t;p++)for(let c=new M,_=t*(1-Math.sin(p/t*Math.PI))/t+.5,l=0;l<t;l+=_){const f=l/t,v=p/t,u=Math.floor(2*Math.random()),A=n[u],Z=r[u];Re(f,v,o,e)&&(i.theta=f*Math.PI*2-Math.PI/2,i.phi=v*Math.PI,c.setFromSpherical(i),A.positions.push(c.x),A.positions.push(c.y),A.positions.push(c.z),l%3===0&&Z.sizes.push(6))}const m=new z;for(let t=0;t<n.length;t++){const p=new W,c=n[t],_=r[t],l=new Float32Array(c.positions.length),f=new Float32Array(_.sizes.length);for(let u=0;u<c.positions.length;u++)l[u]=c.positions[u];for(let u=0;u<_.sizes.length;u++)f[u]=_.sizes[u];p.setAttribute("position",new T(l,3)),p.setAttribute("size",new T(f,1)),p.computeBoundingSphere();const v=new pe(p,a[t]);m.add(v)}m.name="pointsEearth",s.add(m)},Se=s=>{const o=document.createElement("img");o.src="/icegl-three-vue-tresplugins/earthSample/image/menuA/earth.jpg",o.onload=function(){const e=document.createElement("canvas"),n=e.getContext("2d");e.width=o.width,e.height=o.height,n.drawImage(o,0,0,o.width,o.height);const a=n.getImageData(0,0,o.width,o.height);Te(s,a,o)}},Ee=s=>{const o=function(m){const t={uTex:{type:"t",value:m.map||new re},offsetRepeat:{value:new me(0,0,1,1)},alphaProportion:{type:"1f",value:m.alphaProportion||.5},diffuse:{value:m.color||new y(16777215)},opacity:{value:m.opacity||1},gridOffset:{value:0}};return new le({uniforms:t,vertexShader:" \nvarying float _alpha;\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\nuniform float alphaProportion;\nvoid main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\nvec4 worldPosition = modelMatrix * vec4( vec3( position ), 1.0 );\nvec3 cameraToVertex = normalize( cameraPosition - worldPosition.xyz);\n_alpha = 1.0 - max( 0.0, dot( normal, cameraToVertex ) );\n_alpha = max( 0.0, (_alpha - alphaProportion) / (1.0 - alphaProportion) );\n}",fragmentShader:"\nuniform sampler2D uTex;\nuniform vec3 diffuse;\nuniform float opacity;\nuniform float gridOffset;\nvarying float _alpha;\nvarying vec2 vUv;\nvoid main() {\nvec4 texColor = texture2D( uTex, vUv );\nfloat _a = _alpha * opacity;\nif( _a <= 0.0 ) discard;\n_a = _a * ( sin( vUv.y * 1.0 + gridOffset ) * .5 + .5 );\ngl_FragColor = vec4( texColor.rgb * diffuse, _a );\n}",transparent:!0,blending:C,depthTest:!1,side:x})},e=new oe(110.00000000000001,120,144),n=new B().load("/icegl-three-vue-tresplugins/earthSample/image/menuA/clouds.png");n.wrapT=D,n.wrapS=D;const a=new o({map:n,alphaProportion:.35,color:new y(6723993),opacity:1,gridOffsetSpeed:.6}),r=new I(e,a);r.matrixAutoUpdate=!1;const i=new z;return i.name="cloudsEearth",i.add(r),s.add(i),i},Le={class:"w-full h-full"},Be=d("TresPerspectiveCamera",{position:[0,0,365],fov:45,near:1,far:1e4},null,-1),Ie={__name:"earth",setup(s){const o={clearColor:"#000000",alpha:!0,useLegacyLights:!0,antialias:!0,logarithmicDepthBuffer:!0},e=b();let n=null;const a=[],{seek:r}=Q();$(()=>{e.value&&e.value.context&&(e.value.context.renderer.value.setPixelRatio(window.devicePixelRatio?window.devicePixelRatio:1),e.value.context.renderer.value.autoClear=!1,e.value.context.renderer.value.autoClearColor=new y(1,0,0,0),n=e.value.context.scene.value,n.fog=new j(4095,100,1e3),Ae(n),Se(n),a[1]=Ee(n))});const{onLoop:i}=E();return i(({delta:m})=>{if(a[0]===void 0){const t=r(n,"name","pointsEearth");t&&(a[0]=t)}a.length&&a[1]&&a[0]&&(a[1].rotation.z+=.002,a[0].rotation.y+=.002)}),(m,t)=>(g(),V("div",Le,[w(h(L),U({ref_key:"TresCanvasRef",ref:e},o),{default:P(()=>[Be,w(h(G),{autoRotate:!0,autoRotateSpeed:2,enableZoom:!1,enablePan:!1})]),_:1},16)]))}},ze=s=>(q("data-v-7ab41dcf"),s=s(),H(),s),ke={class:"bg-img flex justify-center flex-items-center"},$e={class:"w-120 h-120 pos-relative"},Ue=ze(()=>d("div",{class:"css_globe_halo1"},null,-1)),Ve=k({__name:"menuA",setup(s){return(o,e)=>(g(),V("div",ke,[w(he),d("div",$e,[(g(),S(F,null,{default:P(()=>[w(Me)]),_:1})),Ue,(g(),S(F,null,{default:P(()=>[w(Ie)]),_:1}))])]))}});const Ne=Y(Ve,[["__scopeId","data-v-7ab41dcf"]]);export{Ne as default};
|