@rr0/ufoathome 0.141.0 → 0.142.0
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.
- package/dist-embed-scene/ReferenceSystem-DOCydyPG.js +1 -0
- package/dist-embed-scene/rr0-scene.mjs +100 -100
- package/dist-embed-sighting/ReferenceSystem-DKmWxtY-.js +1 -0
- package/dist-embed-sighting/SightingMessages_es-DBRW6jG0.js +1 -0
- package/dist-embed-sighting/SightingMessages_fr-Dwkll3ZY.js +1 -0
- package/dist-embed-sighting/SightingMessages_it-CS1pKPSh.js +1 -0
- package/dist-embed-sighting/rr0-sighting.mjs +13 -13
- package/dist-embed-sighting-editor/GhostSearchView-BiyITIC7.js +1 -0
- package/dist-embed-sighting-editor/PictureFetch-X3UpM6JV.js +1 -0
- package/dist-embed-sighting-editor/ReferenceSystem-D30Dc7NR.js +1 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_es-BXrXCsmJ.js +12 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_fr-DtMIkYvz.js +12 -0
- package/dist-embed-sighting-editor/SightingEditorMessages_it-Cii6z1Lk.js +12 -0
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +248 -240
- package/package.json +1 -1
- package/dist-embed-scene/ReferenceSystem-BdF5Ptvm.js +0 -1
- package/dist-embed-sighting/ReferenceSystem-CEn7MuVP.js +0 -1
- package/dist-embed-sighting/SightingMessages_es-BL3yAPR5.js +0 -1
- package/dist-embed-sighting/SightingMessages_fr-DYXapaAN.js +0 -1
- package/dist-embed-sighting/SightingMessages_it-3b421_Dl.js +0 -1
- package/dist-embed-sighting-editor/GhostSearchView-wZJh23C7.js +0 -1
- package/dist-embed-sighting-editor/ReferenceSystem-8Nl1IFkX.js +0 -1
- package/dist-embed-sighting-editor/SightingEditorMessages_es-DtYML4wO.js +0 -12
- package/dist-embed-sighting-editor/SightingEditorMessages_fr-Bt-2qm0Z.js +0 -12
- package/dist-embed-sighting-editor/SightingEditorMessages_it-DK9cF3wW.js +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as f,O as w,Q as M,X as p,b as y,y as O,Y as b,Z as v,_ as E,$ as D}from"./rr0-scene.mjs";class c extends Error{constructor(t,s){super(`${t}: ${s.kind==="status"?s.status:s.kind}`),this.src=t,this.failure=s}}class u{static async blob(t){let s;try{s=await fetch(t)}catch{throw new c(t,await u.whyUnread(t))}if(!s.ok)throw new c(t,{kind:"status",status:s.status});const e=await s.blob();if(e.type&&!e.type.startsWith("image/"))throw new c(t,{kind:"notPicture"});return e}static failureOf(t){return t instanceof c?t.failure:{kind:"notPicture"}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const g=3,l=800,d=Math.PI/180;class h{constructor(t,s,e=h.fetchImage){this.scene=t,this.onImageLoaded=s,this.loadImage=e}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,s){if(!t.from||!s)return 1;const e=f(s.lat,s.lng,t.from.lat,t.from.lng),a=(Math.hypot(e.x,e.z)-h.PRESENT_WITHIN_M)/(h.GONE_BEYOND_M-h.PRESENT_WITHIN_M),o=Math.min(Math.max(a,0),1);return 1-o*o*(3-2*o)}set(t,s=this.views,e){this.references=t,this.observerAt=e,this.views=s;const i=new Set(t.map(a=>a.id));for(const[a,o]of this.meshes)i.has(a)||(this.dispose(o),this.meshes.delete(a),this.signatures.delete(a));for(const[a,o]of this.images){const n=t.find(m=>m.id===a);if(n&&n.src===o.texture.userData.src)continue;o.texture.dispose(),this.images.delete(a);const r=this.meshes.get(a);r&&(this.dispose(r),this.meshes.delete(a),this.signatures.delete(a))}for(const a of t){const o=this.images.get(a.id);if(!o){this.load(a);continue}this.build(a,o)}}setShown(t){this.shown=t;for(const s of this.meshes.values())s.visible=t&&this.opacityOf(s.userData.id)>0}setView(t,s){this.views.set(t,s);const e=this.meshes.get(t);e&&this.applyOpacity(e,t)}layer=g;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){for(const s of this.meshes.values())s.visible&&(s.position.copy(t.position),s.updateMatrixWorld())}get furthestM(){return this.meshes.size>0?l:0}directionOfPixel(t,s,e,i){const a=this.images.get(t.id),o=a?a.width/a.height:1,n=Math.tan(t.registration.fovDeg/2*d),r=n*o;return i.set((s*2-1)*r,(1-e*2)*n,-1).normalize(),i.applyQuaternion(h.orientation(t))}aspectOf(t){const s=this.images.get(t);return s?s.width/s.height:void 0}failureOf(t){return this.failed.get(t)}load(t){const s=t.src;if(this.loading.has(t.id)||this.failed.has(s))return;const e=this.loadImage(s).then(i=>{this.loading.delete(t.id);const a=this.references.find(o=>o.id===t.id);if(!a||a.src!==s){i.texture.dispose();return}i.texture.userData.src=s,this.images.set(t.id,i),this.build(a,i),this.onImageLoaded()},i=>{this.loading.delete(t.id),this.failed.set(s,u.failureOf(i)),this.onImageLoaded()});this.loading.set(t.id,e)}static async fetchImage(t){const s=await u.blob(t),e=await createImageBitmap(s,{imageOrientation:"flipY"}).catch(()=>{throw new c(t,{kind:"notPicture"})}),i=new w(e);return i.flipY=!1,i.colorSpace=M,i.minFilter=p,i.magFilter=p,i.generateMipmaps=!1,i.needsUpdate=!0,{texture:i,width:e.width,height:e.height}}build(t,s){const e=h.signatureOf(t,s);let i=this.meshes.get(t.id);if(i&&this.signatures.get(t.id)===e){this.applyOpacity(i,t.id);return}i&&(this.dispose(i),this.meshes.delete(t.id)),i=new y(h.geometryOf(t,s),new O({map:s.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(i.material.side=b),i.frustumCulled=!1,i.layers.set(g),i.userData.id=t.id,i.quaternion.copy(h.orientation(t)),this.scene.add(i),this.meshes.set(t.id,i),this.signatures.set(t.id,e),this.applyOpacity(i,t.id)}static geometryOf(t,s){if(t.kind==="panorama"){const o=new v(l,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const e=2*l*Math.tan(t.registration.fovDeg/2*d),i=e*(s.width/Math.max(s.height,1)),a=new E(i,e);return a.translate(0,0,-l),a}static orientation(t){const{headingDeg:s,pitchDeg:e,rollDeg:i}=t.registration,a=new D;return a.rotation.set(e*d,-s*d,-(i??0)*d,"YXZ"),a.quaternion}opacityOf(t){const s=this.references.find(a=>a.id===t),e=this.views.get(t),i=s?h.presenceAt(s,this.observerAt):1;return(e?.opacity??s?.opacity??0)*i}applyOpacity(t,s){const e=this.opacityOf(s);t.material.opacity=e,t.visible=this.shown&&e>0}static signatureOf(t,s){const{headingDeg:e,pitchDeg:i,rollDeg:a,fovDeg:o}=t.registration;return[t.kind,t.src,s.width,s.height,e,i,a??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())t.texture.dispose();this.images.clear()}}export{g as REFERENCE_LAYER,h as ReferenceSystem};
|