diff --git a/static/pkg/atmosphere/assets/index-CHT4Xf7A.js b/static/pkg/atmosphere/assets/index-BZvypqGP.js similarity index 99% rename from static/pkg/atmosphere/assets/index-CHT4Xf7A.js rename to static/pkg/atmosphere/assets/index-BZvypqGP.js index 1e3fb3e0..72672868 100644 --- a/static/pkg/atmosphere/assets/index-CHT4Xf7A.js +++ b/static/pkg/atmosphere/assets/index-BZvypqGP.js @@ -10473,4 +10473,4 @@ void mainImage(const vec4 inputColor, const vec2 uv, out vec4 outputColor) { #endif `)},t}class Yue{constructor(){this._fadeParams=new WeakMap,this.fading=0}setFade(e,t,i){if(!e)return;const r=this._fadeParams;e.traverse(a=>{const s=a.material;if(s&&r.has(s)){const o=r.get(s);o.fadeIn.value=t,o.fadeOut.value=i;const l=+(!(t===0||t===1)||!(i===0||i===1));s.defines.FEATURE_FADE!==l&&(this.fading+=l===1?1:-1,s.defines.FEATURE_FADE=l,s.needsUpdate=!0)}})}prepareScene(e){e.traverse(t=>{t.material&&this.prepareMaterial(t.material)})}deleteScene(e){if(!e)return;this.setFade(e,1,0);const t=this._fadeParams;e.traverse(i=>{const r=i.material;r&&t.delete(r)})}prepareMaterial(e){const t=this._fadeParams;t.has(e)||t.set(e,FF(e,e.onBeforeCompile))}}class jue{constructor(e,t=new Sr){this.other=e,this.material=t,this.visible=!0,this.parent=null,this._instanceInfo=[],this._visibilityChanged=!0;const i=new Proxy(this,{get(r,a){if(a in r)return r[a];{const s=e[a];return s instanceof Function?(...o)=>(r.syncInstances(),s.call(i,...o)):e[a]}},set(r,a,s){return a in r?r[a]=s:e[a]=s,!0},deleteProperty(r,a){return a in r?delete r[a]:delete e[a]}});return i}syncInstances(){const e=this._instanceInfo,t=this.other._instanceInfo;for(;t.length>e.length;){const i=e.length;e.push(new Proxy({visible:!1},{get(r,a){return a in r?r[a]:t[i][a]},set(r,a,s){return a in r?r[a]=s:t[i][a]=s,!0}}))}}}class Zue extends jue{constructor(...e){super(...e);const t=this.material,i=FF(t,t.onBeforeCompile);t.defines.FEATURE_FADE=1,t.defines.USE_BATCHING_FRAG=1,t.needsUpdate=!0,this.fadeTexture=null,this._fadeParams=i}setFadeAt(e,t,i){this._initFadeTexture(),this.fadeTexture.setValueAt(e,t*255,i*255)}_initFadeTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=e*e*2,i=this.fadeTexture;if(!i||i.image.data.length!==t){const r=new Uint8Array(t),a=new Que(r,e,e,Mo,Ni);if(i){i.dispose();const s=i.image.data,o=this.fadeTexture.image.data,l=Math.min(s.length,o.length);o.set(new s.constructor(s.buffer,0,l))}this.fadeTexture=a,this._fadeParams.fadeTexture.value=a,a.needsUpdate=!0}}dispose(){this.fadeTexture&&this.fadeTexture.dispose()}}class Que extends Ur{setValueAt(e,...t){const{data:i,width:r,height:a}=this.image,s=Math.floor(i.length/(r*a));let o=!1;for(let l=0;l{const f=d.cached.scene;f&&(f.visible=d.__inFrustum),this.forEachBatchIds(d,(p,m,v)=>{m.setVisibleAt(p,d.__inFrustum),v.batchedMesh.setVisibleAt(p,d.__inFrustum)})}),s{if(!r.has(f))return;const p=f.matrixWorld,m=r.get(f);p.decompose(LU,UU,PU),m.decompose(OU,IU,PU);const v=UU.angleTo(IU),x=LU.distanceTo(OU);d=d&&(v>.25||x>.1)}),d&&n.completeAllFades()}if(l.forEach(d=>{r.get(d).copy(d.matrixWorld)}),n.forEachObject((d,{fadeIn:f,fadeOut:p})=>{const m=d.cached.scene,v=n.isFadingOut(d);a.markTileUsed(d),m&&(e.setFade(m,f,p),v&&(m.visible=!0)),this.forEachBatchIds(d,(x,S,_)=>{S.setFadeAt(x,f,p),S.setVisibleAt(x,!0),_.batchedMesh.setVisibleAt(x,!1)})}),o){const d=a.getPluginByName("BATCHED_TILES_PLUGIN").batchedMesh.material;o.material.map=d.map}}class $ue{get fadeDuration(){return this._fadeManager.duration}set fadeDuration(e){this._fadeManager.duration=Number(e)}get fadingTiles(){return this._fadeManager.fadeCount}constructor(e){e={maximumFadeOutTiles:50,fadeRootTiles:!1,fadeDuration:250,...e},this.name="FADE_TILES_PLUGIN",this.priority=-2,this.tiles=null,this.batchedMesh=null,this._quickFadeTiles=new Set,this._fadeManager=new que,this._fadeMaterialManager=new Yue,this._prevCameraTransforms=null,this._fadingOutCount=0,this.maximumFadeOutTiles=e.maximumFadeOutTiles,this.fadeRootTiles=e.fadeRootTiles,this.fadeDuration=e.fadeDuration}init(e){this._onLoadModel=({scene:r})=>{this._fadeMaterialManager.prepareScene(r)},this._onDisposeModel=({tile:r,scene:a})=>{this.tiles.visibleTiles.has(r)&&this._quickFadeTiles.add(r.parent),this._fadeManager.deleteObject(r),this._fadeMaterialManager.deleteScene(a)},this._onAddCamera=({camera:r})=>{this._prevCameraTransforms.set(r,new Me)},this._onDeleteCamera=({camera:r})=>{this._prevCameraTransforms.delete(r)},this._onTileVisibilityChange=({tile:r,visible:a})=>{const s=r.cached.scene;s&&(s.visible=!0),this.forEachBatchIds(r,(o,l,u)=>{l.setFadeAt(o,0,0),l.setVisibleAt(o,!1),u.batchedMesh.setVisibleAt(o,!1)})},this._onUpdateBefore=()=>{Kue.call(this)},this._onUpdateAfter=()=>{Jue.call(this)},e.addEventListener("load-model",this._onLoadModel),e.addEventListener("dispose-model",this._onDisposeModel),e.addEventListener("add-camera",this._onAddCamera),e.addEventListener("delete-camera",this._onDeleteCamera),e.addEventListener("update-before",this._onUpdateBefore),e.addEventListener("update-after",this._onUpdateAfter),e.addEventListener("tile-visibility-change",this._onTileVisibilityChange);const t=this._fadeManager;t.onFadeSetStart=()=>{e.dispatchEvent({type:"fade-start"}),e.dispatchEvent({type:"needs-render"})},t.onFadeSetComplete=()=>{e.dispatchEvent({type:"fade-end"}),e.dispatchEvent({type:"needs-render"})},t.onFadeComplete=(r,a)=>{this._fadeMaterialManager.setFade(r.cached.scene,0,0),this.forEachBatchIds(r,(s,o,l)=>{o.setFadeAt(s,0,0),o.setVisibleAt(s,!1),l.batchedMesh.setVisibleAt(s,a)}),a||(e.invokeOnePlugin(s=>s!==this&&s.setTileVisible&&s.setTileVisible(r,!1)),this._fadingOutCount--)};const i=new Map;e.cameras.forEach(r=>{i.set(r,new Me)}),e.forEachLoadedModel((r,a)=>{this._onLoadModel({scene:r})}),this.tiles=e,this._fadeManager=t,this._prevCameraTransforms=i}initBatchedMesh(){var e;const t=(e=this.tiles.getPluginByName("BATCHED_TILES_PLUGIN"))==null?void 0:e.batchedMesh;if(t){if(this.batchedMesh===null){this._onBatchedMeshDispose=()=>{this.batchedMesh.dispose(),this.batchedMesh.removeFromParent(),this.batchedMesh=null,t.removeEventListener("dispose",this._onBatchedMeshDispose)};const i=t.material.clone();i.onBeforeCompile=t.material.onBeforeCompile,this.batchedMesh=new Zue(t,i),this.tiles.group.add(this.batchedMesh)}}else this.batchedMesh!==null&&(this._onBatchedMeshDispose(),this._onBatchedMeshDispose=null)}setTileVisible(e,t){const i=this._fadeManager,r=i.isFading(e);if(i.isFadingOut(e)&&this._fadingOutCount--,t?e.__depthFromRenderedParent===1?((e[NU]||this.fadeRootTiles)&&this._fadeManager.fadeIn(e),e[NU]=!0):this._fadeManager.fadeIn(e):(this._fadingOutCount++,i.fadeOut(e)),this._quickFadeTiles.has(e)&&(this._fadeManager.completeFade(e),this._quickFadeTiles.delete(e)),r)return!0;const a=this._fadeManager.isFading(e);return!!(!t&&a)}dispose(){const e=this.tiles;this._fadeManager.completeAllFades(),this.batchedMesh!==null&&this._onBatchedMeshDispose(),e.removeEventListener("load-model",this._onLoadModel),e.removeEventListener("dispose-model",this._onDisposeModel),e.removeEventListener("add-camera",this._onAddCamera),e.removeEventListener("delete-camera",this._onDeleteCamera),e.removeEventListener("update-before",this._onUpdateBefore),e.removeEventListener("update-after",this._onUpdateAfter),e.removeEventListener("tile-visibility-change",this._onTileVisibilityChange),e.forEachLoadedModel((t,i)=>{this._fadeManager.deleteObject(i),t&&(t.visible=!0)})}forEachBatchIds(e,t){if(this.initBatchedMesh(),this.batchedMesh){const i=this.tiles.getPluginByName("BATCHED_TILES_PLUGIN"),r=i.getTileBatchIds(e);r&&r.forEach(a=>{t(a,this.batchedMesh,i)})}}}new Me;new D;new D;new jn;new Gz(new Sr);const ehe=new Ur(new Uint8Array([255,255,255,255]),1,1);ehe.needsUpdate=!0;new D;const zM=new WeakMap;class the extends wi{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const a=new jr(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,s=>{this.parse(s,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,mn,i).catch(i)}decodeDracoFile(e,t,i,r,a=Xn,s=()=>{}){const o={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:a};return this.decodeGeometry(e,o).then(t).catch(s)}decodeGeometry(e,t){const i=JSON.stringify(t);if(zM.has(e)){const l=zM.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const a=this.workerNextTaskID++,s=e.byteLength,o=this._getWorker(a,s).then(l=>(r=l,new Promise((u,d)=>{r._callbacks[a]={resolve:u,reject:d},r.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return o.catch(()=>!0).then(()=>{r&&a&&this._releaseTask(r,a)}),zM.set(e,{key:i,promise:o}),o}_createGeometry(e){const t=new Ct;e.index&&t.setIndex(new bt(e.index.array,1));for(let i=0;i{i.load(e,r,void 0,a)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const a=nhe.toString(),s=["/* draco decoder */",r,"","/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(` -`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtha._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const f=d.draco,p=new f.Decoder;try{const m=t(f,p,new Int8Array(l),u),v=m.attributes.map(x=>x.array.buffer);m.index&&v.push(m.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:m},v)}catch(m){console.error(m),self.postMessage({type:"error",id:o.id,error:m.message})}finally{f.destroy(p)}});break}};function t(s,o,l,u){const d=u.attributeIDs,f=u.attributeTypes;let p,m;const v=o.GetEncodedGeometryType(l);if(v===s.TRIANGULAR_MESH)p=new s.Mesh,m=o.DecodeArrayToMesh(l,l.byteLength,p);else if(v===s.POINT_CLOUD)p=new s.PointCloud,m=o.DecodeArrayToPointCloud(l,l.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const x={index:null,attributes:[]};for(const S in d){const _=self[f[S]];let T,E;if(u.useUniqueIDs)E=d[S],T=o.GetAttributeByUniqueId(p,E);else{if(E=o.GetAttributeId(p,s[d[S]]),E===-1)continue;T=o.GetAttribute(p,E)}const b=r(s,o,p,S,_,T);S==="color"&&(b.vertexColorSpace=u.vertexColorSpace),x.attributes.push(b)}return v===s.TRIANGULAR_MESH&&(x.index=i(s,o,p)),s.destroy(p),x}function i(s,o,l){const d=l.num_faces()*3,f=d*4,p=s._malloc(f);o.GetTrianglesUInt32Array(l,f,p);const m=new Uint32Array(s.HEAPF32.buffer,p,d).slice();return s._free(p),{array:m,itemSize:1}}function r(s,o,l,u,d,f){const p=l.num_points(),m=f.num_components(),v=a(s,d),x=m*d.BYTES_PER_ELEMENT,S=Math.ceil(x/4)*4,_=S/d.BYTES_PER_ELEMENT,T=p*x,E=p*S,b=s._malloc(T);o.GetAttributeDataArrayForAllPoints(l,f,v,T,b);const R=new d(s.HEAPF32.buffer,b,T/d.BYTES_PER_ELEMENT);let w;if(x===S)w=R.slice();else{w=new d(E/d.BYTES_PER_ELEMENT);let L=0;for(let U=0,N=R.length;U Altitude: ${a}, TruePosLength: ${u.length()}`),Or.position.copy(u);const f=pC(u).clone().invert();Or.quaternion.copy(f.multiply(o))}const On={w:!1,a:!1,s:!1,d:!1,q:!1,e:!1,Shift:!1,Space:!1};typeof window<"u"&&(window.addEventListener("keydown",n=>{const e=n.key.toLowerCase();On.hasOwnProperty(e)&&(On[e]=!0),n.key==="Shift"&&(On.Shift=!0),n.key===" "&&(On.Space=!0)}),window.addEventListener("keyup",n=>{const e=n.key.toLowerCase();On.hasOwnProperty(e)&&(On[e]=!1),n.key==="Shift"&&(On.Shift=!1),n.key===" "&&(On.Space=!1)}));const HF=new the;HF.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");function hhe(){const n="AIzaSyB1HccB6XdNjxbYcbbmMWRyxv4CTYfxXpM";return ot.jsxs(fue,{url:`https://tile.googleapis.com/v1/3dtiles/root.json?key=${n}`,children:[ot.jsx(g0,{plugin:Sue,args:{apiToken:n}}),ot.jsx(g0,{plugin:Xue,dracoLoader:HF}),ot.jsx(g0,{plugin:bue}),ot.jsx(g0,{plugin:Tue}),ot.jsx(g0,{plugin:$ue})]})}function dhe(){const{gl:n}=pn(),e=ie.useRef(),t=ie.useRef(),i=ie.useRef(new Date(ohe)),[r,a]=ie.useState(zU[1]);return ie.useEffect(()=>{n.toneMapping=As,n.toneMappingExposure=10},[n]),ie.useEffect(()=>{const s=setInterval(()=>{a(o=>{const l=zU.filter(d=>d.name!==o.name),u=l[Math.floor(Math.random()*l.length)];return console.log(`[Weather] Changing to: ${u.name}`),u})},ahe);return()=>clearInterval(s)},[]),_a((s,o)=>{const l=i.current,u=o*she*1e3;if(l.setTime(l.getTime()+u),t.current&&t.current.updateByDate(l),e.current){const d=l.getHours()+l.getMinutes()/60+l.getSeconds()/3600,f=lt.mapLinear(d,6,18,0,Math.PI),p=-Math.cos(f),m=Math.sin(f);d<6||d>18?(e.current.position.set(0,-1,0),e.current.intensity=10):(e.current.position.set(p,m,.2),e.current.intensity=lt.lerp(.5,3,m))}}),ot.jsxs(ot.Fragment,{children:[ot.jsx(Bz,{makeDefault:!0,near:1,far:1e7,fov:45}),ot.jsx(fhe,{}),ot.jsx("directionalLight",{ref:e,position:[0,1,0],intensity:3,castShadow:!0}),ot.jsxs(lle,{ref:t,children:[ot.jsx(hhe,{}),ot.jsxs(Vre,{multisampling:0,disableNormalPass:!1,children:[ot.jsx(mce,{disableDefaultLayers:!0,coverage:r.coverage,children:r.layers.map((s,o)=>ot.jsx(gce,{channel:s.channel,altitude:s.altitude,height:s.height,densityScale:s.densityScale,shapeAmount:.5},o))}),ot.jsx(ule,{sky:!0,sunLight:!0,skyLight:!0}),ot.jsx(Wre,{mode:ca.AGX})]})]})]})}function fhe(){return _a(n=>{if(!Or.position)return;const e=pC(Or.position);n.camera.position.copy(Or.position),n.camera.quaternion.copy(e).multiply(Or.quaternion)}),null}function phe(){const n=ie.useRef(null),e=ie.useRef(null),{camera:t}=pn(),i=ie.useRef({}),r=ie.useRef(null),a=By(Lp,ihe,u=>{u.register(d=>new Ine(d))}),[s,o,l]=By(Lp,[`${v1}fly.vrma`,`${v1}fly_stop.vrma`,`${v1}fly_idle.vrma`],u=>{u.register(d=>new gie(d))});return ie.useEffect(()=>{const u=a.userData.vrm;e.current=u,rd.removeUnnecessaryJoints(u.scene),u.humanoid.resetPose(),u.scene.rotation.y=Math.PI;const d=new b7(u.scene);n.current=d;const f=(S,_)=>{var T;if((T=S.userData.vrmAnimations)!=null&&T[0]){const E=uie(S.userData.vrmAnimations[0],u),b=d.clipAction(E);return b.name=_,b}return null},p=f(s,"fly"),m=f(o,"fly_stop"),v=f(l,"fly_idle");i.current={fly:p,fly_stop:m,fly_idle:v},m&&(m.setLoop($w),m.clampWhenFinished=!0),v?(v.play(),r.current="fly_idle"):p&&(p.play(),r.current="fly");const x=S=>{S.action===m&&i.current.fly_idle&&(m.fadeOut(.5),i.current.fly_idle.reset().fadeIn(.5).play(),r.current="fly_idle")};return d.addEventListener("finished",x),()=>{d.removeEventListener("finished",x)}},[a,s,o,l]),_a((u,d)=>{var v,x;(v=n.current)==null||v.update(d),(x=e.current)==null||x.update(d);const f=On.w||On.s||On.a||On.d,p=i.current,m=r.current;if(p.fly&&p.fly_stop&&p.fly_idle)if(f){if(m!=="fly"){const S=p[m];S&&S.fadeOut(.5),p.fly.reset().fadeIn(.5).play(),r.current="fly"}}else m==="fly"&&(p.fly.fadeOut(.5),p.fly_stop.reset().fadeIn(.5).play(),r.current="fly_stop");if(e.current){const S=e.current.scene,_=new D(0,0,0);if(On.w&&(_.z-=1),On.s&&(_.z+=1),On.a&&(_.x-=1),On.d&&(_.x+=1),_.lengthSq()>0){_.normalize();const T=t.quaternion.clone();_.applyQuaternion(T);const E=S.position.clone().sub(_),b=new Xt;b.position.copy(S.position),b.lookAt(E),S.quaternion.slerp(b.quaternion,10*d)}}}),ot.jsx("primitive",{object:a.scene})}function mhe(){const{camera:n}=pn();new D;const e=ie.useRef(0),t=10,i=2;return _a((r,a)=>{Or.quaternion.copy(n.quaternion);const s=pC(Or.position),o=On.w||On.s||On.a||On.d||On.q||On.e,l=Or.speed*(On.Shift?2:1)*a,u=new D;On.w&&(u.z-=1),On.s&&(u.z+=1),On.a&&(u.x-=1),On.d&&(u.x+=1);const d=Or.position.clone().normalize();On.e&&Or.position.addScaledVector(d,l),On.q&&Or.position.addScaledVector(d,-l),u.lengthSq()>0&&(u.normalize(),u.applyQuaternion(n.quaternion),u.applyQuaternion(s),Or.position.addScaledVector(u,l));const f=Or.position.length(),p=che(Or.position),m=p+10;r.clock.elapsedTime%1<.02&&console.log(`[CameraSync] Dist: ${f.toFixed(1)}, LocalR: ${p.toFixed(1)}, Alt: ${(f-p).toFixed(1)}`),fot.jsx("button",{onClick:()=>uhe(n),style:{padding:"10px 20px",background:"rgba(0, 0, 0, 0.6)",color:"white",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"8px",cursor:"pointer",fontSize:"14px",backdropFilter:"blur(4px)",transition:"background 0.2s"},onMouseOver:e=>e.currentTarget.style.background="rgba(0, 0, 0, 0.8)",onMouseOut:e=>e.currentTarget.style.background="rgba(0, 0, 0, 0.6)",children:n.name},n.name))})}function _he(){return ot.jsx(hz,{children:ot.jsx(dhe,{})})}function xhe(){const n={position:"absolute",top:0,left:0,width:"100%",height:"100%"};return ot.jsxs("div",{style:{position:"relative",width:"100vw",height:"100vh",background:"#000"},children:[ot.jsx(vhe,{}),ot.jsx("div",{style:{...n,zIndex:0},children:ot.jsx(_he,{})}),ot.jsx("div",{style:{...n,zIndex:1,pointerEvents:"none"},children:ot.jsx("div",{style:{width:"100%",height:"100%",pointerEvents:"auto"},children:ot.jsx(ghe,{})})})]})}zW.createRoot(document.getElementById("root")).render(ot.jsx(QA.StrictMode,{children:ot.jsx(xhe,{})})); +`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtha._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const f=d.draco,p=new f.Decoder;try{const m=t(f,p,new Int8Array(l),u),v=m.attributes.map(x=>x.array.buffer);m.index&&v.push(m.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:m},v)}catch(m){console.error(m),self.postMessage({type:"error",id:o.id,error:m.message})}finally{f.destroy(p)}});break}};function t(s,o,l,u){const d=u.attributeIDs,f=u.attributeTypes;let p,m;const v=o.GetEncodedGeometryType(l);if(v===s.TRIANGULAR_MESH)p=new s.Mesh,m=o.DecodeArrayToMesh(l,l.byteLength,p);else if(v===s.POINT_CLOUD)p=new s.PointCloud,m=o.DecodeArrayToPointCloud(l,l.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const x={index:null,attributes:[]};for(const S in d){const _=self[f[S]];let T,E;if(u.useUniqueIDs)E=d[S],T=o.GetAttributeByUniqueId(p,E);else{if(E=o.GetAttributeId(p,s[d[S]]),E===-1)continue;T=o.GetAttribute(p,E)}const b=r(s,o,p,S,_,T);S==="color"&&(b.vertexColorSpace=u.vertexColorSpace),x.attributes.push(b)}return v===s.TRIANGULAR_MESH&&(x.index=i(s,o,p)),s.destroy(p),x}function i(s,o,l){const d=l.num_faces()*3,f=d*4,p=s._malloc(f);o.GetTrianglesUInt32Array(l,f,p);const m=new Uint32Array(s.HEAPF32.buffer,p,d).slice();return s._free(p),{array:m,itemSize:1}}function r(s,o,l,u,d,f){const p=l.num_points(),m=f.num_components(),v=a(s,d),x=m*d.BYTES_PER_ELEMENT,S=Math.ceil(x/4)*4,_=S/d.BYTES_PER_ELEMENT,T=p*x,E=p*S,b=s._malloc(T);o.GetAttributeDataArrayForAllPoints(l,f,v,T,b);const R=new d(s.HEAPF32.buffer,b,T/d.BYTES_PER_ELEMENT);let w;if(x===S)w=R.slice();else{w=new d(E/d.BYTES_PER_ELEMENT);let L=0;for(let U=0,N=R.length;U Altitude: ${a}, TruePosLength: ${u.length()}`),Or.position.copy(u);const f=pC(u).clone().invert();Or.quaternion.copy(f.multiply(o))}const On={w:!1,a:!1,s:!1,d:!1,q:!1,e:!1,Shift:!1,Space:!1};typeof window<"u"&&(window.addEventListener("keydown",n=>{const e=n.key.toLowerCase();On.hasOwnProperty(e)&&(On[e]=!0),n.key==="Shift"&&(On.Shift=!0),n.key===" "&&(On.Space=!0)}),window.addEventListener("keyup",n=>{const e=n.key.toLowerCase();On.hasOwnProperty(e)&&(On[e]=!1),n.key==="Shift"&&(On.Shift=!1),n.key===" "&&(On.Space=!1)}));const HF=new the;HF.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");function hhe(){const n="AIzaSyB1HccB6XdNjxbYcbbmMWRyxv4CTYfxXpM";return ot.jsxs(fue,{url:`https://tile.googleapis.com/v1/3dtiles/root.json?key=${n}`,children:[ot.jsx(g0,{plugin:Sue,args:{apiToken:n}}),ot.jsx(g0,{plugin:Xue,dracoLoader:HF}),ot.jsx(g0,{plugin:bue}),ot.jsx(g0,{plugin:Tue}),ot.jsx(g0,{plugin:$ue})]})}function dhe(){const{gl:n}=pn(),e=ie.useRef(),t=ie.useRef(),i=ie.useRef(new Date(ohe)),[r,a]=ie.useState(zU[1]);return ie.useEffect(()=>{n.toneMapping=As,n.toneMappingExposure=10},[n]),ie.useEffect(()=>{const s=setInterval(()=>{a(o=>{const l=zU.filter(d=>d.name!==o.name),u=l[Math.floor(Math.random()*l.length)];return console.log(`[Weather] Changing to: ${u.name}`),u})},ahe);return()=>clearInterval(s)},[]),_a((s,o)=>{const l=i.current,u=o*she*1e3;if(l.setTime(l.getTime()+u),t.current&&t.current.updateByDate(l),e.current){const d=l.getHours()+l.getMinutes()/60+l.getSeconds()/3600,f=lt.mapLinear(d,6,18,0,Math.PI),p=-Math.cos(f),m=Math.sin(f);d<6||d>18?(e.current.position.set(0,-1,0),e.current.intensity=10):(e.current.position.set(p,m,.2),e.current.intensity=lt.lerp(.5,3,m))}}),ot.jsxs(ot.Fragment,{children:[ot.jsx(Bz,{makeDefault:!0,near:1,far:1e7,fov:45}),ot.jsx(fhe,{}),ot.jsx("directionalLight",{ref:e,position:[0,1,0],intensity:3,castShadow:!0}),ot.jsxs(lle,{ref:t,children:[ot.jsx(hhe,{}),ot.jsxs(Vre,{multisampling:0,disableNormalPass:!1,children:[ot.jsx(mce,{disableDefaultLayers:!0,coverage:r.coverage,children:r.layers.map((s,o)=>ot.jsx(gce,{channel:s.channel,altitude:s.altitude,height:s.height,densityScale:s.densityScale,shapeAmount:.5},o))}),ot.jsx(ule,{sky:!0}),ot.jsx(Wre,{mode:ca.AGX})]})]})]})}function fhe(){return _a(n=>{if(!Or.position)return;const e=pC(Or.position);n.camera.position.copy(Or.position),n.camera.quaternion.copy(e).multiply(Or.quaternion)}),null}function phe(){const n=ie.useRef(null),e=ie.useRef(null),{camera:t}=pn(),i=ie.useRef({}),r=ie.useRef(null),a=By(Lp,ihe,u=>{u.register(d=>new Ine(d))}),[s,o,l]=By(Lp,[`${v1}fly.vrma`,`${v1}fly_stop.vrma`,`${v1}fly_idle.vrma`],u=>{u.register(d=>new gie(d))});return ie.useEffect(()=>{const u=a.userData.vrm;e.current=u,rd.removeUnnecessaryJoints(u.scene),u.humanoid.resetPose(),u.scene.rotation.y=Math.PI;const d=new b7(u.scene);n.current=d;const f=(S,_)=>{var T;if((T=S.userData.vrmAnimations)!=null&&T[0]){const E=uie(S.userData.vrmAnimations[0],u),b=d.clipAction(E);return b.name=_,b}return null},p=f(s,"fly"),m=f(o,"fly_stop"),v=f(l,"fly_idle");i.current={fly:p,fly_stop:m,fly_idle:v},m&&(m.setLoop($w),m.clampWhenFinished=!0),v?(v.play(),r.current="fly_idle"):p&&(p.play(),r.current="fly");const x=S=>{S.action===m&&i.current.fly_idle&&(m.fadeOut(.5),i.current.fly_idle.reset().fadeIn(.5).play(),r.current="fly_idle")};return d.addEventListener("finished",x),()=>{d.removeEventListener("finished",x)}},[a,s,o,l]),_a((u,d)=>{var v,x;(v=n.current)==null||v.update(d),(x=e.current)==null||x.update(d);const f=On.w||On.s||On.a||On.d,p=i.current,m=r.current;if(p.fly&&p.fly_stop&&p.fly_idle)if(f){if(m!=="fly"){const S=p[m];S&&S.fadeOut(.5),p.fly.reset().fadeIn(.5).play(),r.current="fly"}}else m==="fly"&&(p.fly.fadeOut(.5),p.fly_stop.reset().fadeIn(.5).play(),r.current="fly_stop");if(e.current){const S=e.current.scene,_=new D(0,0,0);if(On.w&&(_.z-=1),On.s&&(_.z+=1),On.a&&(_.x-=1),On.d&&(_.x+=1),_.lengthSq()>0){_.normalize();const T=t.quaternion.clone();_.applyQuaternion(T);const E=S.position.clone().sub(_),b=new Xt;b.position.copy(S.position),b.lookAt(E),S.quaternion.slerp(b.quaternion,10*d)}}}),ot.jsx("primitive",{object:a.scene})}function mhe(){const{camera:n}=pn();new D;const e=ie.useRef(0),t=10,i=2;return _a((r,a)=>{Or.quaternion.copy(n.quaternion);const s=pC(Or.position),o=On.w||On.s||On.a||On.d||On.q||On.e,l=Or.speed*(On.Shift?2:1)*a,u=new D;On.w&&(u.z-=1),On.s&&(u.z+=1),On.a&&(u.x-=1),On.d&&(u.x+=1);const d=Or.position.clone().normalize();On.e&&Or.position.addScaledVector(d,l),On.q&&Or.position.addScaledVector(d,-l),u.lengthSq()>0&&(u.normalize(),u.applyQuaternion(n.quaternion),u.applyQuaternion(s),Or.position.addScaledVector(u,l));const f=Or.position.length(),p=che(Or.position),m=p+10;r.clock.elapsedTime%1<.02&&console.log(`[CameraSync] Dist: ${f.toFixed(1)}, LocalR: ${p.toFixed(1)}, Alt: ${(f-p).toFixed(1)}`),fot.jsx("button",{onClick:()=>uhe(n),style:{padding:"10px 20px",background:"rgba(0, 0, 0, 0.6)",color:"white",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"8px",cursor:"pointer",fontSize:"14px",backdropFilter:"blur(4px)",transition:"background 0.2s"},onMouseOver:e=>e.currentTarget.style.background="rgba(0, 0, 0, 0.8)",onMouseOut:e=>e.currentTarget.style.background="rgba(0, 0, 0, 0.6)",children:n.name},n.name))})}function _he(){return ot.jsx(hz,{children:ot.jsx(dhe,{})})}function xhe(){const n={position:"absolute",top:0,left:0,width:"100%",height:"100%"};return ot.jsxs("div",{style:{position:"relative",width:"100vw",height:"100vh",background:"#000"},children:[ot.jsx(vhe,{}),ot.jsx("div",{style:{...n,zIndex:0},children:ot.jsx(_he,{})}),ot.jsx("div",{style:{...n,zIndex:1,pointerEvents:"none"},children:ot.jsx("div",{style:{width:"100%",height:"100%",pointerEvents:"auto"},children:ot.jsx(ghe,{})})})]})}zW.createRoot(document.getElementById("root")).render(ot.jsx(QA.StrictMode,{children:ot.jsx(xhe,{})})); diff --git a/static/pkg/atmosphere/earth.glb b/static/pkg/atmosphere/earth.glb new file mode 100644 index 00000000..eb700c78 Binary files /dev/null and b/static/pkg/atmosphere/earth.glb differ diff --git a/static/pkg/atmosphere/index.html b/static/pkg/atmosphere/index.html index 1e42c214..9fdffd67 100644 --- a/static/pkg/atmosphere/index.html +++ b/static/pkg/atmosphere/index.html @@ -8,7 +8,7 @@ - +
diff --git a/static/pkg/atmosphere/iss.glb b/static/pkg/atmosphere/iss.glb new file mode 100644 index 00000000..ff970bb2 Binary files /dev/null and b/static/pkg/atmosphere/iss.glb differ