@rr0/ufoathome 0.86.0 → 0.86.1

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.
@@ -0,0 +1 @@
1
+ class I{static FORMATION_S=.3;static DIFFUSION_M_PER_S=.2;static TYPICAL_SHEAR_PER_S=.003;static INITIAL_DEPTH_M=150;static DEEPENING_M_PER_S=.1;static YOUNG_OPTICAL_DEPTH=.5;static DILUTION_EXPONENT=.75;static MIXING_S=1500;static INVISIBLE=.006;static MIN_LIFETIME_S=15;static LIFETIME_SPAN_S=120;static widthM(t,E,_=I.TYPICAL_SHEAR_PER_S){const s=Math.max(0,E),N=_*(I.INITIAL_DEPTH_M*s+I.DEEPENING_M_PER_S*s*s/2);return t+I.DIFFUSION_M_PER_S*s+N}static lifetimeS(t){const E=Math.min(1,Math.max(0,t));return I.MIN_LIFETIME_S+I.LIFETIME_SPAN_S*E*E}static opacity(t,E){if(t<I.FORMATION_S)return 0;let _;if(E.persistent){const N=(E.spanM/I.widthM(E.spanM,t,E.shearPerS))**I.DILUTION_EXPONENT;_=I.YOUNG_OPTICAL_DEPTH*N*Math.exp(-t/I.MIXING_S)}else{if(t>=E.lifetimeS)return 0;_=I.YOUNG_OPTICAL_DEPTH*(1-t/E.lifetimeS)**2}const s=1-Math.exp(-_);return s<I.INVISIBLE?0:s}}export{I as C};
@@ -0,0 +1 @@
1
+ import{G as T,k as A,q as N,M as w,r as G,s as O}from"./rr0-scene.mjs";import{C as S}from"./ContrailGrowth-CuAzwIoc.js";class f{static MAX_SEGMENTS=4e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static VERTICES_PER_SEGMENT=12;object;group=new T;trails=[];positions=new Float32Array(f.MAX_SEGMENTS*f.VERTICES_PER_SEGMENT*3);colors=new Float32Array(f.MAX_SEGMENTS*f.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new A;t.setAttribute("position",new N(this.positions,3)),t.setAttribute("color",new N(this.colors,4)),t.setDrawRange(0,0),this.object=new w(t,new G({vertexColors:!0,transparent:!0,depthWrite:!1,side:O})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,n){let h=0;this.segments=0;for(const i of this.trails){const a=this.samplesOf(i,t,s),e=n(i.id);for(let c=0;c+1<a.length;c++){const o=a[c],p=a[c+1];if(!o.forms||!p.forms)continue;if(this.segments>=f.MAX_SEGMENTS)break;const l=this.pushSegment(h,o,p,i.spanM,e,s);l>h&&this.segments++,h=l}}const M=this.object.geometry;M.setDrawRange(0,h);for(const[i,a]of[["position",3],["color",4]]){const e=M.getAttribute(i);e.clearUpdateRanges(),h>0&&e.addUpdateRange(0,h*a),e.needsUpdate=!0}}samplesOf(t,s,n){const h=s-S.FORMATION_S*1e3,M=[],i=(o,p,l,d,m,y)=>({x:p+o.driftEastMs*m+n.origin.x,y:d,z:-(l+o.driftNorthMs*m)+n.origin.z,age:m,forms:y,point:o});let a=-1;t.points.forEach((o,p)=>{o.tMs>h||(a=p,M.push(i(o,o.eastM,o.northM,o.upM,(s-o.tMs)/1e3,o.forms)))});const e=t.points[a],c=t.points[a+1];if(e&&c){const o=(h-e.tMs)/(c.tMs-e.tMs),p=(l,d)=>l+(d-l)*o;M.push(i(e,p(e.eastM,c.eastM),p(e.northM,c.northM),p(e.upM,c.upM),S.FORMATION_S,e.forms&&c.forms))}return M}pushSegment(t,s,n,h,M,i){const a={persistent:s.point.persistent,lifetimeS:s.point.lifetimeS,spanM:h,shearPerS:s.point.shearPerS},e=S.opacity(s.age,a),c=S.opacity(n.age,a);if(e<=0&&c<=0)return t;const o={x:n.x-s.x,y:n.y-s.y,z:n.z-s.z};if(Math.hypot(o.x,o.y,o.z)<1e-6)return t;const p={x:(s.x+n.x)/2-i.eye.x,y:(s.y+n.y)/2-i.eye.y,z:(s.z+n.z)/2-i.eye.z},l=this.normalise(this.cross(o,p)),d=(r,u)=>{const g=Math.hypot(r.x-i.eye.x,r.y-i.eye.y,r.z-i.eye.z),E=S.widthM(h,r.age,r.point.shearPerS),R=Math.max(E,f.MIN_PIXELS*i.pixelRad*g);return{half:R/2,alpha:u*(E/R)**f.UNRESOLVED_CONTRAST}},m=[{sample:s,...d(s,e)},{sample:n,...d(n,c)}],y=(r,u)=>{const g=t*3;this.positions[g]=r.sample.x+l.x*r.half*u,this.positions[g+1]=r.sample.y+l.y*r.half*u,this.positions[g+2]=r.sample.z+l.z*r.half*u;const E=t*4;this.colors[E]=M[0],this.colors[E+1]=M[1],this.colors[E+2]=M[2],this.colors[E+3]=u===0?r.alpha:0,t++},[x,z]=m;for(const[r,u]of[[-1,0],[1,0]])y(x,r),y(x,u),y(z,r),y(x,u),y(z,u),y(z,r);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{f as ContrailSystem};