ocearo-ui 2.1.2 → 2.1.4
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/404.html +1 -1
- package/CHANGELOG.md +364 -0
- package/README.fr.md +28 -31
- package/README.md +28 -31
- package/__next.__PAGE__.txt +3 -3
- package/__next._full.txt +3 -3
- package/__next._tree.txt +2 -2
- package/_next/static/chunks/01ij-cuy61l35.js +1 -0
- package/_next/static/chunks/047e3x_ahxnrl.js +1 -0
- package/_next/static/chunks/0ath9h2eo-m4-.js +1 -0
- package/_next/static/chunks/0bxzs0khjn1uj.js +1 -0
- package/_next/static/chunks/0ejjon45nq_-h.js +9 -0
- package/_next/static/chunks/{1quvj-861o57h.js → 0kdc_niwgmx_8.js} +1 -1
- package/_next/static/chunks/{1bvrvkcwf3ge-.js → 0ngl63fz0a-bo.js} +1 -1
- package/_next/static/chunks/0ucob1nu_x8bl.js +1 -0
- package/_next/static/chunks/0wi5jop1ihbm6.js +2 -0
- package/_next/static/chunks/18e6nw0w7akkb.js +180 -0
- package/_next/static/chunks/18vlmqe7txbmt.js +1 -0
- package/_next/static/chunks/{3utjjgdhnlx86.js → 192c42s2wc7qe.js} +1 -1
- package/_next/static/chunks/1_twx50ejqan5.js +1 -0
- package/_next/static/chunks/1na56snuhu-pc.js +346 -0
- package/_next/static/chunks/1vchkqgn-xw-o.js +1 -0
- package/_next/static/chunks/20p1hr--2grl8.js +9 -0
- package/_next/static/chunks/2393lwi8kee3m.js +48 -0
- package/_next/static/chunks/25v2cwta2fy-7.js +393 -0
- package/_next/static/chunks/28wfa6j-9g_qc.js +1 -0
- package/_next/static/chunks/290k3k__vbum2.js +121 -0
- package/_next/static/chunks/2cecf_xnd_9em.js +1 -0
- package/_next/static/chunks/2die6btm3_mhq.js +1 -0
- package/_next/static/chunks/2hm43avzk8_jb.js +503 -0
- package/_next/static/chunks/2ijx7rln4jshb.css +3 -0
- package/_next/static/chunks/2q_bl16zedyyo.js +503 -0
- package/_next/static/chunks/2xntuu6mzh41s.js +1 -0
- package/_next/static/chunks/30p1dpgmonstj.js +1 -0
- package/_next/static/chunks/31p7nz0hfuym7.js +1 -0
- package/_next/static/chunks/{1e-w_-usen7fy.js → 34nhy77liurum.js} +2 -2
- package/_next/static/chunks/37g-wmrgbgd6h.js +739 -0
- package/_next/static/chunks/{18_i6mf6hb_c7.js → 395ffa6t18601.js} +1 -1
- package/_next/static/chunks/3bai186_bv3i_.js +1 -0
- package/_next/static/chunks/3h_m2s30sr9mt.js +430 -0
- package/_next/static/chunks/3j453-2u58qbv.js +1 -0
- package/_next/static/chunks/3k-r-4veivdjr.js +1 -0
- package/_next/static/chunks/3yz0mxxv4vrfg.js +1 -0
- package/_not-found/__next._full.txt +2 -2
- package/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/_not-found/__next._tree.txt +2 -2
- package/_not-found.html +1 -1
- package/_not-found.txt +2 -2
- package/boats/boats.json +11 -19
- package/boats/windsurf/assets/license.txt +6 -8
- package/boats/windsurf/assets/rider.glb +0 -0
- package/boats/wingfoil/assets/license.txt +9 -0
- package/boats/wingfoil/assets/rider.glb +0 -0
- package/guide/bathymetry.jpg +0 -0
- package/guide/weather.jpg +0 -0
- package/index.html +1 -1
- package/index.txt +3 -3
- package/package.json +27 -5
- package/settings/__next._full.txt +3 -3
- package/settings/__next._tree.txt +2 -2
- package/settings/__next.settings.__PAGE__.txt +3 -3
- package/settings.html +1 -1
- package/settings.txt +3 -3
- package/_next/static/chunks/0-19-ljntm5ig.js +0 -1
- package/_next/static/chunks/0-g-ujyrfgutp.js +0 -2
- package/_next/static/chunks/0-jqvc-r0kh0c.js +0 -1
- package/_next/static/chunks/05do10p9ldt1p.js +0 -409
- package/_next/static/chunks/0c91q-13wh8hk.js +0 -1
- package/_next/static/chunks/0fv1wwxeyagln.js +0 -446
- package/_next/static/chunks/0jucaltuccn03.js +0 -1
- package/_next/static/chunks/0m7wbuocx-b4_.js +0 -9
- package/_next/static/chunks/0o7hu-sypv2u9.js +0 -1
- package/_next/static/chunks/0ujzg6ofy2r73.js +0 -1
- package/_next/static/chunks/162bfkgcudvew.js +0 -9
- package/_next/static/chunks/1bo0ke8gjc1c2.js +0 -1
- package/_next/static/chunks/1do-2zwq3ws0f.js +0 -346
- package/_next/static/chunks/1ho2ekxa9io1_.js +0 -1
- package/_next/static/chunks/1m3-nchdgcxy1.css +0 -3
- package/_next/static/chunks/271ys-u920uqd.js +0 -564
- package/_next/static/chunks/2_iau6x7s0vil.js +0 -1131
- package/_next/static/chunks/2ab6q6u6uo_bf.js +0 -1
- package/_next/static/chunks/2pt-apz8_pa4j.js +0 -1
- package/_next/static/chunks/2rnpgrmuyhpkd.js +0 -119
- package/_next/static/chunks/2w71oj1brox5z.js +0 -1
- package/_next/static/chunks/3e5jmzthktu9w.js +0 -1
- package/_next/static/chunks/3r8nellt-dsed.js +0 -1
- package/_next/static/chunks/3wwn1rti8oc_r.js +0 -1
- package/_next/static/chunks/41odv061mfm6t.js +0 -1
- package/boats/optimist/Scene.jsx +0 -28
- package/boats/optimist/assets/license.txt +0 -11
- package/boats/optimist/assets/scene-transformed.glb +0 -0
- package/boats/sailboat/Scene.jsx +0 -21
- package/boats/sailboat/assets/license.txt +0 -10
- package/boats/sailboat/assets/scene-transformed.glb +0 -0
- package/boats/windsurf/Scene.jsx +0 -22
- package/boats/windsurf/assets/scene-transformed.glb +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_buildManifest.js +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78461,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(67561);let a=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],n=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,i.useOcearoContext)(),o=(0,r.useSignalKPaths)(a),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),c=o["navigation.position"],d=Number.isFinite(c?.latitude)&&Number.isFinite(c?.longitude);return{heading:l?s:0,offset:(0,t.useMemo)(()=>{if(!d)return{x:0,y:0};let t={lat:c.latitude,lon:c.longitude};return e(t,(n||(n=t),n))},[c,d,e]),hasFix:d,hasHeading:l}},"getSessionOrigin",0,()=>n])},30997,e=>{"use strict";var t=e.i(71645);let r=new Set,i=null,a=()=>{let e=[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()),t=[];r.forEach(r=>{let i=r.current;if(!i)return;let a=i.getBoundingClientRect(),n=e.some(e=>a.left<e.right&&a.right>e.left&&a.top<e.bottom&&a.bottom>e.top)?"hidden":"visible";i.style.visibility!==n&&t.push([i,n])}),t.forEach(([e,t])=>{e.style.visibility=t})};e.s(["default",0,e=>{(0,t.useEffect)(()=>(r.add(e),i||(i=setInterval(a,250)),a(),()=>{r.delete(e),r.size||(clearInterval(i),i=null)}),[e])}])},93116,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(95393),a=e.i(90072);let n=`
|
|
2
|
+
attribute vec3 aBase;
|
|
3
|
+
attribute vec2 aDir;
|
|
4
|
+
attribute vec3 aColor;
|
|
5
|
+
attribute vec2 aLenSpeed;
|
|
6
|
+
attribute float aSeed;
|
|
7
|
+
uniform vec3 uCam;
|
|
8
|
+
uniform float uTime;
|
|
9
|
+
uniform float uWidth;
|
|
10
|
+
uniform float uTravel;
|
|
11
|
+
uniform float uPace;
|
|
12
|
+
uniform float uFadeNear;
|
|
13
|
+
uniform float uStill;
|
|
14
|
+
uniform float uScreen;
|
|
15
|
+
varying vec3 vColor;
|
|
16
|
+
varying float vAlpha;
|
|
17
|
+
void main() {
|
|
18
|
+
vec3 d = normalize(vec3(aDir, 0.0));
|
|
19
|
+
// Still arrows stay put at full strength (a chart plotter's current arrows)
|
|
20
|
+
float phase = uStill > 0.5 ? 0.5 : fract(uTime * aLenSpeed.y * uPace / max(uTravel, 1e-3) + aSeed);
|
|
21
|
+
vec3 base = aBase + d * (phase - 0.5) * uTravel;
|
|
22
|
+
// Turn the arrow about its axis towards the camera
|
|
23
|
+
vec3 toCam = normalize(uCam - base);
|
|
24
|
+
vec3 side = cross(toCam, d);
|
|
25
|
+
side = length(side) < 1e-3 ? vec3(-d.y, d.x, 0.0) : normalize(side);
|
|
26
|
+
// Screen-sized: lengths and width are shares of the distance to the
|
|
27
|
+
// camera, so a far arrow reads as well as a near one
|
|
28
|
+
float k = uScreen > 0.0 ? length(uCam - aBase) * uScreen : 1.0;
|
|
29
|
+
vec3 p = base + side * position.x * uWidth * k + d * position.y * aLenSpeed.x * k;
|
|
30
|
+
vColor = aColor;
|
|
31
|
+
// Faded close to the camera, where an arrow would fill the view
|
|
32
|
+
vAlpha = (uStill > 0.5 ? 1.0 : pow(sin(3.14159 * phase), 0.6)) * (uFadeNear > 0.0 ? smoothstep(uFadeNear * 0.5, uFadeNear, length(uCam - base)) : 1.0);
|
|
33
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(p, 1.0);
|
|
34
|
+
}
|
|
35
|
+
`,o=`
|
|
36
|
+
uniform float uOpacity;
|
|
37
|
+
varying vec3 vColor;
|
|
38
|
+
varying float vAlpha;
|
|
39
|
+
void main() {
|
|
40
|
+
gl_FragColor = vec4(vColor, vAlpha * uOpacity);
|
|
41
|
+
#include <colorspace_fragment>
|
|
42
|
+
}
|
|
43
|
+
`;e.s(["default",0,({items:e,width:s,travel:l=0,pace:c=0,opacity:d=.9,fadeNear:u=0,still:f=!1,screen:h=0,renderOrder:p=3})=>{let{geometry:m,material:v}=(0,r.useMemo)(()=>{let e,t=((e=new a.Shape).moveTo(-.16,-.5),e.lineTo(.16,-.5),e.lineTo(.16,.08),e.lineTo(.5,.08),e.lineTo(0,.5),e.lineTo(-.5,.08),e.lineTo(-.16,.08),e.closePath(),new a.ShapeGeometry(e)),r=new a.InstancedBufferGeometry;r.index=t.index,r.setAttribute("position",t.attributes.position),r.setAttribute("aBase",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aDir",new a.InstancedBufferAttribute(new Float32Array(800),2)),r.setAttribute("aColor",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aLenSpeed",new a.InstancedBufferAttribute(new Float32Array(800),2));let i=new Float32Array(400);for(let e=0;e<400;e++)i[e]=.618034*e%1;return r.setAttribute("aSeed",new a.InstancedBufferAttribute(i,1)),r.instanceCount=0,{geometry:r,material:new a.ShaderMaterial({uniforms:{uCam:{value:new a.Vector3},uTime:{value:0},uWidth:{value:1},uTravel:{value:1},uPace:{value:1},uOpacity:{value:d},uFadeNear:{value:0},uStill:{value:0},uScreen:{value:0}},vertexShader:n,fragmentShader:o,transparent:!0,depthWrite:!1,side:a.DoubleSide})}},[]);(0,r.useEffect)(()=>()=>{m.dispose(),v.dispose()},[m,v]),(0,r.useEffect)(()=>{let t=Math.min(e.length,400),r=m.attributes;for(let i=0;i<t;i++){let t=e[i];r.aBase.array.set([t.x,t.y,t.z],3*i),r.aDir.array.set([t.u,t.v],2*i),r.aColor.array.set(t.color,3*i),r.aLenSpeed.array.set([t.len,t.speed],2*i)}["aBase","aDir","aColor","aLenSpeed"].forEach(e=>{r[e].needsUpdate=!0}),m.instanceCount=t},[m,e]),(0,r.useEffect)(()=>{let e=v.uniforms;e.uWidth.value=s,e.uTravel.value=l,e.uPace.value=c,e.uOpacity.value=d,e.uFadeNear.value=u,e.uStill.value=+!!f,e.uScreen.value=h},[v,s,l,c,d,u,f,h]);let y=(0,r.useRef)(),g=(0,r.useMemo)(()=>new a.Vector3,[]);return(0,i.useFrame)(({camera:e,clock:t})=>{y.current&&(y.current.updateWorldMatrix(!0,!1),v.uniforms.uCam.value.copy(y.current.worldToLocal(g.copy(e.position))),v.uniforms.uTime.value=t.elapsedTime)}),(0,t.jsx)("mesh",{ref:y,geometry:m,material:v,frustumCulled:!1,renderOrder:p})}])},78311,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(60099);e.i(85269);var a=e.i(22831),n=e.i(93116),o=e.i(30997);let s=[.86,.22,.2],l=[.16,.48,.86],c=({children:e})=>{let i=(0,r.useRef)(null);return(0,o.default)(i),(0,t.jsx)("div",{ref:i,style:{transform:"translateY(-1.1rem)"},children:e})};e.s(["default",0,({items:e,width:o,screen:d=0,fadeNear:u=0,format:f=e=>e.toFixed(1),slackLabel:h="slack",maxLabels:p=12,renderOrder:m=3})=>{let{t:v}=(0,a.useTranslation)(),{borders:y,fills:g}=(0,r.useMemo)(()=>{let t=e.filter(e=>e.speed>=.051444457477040344);return{borders:t.map(e=>({...e,len:e.len+.5*o,color:e.trend>.05?s:e.trend<-.05?l:[.06,.09,.12]})),fills:t}},[e,o]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.default,{items:y,width:1.35*o,screen:d,still:!0,fadeNear:u,opacity:.95,renderOrder:m}),(0,t.jsx)(n.default,{items:g,width:o,screen:d,still:!0,fadeNear:u,opacity:.95,renderOrder:m+1}),e.slice(0,p).map(e=>{let r=e.speed<.051444457477040344;return(0,t.jsx)(i.Html,{position:[e.x,e.y,e.z],center:!0,zIndexRange:[4,0],style:{pointerEvents:"none"},children:(0,t.jsx)(c,{children:r?(0,t.jsx)("div",{className:"rounded-md border-2 border-oBlue bg-hud-bg/80 px-1.5 text-caption font-semibold uppercase tracking-wide text-hud-main whitespace-nowrap",children:v(`meteo.${h}`)}):(0,t.jsx)("div",{className:"rounded px-1 text-caption font-bold tabular-nums leading-tight whitespace-nowrap",style:{color:"#fff",background:"rgba(10, 16, 22, 0.72)"},children:f(1.943844*e.speed)})})},e.key)})]})}])},54983,e=>{"use strict";var t=e.i(90072);let r={thermal:.28,magma:.3,dense:.15,deep:0,haline:.1,turbo:.08},i=e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)],a=Object.fromEntries(Object.entries({speed:["#fffdcd","#f4eaab","#e9d889","#dbc866","#c9ba45","#b2af28","#98a512","#7c9c06","#5f920c","#448818","#287c23","#126e2a","#0b602d","#11512c","#174127","#19321e","#172313"],thermal:["#042333","#082e54","#19337c","#39339e","#563b9c","#6d4694","#83508f","#995889","#b15f82","#c76676","#de7065","#ef7e52","#f99242","#fcaa3c","#f9c441","#f3df4c","#e8fa5b"],haline:["#2a186c","#2e1d93","#2034a2","#0f4a98","#0f5b90","#1c6a8c","#297789","#338588","#3c9387","#44a184","#4faf7e","#5fbe75","#78cb68","#9bd55c","#c1dd64","#e1e57c","#fdef9a"],deep:["#fdfecc","#ddf2ba","#bbe6ac","#98daa4","#78cea3","#62bfa4","#55aea3","#4e9ea1","#488e9e","#437f9a","#3f6f97","#3e5f93","#404d8c","#413e76","#3b325c","#322643","#281a2c"],ice:["#040613","#13132a","#212041","#2e2c5a","#383975","#3e478f","#3f57a3","#3e69b0","#427bb7","#4b8bbd","#579cc3","#67adc9","#79bed0","#92ced7","#afdde1","#cdecef","#eafdfd"],dense:["#e6f1f1","#cbe4e8","#b1d6e3","#9ac8e2","#86b9e3","#79a9e4","#7397e4","#7584df","#7871d5","#7960c7","#784eb3","#753d9d","#6f2e85","#66216c","#5a1851","#491238","#360e24"],magma:["#000004","#0a0822","#1d1147","#36106b","#51127c","#6a1c81","#832681","#9c2e7f","#b73779","#cf4070","#e55064","#f4695c","#fb8761","#fea571","#fec287","#fde0a1","#fcfdbf"],viridis:["#440154","#48186a","#472d7b","#424086","#3b528b","#33638d","#2c728e","#26828e","#21918c","#1f9f88","#27ad81","#3dbc74","#5cc863","#81d34d","#aadc32","#d5e21a","#fde725"],turbo:["#30123b","#4040a2","#466be3","#4294ff","#28bceb","#18ddc2","#32f298","#6dfe62","#a4fc3c","#cbed34","#ecd13a","#fdae35","#fb8122","#ec530f","#d23105","#ac1701","#7a0403"]}).map(([e,t])=>[e,t.map(i)])),n=(e,t)=>{let r=a[e]||a.speed,i=Math.min(1,Math.max(0,Number.isFinite(t)?t:0))*(r.length-1),n=Math.min(r.length-2,Math.floor(i)),o=i-n;return r[n].map((e,t)=>e+(r[n+1][t]-e)*o)};e.s(["colorAt",0,n,"colorMapTexture",0,e=>{let i=new Uint8Array(1024),a=r[e]||0;for(let t=0;t<256;t++){let[r,o,s]=n(e,a+(1-a)*t/255);i.set([Math.round(r),Math.round(o),Math.round(s),255],4*t)}let o=new t.DataTexture(i,256,1,t.RGBAFormat);return o.magFilter=t.LinearFilter,o.minFilter=t.LinearFilter,o.colorSpace=t.SRGBColorSpace,o.needsUpdate=!0,o},"cssGradient",0,e=>{let t=r[e]||0,i=Array.from({length:9},(r,i)=>{let[a,o,s]=n(e,t+(1-t)*i/8);return`rgb(${Math.round(a)},${Math.round(o)},${Math.round(s)})`});return`linear-gradient(to right, ${i.join(", ")})`}])},33227,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=.5/1.943844,a=null,n=new Set,o=(e,t,r,i)=>({lat:e+(i/8*2-1)*12e3/6371e3*180/Math.PI,lon:t+(r/8*2-1)*12e3/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),s=(e,t)=>{let r=[],i=[];for(let a=0;a<9;a++)for(let n=0;n<9;n++){let s=o(e,t,n,a);r.push(s.lat.toFixed(4)),i.push(s.lon.toFixed(4))}return`https://marine-api.open-meteo.com/v1/marine?latitude=${r.join(",")}&longitude=${i.join(",")}&hourly=ocean_current_velocity,ocean_current_direction&forecast_hours=48&timezone=GMT`},l=async(e,i)=>{let a=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===a&&Date.now()-r.at<18e5)return r.field;let n=await (0,t.cachedFetch)(s(e,i),{kind:"forecast"});if(!n.ok)throw Error(`Open-Meteo marine ${n.status}`);let o=await n.json(),l=Array.isArray(o)?o:[o],c=l[0]?.hourly?.time||[],d=c.length,u=[],f=[];for(let e=0;e<d;e++){let t=new Float32Array(81),r=new Float32Array(81);l.forEach((i,a)=>{let n=(i.hourly.ocean_current_velocity[e]??0)/3.6,o=(i.hourly.ocean_current_direction[e]??0)*Math.PI/180;t[a]=n*Math.sin(o),r[a]=n*Math.cos(o)}),u.push(t),f.push(r)}let h=0;u.forEach((e,t)=>e.forEach((e,r)=>{h=Math.max(h,Math.hypot(e,f[t][r]))}));let p={origin:{lat:e,lon:i},start:Date.parse(`${c[0]}Z`),hours:d,grid:9,half:12e3,u,v:f,max:h,source:"open-meteo"};return r={key:a,at:Date.now(),field:p},p};e.s(["currentFieldUrl",0,s,"fetchCurrentField",0,l,"getCurrentScale",0,()=>a,"setCurrentScale",0,e=>{let t=1.943844*Math.max(i,e?.max||0);return a=e?Math.ceil(4*t)/4/1.943844:null,n.forEach(e=>e(a)),a},"subscribeCurrentScale",0,e=>(n.add(e),()=>n.delete(e)),"uniformCurrent",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(r*Math.sin(i)),n=new Float32Array(81).fill(r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,grid:9,half:12e3,u:[a],v:[n],max:r,source:"boat"}}])},69435,e=>{"use strict";var t=e.i(71645),r=e.i(90072),i=e.i(3666);let a=40,n=`
|
|
44
|
+
float hash13(vec3 p) {
|
|
45
|
+
p = fract(p * 0.1031);
|
|
46
|
+
p += dot(p, p.zyx + 31.32);
|
|
47
|
+
return fract((p.x + p.y) * p.z);
|
|
48
|
+
}
|
|
49
|
+
float vnoise(vec3 p) {
|
|
50
|
+
vec3 i = floor(p);
|
|
51
|
+
vec3 f = fract(p);
|
|
52
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
53
|
+
return mix(mix(mix(hash13(i), hash13(i + vec3(1, 0, 0)), f.x),
|
|
54
|
+
mix(hash13(i + vec3(0, 1, 0)), hash13(i + vec3(1, 1, 0)), f.x), f.y),
|
|
55
|
+
mix(mix(hash13(i + vec3(0, 0, 1)), hash13(i + vec3(1, 0, 1)), f.x),
|
|
56
|
+
mix(hash13(i + vec3(0, 1, 1)), hash13(i + vec3(1, 1, 1)), f.x), f.y), f.z);
|
|
57
|
+
}
|
|
58
|
+
float fbm(vec3 p) {
|
|
59
|
+
return 0.6 * vnoise(p) + 0.3 * vnoise(p * 2.03 + 17.0) + 0.1 * vnoise(p * 4.1 + 41.0);
|
|
60
|
+
}
|
|
61
|
+
`,o=`
|
|
62
|
+
uniform sampler2D uField;
|
|
63
|
+
uniform float uFieldHalf;
|
|
64
|
+
uniform float uFieldRange;
|
|
65
|
+
vec2 flowAt(vec2 g) {
|
|
66
|
+
vec2 t = g / (2.0 * uFieldHalf) + 0.5;
|
|
67
|
+
return (texture2D(uField, t).rg - 0.5) * 2.0 * uFieldRange;
|
|
68
|
+
}
|
|
69
|
+
// 1 inside the field, fading to 0 over its outer tenth
|
|
70
|
+
float fieldMask(vec2 g) {
|
|
71
|
+
vec2 a = abs(g) / uFieldHalf;
|
|
72
|
+
return 1.0 - smoothstep(0.85, 1.0, max(a.x, a.y));
|
|
73
|
+
}
|
|
74
|
+
`;e.s(["FIELD_GLSL",0,o,"NOISE_GLSL",0,n,"useFieldTexture",0,(e,n,o=a)=>{let s=(0,t.useMemo)(()=>{let e=new r.DataTexture(new Uint8Array(16384),64,64,r.RGBAFormat);return e.magFilter=r.LinearFilter,e.minFilter=r.LinearFilter,e.wrapS=r.ClampToEdgeWrapping,e.wrapT=r.ClampToEdgeWrapping,e},[]);return(0,t.useEffect)(()=>{if(!e)return;let t=s.image.data,r=e.half??i.HALF_EXTENT_M;for(let a=0;a<64;a++)for(let s=0;s<64;s++){let l=(0,i.sampleWind)(e,(s/63*2-1)*r,(a/63*2-1)*r,n),c=(64*a+s)*4;t[c]=Math.round(255*Math.min(1,Math.max(0,.5+l.u/(2*o)))),t[c+1]=Math.round(255*Math.min(1,Math.max(0,.5+l.v/(2*o)))),t[c+2]=0,t[c+3]=255}s.needsUpdate=!0},[s,e,n,o]),(0,t.useEffect)(()=>()=>s.dispose(),[s]),s}])},88608,e=>{"use strict";let t=0,r=new Set,i={},a=new Set;e.s(["getForecastHour",0,()=>t,"getSeries",0,()=>i,"setForecastHour",0,e=>{t=Math.max(0,e),r.forEach(e=>e(t))},"setSeries",0,(e,t)=>{i={...i,[e]:t},a.forEach(e=>e(i))},"subscribeForecast",0,e=>(r.add(e),()=>r.delete(e)),"subscribeSeries",0,e=>(a.add(e),()=>a.delete(e))])},18032,e=>{"use strict";var t=e.i(90072);e.s(["markerLattice",0,({cx:e,cy:t,radius:r,step:i,near:a,originE:n=0,originN:o=0,max:s=60})=>{let l=[],c=Math.ceil((n-r)/i),d=Math.floor((n+r)/i),u=Math.ceil((o-r)/i),f=Math.floor((o+r)/i);for(let s=c;s<=d;s++)for(let c=u;c<=f;c++){let d=s*i,u=c*i;if(Math.hypot(d-n,u-o)>r)continue;let f=Math.hypot(d-e,u-t),h=f<=a?0:Math.ceil(Math.log2(f/a)),p=2**h;s%p==0&&c%p==0&&l.push({e:d,n:u,d:f})}return l.sort((e,t)=>e.d-t.d).slice(0,s)},"onScreenTest",0,(e,r,i,a=.9,n=60)=>{let o=new t.Vector3;e.updateWorldMatrix(!0,!1);let s=i.getBoundingClientRect(),l="u"<typeof document?[]:[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);return(t,i,c)=>{if(o.set(t,i,c),e.localToWorld(o).project(r),o.z>=1||Math.abs(o.x)>a||Math.abs(o.y)>a)return!1;let d=s.left+(o.x+1)/2*s.width,u=s.top+(1-o.y)/2*s.height;return!l.some(e=>d>e.left-n&&d<e.right+n&&u>e.top-n&&u<e.bottom+n)}},"sameMarkers",0,(e,t)=>e.length===t.length&&e.every((e,r)=>{let i=t[r];return e.key===i.key&&.005>Math.abs(e.speed-i.speed)&&Math.sign(Math.round(20*e.trend))===Math.sign(Math.round(20*i.trend))&&.001>Math.abs(e.len-i.len)&&e.x===i.x&&e.y===i.y})])},54735,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(33227),a=e.i(88608),n=e.i(3666),o=e.i(54983),s=e.i(18032),l=e.i(58567);let c=["navigation.position","environment.current"];e.s(["CURRENT_ARROW_WIDTH",0,.028,"DEFAULT_CURRENT_MAP",0,"thermal","currentMarkers",0,({field:e,hour:t,top:r,mapName:i,refE:a,refN:c,cx:d,cy:u,heightM:f,scale:h,radius:p,z:m,isWater:v=()=>!0,onScreen:y=()=>!0})=>{let g=Math.min(400,Math.max(25,5*Math.round(.9*f/5))),x="pi"===(0,l.getRenderProfile)().id?20:40,b=(0,s.markerLattice)({cx:d,cy:u,radius:p,step:g,near:3*g,originE:a,originN:c,max:400}),w=[];return b.forEach(({e:s,n:l})=>{if(w.length>=x||15>Math.hypot(s-a,l-c))return;let d=(s-a)*h,u=(l-c)*h;if(!y(d,u,m)||!v(d,u))return;let f=(0,n.sampleWind)(e,s,l,t),p=Math.hypot(f.u,f.v);if(p<.005)return;let g=(0,n.sampleWind)(e,s,l,t+1),b=Math.min(1,p/r),[S,M,E]=(0,o.colorAt)(i,.28+.72*b);w.push({key:`${s},${l}`,x:d,y:u,z:m,u:f.u,v:f.v,speed:p,trend:Math.hypot(g.u,g.v)-p,color:[S/255,M/255,E/255],len:.16*(.4+.6*b)})}),w},"useCurrentField",0,()=>{let e=(0,r.useSignalKPaths)(c),o=e["navigation.position"],s=e["environment.current"],l=(0,t.useSyncExternalStore)(a.subscribeForecast,a.getForecastHour,a.getForecastHour),[d,u]=(0,t.useState)(null),[f,h]=(0,t.useState)(1),p=o?.latitude,m=o?.longitude,v=Number.isFinite(p)?`${p.toFixed(1)},${m.toFixed(1)}`:null;(0,t.useEffect)(()=>{if(!v)return;let e=!1,[t,r]=v.split(",").map(Number);return(0,i.fetchCurrentField)(t,r).then(t=>{e||u(t)}).catch(()=>{!e&&Number.isFinite(s?.drift)&&Number.isFinite(s?.setTrue)&&u((0,i.uniformCurrent)(t,r,s.drift,s.setTrue))}),()=>{e=!0}},[v]),(0,t.useEffect)(()=>{h((0,i.setCurrentScale)(d)??1)},[d]),(0,t.useEffect)(()=>()=>(0,i.setCurrentScale)(null),[]);let y=Number.isFinite(p)?Math.round(100*p):null,g=Number.isFinite(m)?Math.round(100*m):null;return(0,t.useEffect)(()=>{if(!d||null===y)return;let e=(m-d.origin.lon)*Math.PI/180*6371e3*Math.cos(d.origin.lat*Math.PI/180),t=(p-d.origin.lat)*Math.PI/180*6371e3,r=Array.from({length:d.hours},(r,i)=>{let a=(0,n.sampleWind)(d,e,t,i);return Math.hypot(a.u,a.v)});return(0,a.setSeries)("current",{start:d.start,values:r,top:d.max}),()=>(0,a.setSeries)("current",null)},[d,y,g]),{field:d,hour:l,top:f,lat:p,lon:m}}])},3666,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=(e,t,r,i)=>({lat:e+(i/8*2-1)*4e4/6371e3*180/Math.PI,lon:t+(r/8*2-1)*4e4/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),a=(e,t)=>{let r=[],a=[];for(let n=0;n<9;n++)for(let o=0;o<9;o++){let s=i(e,t,o,n);r.push(s.lat.toFixed(4)),a.push(s.lon.toFixed(4))}return`https://api.open-meteo.com/v1/forecast?latitude=${r.join(",")}&longitude=${a.join(",")}&hourly=wind_speed_10m,wind_direction_10m&wind_speed_unit=ms&forecast_hours=48&timezone=GMT`},n=async(e,i)=>{let n=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===n&&Date.now()-r.at<18e5)return r.field;let o=a(e,i),s=await (0,t.cachedFetch)(o,{kind:"forecast"});if(!s.ok)throw Error(`Open-Meteo ${s.status}`);let l=await s.json(),c=Array.isArray(l)?l:[l],d=c[0]?.hourly?.time||[],u=d.length,f=[],h=[];for(let e=0;e<u;e++){let t=new Float32Array(81),r=new Float32Array(81);c.forEach((i,a)=>{let n=i.hourly.wind_speed_10m[e]??0,o=(i.hourly.wind_direction_10m[e]??0)*Math.PI/180;t[a]=-n*Math.sin(o),r[a]=-n*Math.cos(o)}),f.push(t),h.push(r)}let p={origin:{lat:e,lon:i},start:Date.parse(`${d[0]}Z`),hours:u,u:f,v:h,source:"open-meteo"};return r={key:n,at:Date.now(),field:p},p},o=[[0,[98,113,183]],[1,[57,97,159]],[3,[74,148,169]],[5,[77,141,123]],[7,[83,165,83]],[9,[53,159,53]],[11,[167,157,81]],[13,[159,127,58]],[15,[161,108,92]],[17,[129,58,78]],[19,[175,80,136]],[21,[117,74,147]],[24,[109,97,163]],[27,[68,105,141]],[29,[92,144,152]],[36,[125,68,165]]];e.s(["HALF_EXTENT_M",0,4e4,"WINDY_SCALE",0,o,"fetchWindField",0,n,"sampleWind",0,(e,t,r,i=0)=>{let a=e.grid??9,n=e.half??4e4,o=Math.min(a-1.001,Math.max(0,(t/n+1)/2*(a-1))),s=Math.min(a-1.001,Math.max(0,(r/n+1)/2*(a-1))),l=Math.floor(o),c=Math.floor(s),d=o-l,u=s-c,f=Math.min(e.hours-1,Math.max(0,Math.floor(i))),h=Math.min(e.hours-1,f+1),p=Math.min(1,Math.max(0,i-f)),m=(e,t)=>{let r=e[t],i=c*a+l;return(r[i]*(1-d)+r[i+1]*d)*(1-u)+(r[i+a]*(1-d)+r[i+a+1]*d)*u};return{u:m(e.u,f)*(1-p)+m(e.u,h)*p,v:m(e.v,f)*(1-p)+m(e.v,h)*p}},"uniformField",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(-r*Math.sin(i)),n=new Float32Array(81).fill(-r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,u:[a],v:[n],source:"boat"}},"windColor",0,e=>{if(e<=o[0][0])return o[0][1];for(let t=1;t<o.length;t++)if(e<=o[t][0]){let[r,i]=o[t-1],[a,n]=o[t],s=(e-r)/(a-r);return i.map((e,t)=>e+(n[t]-e)*s)}return o[o.length-1][1]},"windFieldUrl",0,a])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},3950,e=>{"use strict";let t="ocearo-offline-v2",r=["ocearo-offline-v1"],i=!1,a=async(e,{kind:a="tile"}={})=>{if(!("u">typeof caches))return fetch(e,{referrerPolicy:"strict-origin-when-cross-origin"});i||(i=!0,r.forEach(e=>caches.delete(e).catch(()=>{})));let n=await caches.open(t);if("tile"===a){let t=await n.match(e);if(t)return t}try{let t=await fetch(e,{mode:"cors",referrerPolicy:"strict-origin-when-cross-origin"});if(t.ok)await n.put(e,t.clone());else{let t=await n.match(e);if(t)return t}return t}catch(r){let t=await n.match(e);if(t)return t;throw r}},n=async e=>{let t=await a(e,{kind:"tile"});if(!t.ok)throw Error(`${t.status} ${e}`);return createImageBitmap(await t.blob())},o=(e,t,r,i)=>{if(e.includes("{bbox}")){let a=40075016.68557849/2**t,n=-20037508.342789244+r*a,o=20037508.342789244-i*a,s=[n,o-a,n+a,o].map(e=>e.toFixed(2)).join(",");return e.replace("{bbox}",s)}return e.replace("{z}",t).replace("{x}",r).replace("{y}",i)},s=(e,t,r,i)=>{let a=2**i,n=(e,t)=>({x:Math.floor((t+180)/360*a),y:Math.floor((1-Math.log(Math.tan(e*Math.PI/180)+1/Math.cos(e*Math.PI/180))/Math.PI)/2*a)}),o=r/111320,s=r/(111320*Math.cos(e*Math.PI/180)),l=n(e+o,t-s),c=n(e-o,t+s),d=[];for(let e=l.x;e<=c.x;e++)for(let t=l.y;t<=c.y;t++)d.push({z:i,x:e,y:t});return d},l=async({lat:e,lon:t,radiusM:r,layers:i,urls:n=[],onProgress:l})=>{let c=[];for(let{template:a,zooms:n}of i)for(let i of n)for(let n of s(e,t,r,i))c.push(o(a,n.z,n.x,n.y));c.push(...n);let d=0,u=0,f=[...c],h=async()=>{for(;f.length;){let e=f.shift();try{!(await a(e,{kind:e.includes("forecast")?"forecast":"tile"})).ok&&u++}catch{u++}d++,l?.(d,c.length,u)}};return await Promise.all(Array.from({length:4},h)),{done:d,failed:u,total:c.length}},c=async()=>{if(navigator.storage?.estimate){let{usage:e}=await navigator.storage.estimate();return e}return null},d=async(e,r)=>{if(!("u">typeof caches))return!1;let i=await caches.open(t);return await i.put(e,r),!0},u=async e=>{if(!("u">typeof caches))return null;let r=await caches.open(t);return await r.match(e)||null};e.s(["cachedFetch",0,a,"cachedImage",0,n,"clearOfflineCache",0,()=>"u">typeof caches?caches.delete(t):Promise.resolve(!1),"offlineCacheSize",0,c,"prefetchArea",0,l,"readCached",0,u,"storeCached",0,d,"tileUrl",0,o])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,r;var i=e.i(31067),a=e.i(71645),n=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let c=new o.Vector3,d=new o.Vector3,u=new o.Vector3,f=new o.Vector2;function h(e,t,r){let i=c.setFromMatrixPosition(e.matrixWorld);i.project(t);let a=r.width/2,n=r.height/2;return[i.x*a+a,-(i.y*n)+n]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let v=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),y=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,r(t),"translate(-50%,-50%)")),g=a.forwardRef(({children:e,eps:t=.001,style:r,className:m,prepend:g,center:x,fullscreen:b,portal:w,distanceFactor:S,sprite:M=!1,transform:E=!1,occlude:A,onOcclude:F,castShadow:_,receiveShadow:z,material:T,geometry:P,zIndexRange:C=[0x1000037,0],calculatePosition:U=h,as:B="div",wrapperClass:L,pointerEvents:D="auto",...I},O)=>{let{gl:W,camera:R,scene:j,size:N,raycaster:$,events:k,viewport:H}=(0,s.useThree)(),[V]=a.useState(()=>document.createElement(B)),G=a.useRef(null),q=a.useRef(null),K=a.useRef(0),X=a.useRef([0,0]),Z=a.useRef(null),Y=a.useRef(null),J=(null==w?void 0:w.current)||k.connected||W.domElement.parentNode,Q=a.useRef(null),ee=a.useRef(!1),et=a.useMemo(()=>{var e;return A&&"blending"!==A||Array.isArray(A)&&A.length&&(e=A[0])&&"object"==typeof e&&"current"in e},[A]);a.useLayoutEffect(()=>{let e=W.domElement;A&&"blending"===A?(e.style.zIndex=`${Math.floor(C[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[A]),a.useLayoutEffect(()=>{if(q.current){let e=G.current=n.createRoot(V);if(j.updateMatrixWorld(),E)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=U(q.current,R,N);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return J&&(g?J.prepend(V):J.appendChild(V)),()=>{J&&J.removeChild(V),e.unmount()}}},[J,E]),a.useLayoutEffect(()=>{L&&(V.className=L)},[L]);let er=a.useMemo(()=>E?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...b&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...r},[r,x,b,N,E]),ei=a.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);a.useLayoutEffect(()=>{var t,i;ee.current=!1,E?null==(t=G.current)||t.render(a.createElement("div",{ref:Z,style:er},a.createElement("div",{ref:Y,style:ei},a.createElement("div",{ref:O,className:m,style:r,children:e})))):null==(i=G.current)||i.render(a.createElement("div",{ref:O,style:er,className:m,children:e}))});let ea=a.useRef(!0);(0,l.useFrame)(e=>{if(q.current){R.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=E?X.current:U(q.current,R,N);if(E||Math.abs(K.current-R.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var r;let t,i,a,n,s=(r=q.current,t=c.setFromMatrixPosition(r.matrixWorld),i=d.setFromMatrixPosition(R.matrixWorld),a=t.sub(i),n=R.getWorldDirection(u),a.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(A)?l=A.map(e=>e.current):"blending"!==A&&(l=[j]));let h=ea.current;l?ea.current=function(e,t,r,i){let a=c.setFromMatrixPosition(e.matrixWorld),n=a.clone();n.project(t),f.set(n.x,n.y),r.setFromCamera(f,t);let o=r.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return a.distanceTo(r.ray.origin)<e}return!0}(q.current,R,$,l)&&!s:ea.current=!s,h!==ea.current&&(F?F(!ea.current):V.style.display=ea.current?"block":"none");let m=Math.floor(C[0]/2),g=A?et?[C[0],m]:[m-1,0]:C;if(V.style.zIndex=`${function(e,t,r){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let i=c.setFromMatrixPosition(e.matrixWorld),a=d.setFromMatrixPosition(t.matrixWorld),n=i.distanceTo(a),o=(r[1]-r[0])/(t.far-t.near),s=r[1]-o*t.far;return Math.round(o*n+s)}}(q.current,R,g)}`,E){let[e,t]=[N.width/2,N.height/2],r=R.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:a,left:n,bottom:o,right:s}=R,l=v(R.matrixWorldInverse),c=i?`scale(${r})translate(${p(-(s+n)/2)}px,${p((a+o)/2)}px)`:`translateZ(${r}px)`,d=q.current.matrixWorld;M&&((d=R.matrixWorldInverse.clone().transpose().copyPosition(d).scale(q.current.scale)).elements[3]=d.elements[7]=d.elements[11]=0,d.elements[15]=1),V.style.width=N.width+"px",V.style.height=N.height+"px",V.style.perspective=i?"":`${r}px`,Z.current&&Y.current&&(Z.current.style.transform=`${c}${l}translate(${e}px,${t}px)`,Y.current.style.transform=y(d,1/((S||10)/400)))}else{let t=void 0===S?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let r=c.setFromMatrixPosition(e.matrixWorld),i=d.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*r.distanceTo(i))}}(q.current,R)*S;V.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,K.current=R.zoom}}if(!et&&Q.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=R;if(t||P)I.scale&&(Array.isArray(I.scale)?I.scale instanceof o.Vector3?Q.current.scale.copy(I.scale.clone().divideScalar(1)):Q.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):Q.current.scale.setScalar(1/I.scale));else{let t=(S||10)/400,r=e.clientWidth*t,i=e.clientHeight*t;Q.current.scale.set(r,i,1)}ee.current=!0}}}else{let t=V.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/H.factor,r=t.clientWidth*e,i=t.clientHeight*e;Q.current.scale.set(r,i,1),ee.current=!0}Q.current.lookAt(e.camera.position)}});let en=a.useMemo(()=>({vertexShader:E?void 0:`
|
|
75
|
+
/*
|
|
76
|
+
This shader is from the THREE's SpriteMaterial.
|
|
77
|
+
We need to turn the backing plane into a Sprite
|
|
78
|
+
(make it always face the camera) if "transfrom"
|
|
79
|
+
is false.
|
|
80
|
+
*/
|
|
81
|
+
#include <common>
|
|
82
|
+
|
|
83
|
+
void main() {
|
|
84
|
+
vec2 center = vec2(0., 1.);
|
|
85
|
+
float rotation = 0.0;
|
|
86
|
+
|
|
87
|
+
// This is somewhat arbitrary, but it seems to work well
|
|
88
|
+
// Need to figure out how to derive this dynamically if it even matters
|
|
89
|
+
float size = 0.03;
|
|
90
|
+
|
|
91
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
92
|
+
vec2 scale;
|
|
93
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
94
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
95
|
+
|
|
96
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
97
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
98
|
+
|
|
99
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
|
|
100
|
+
vec2 rotatedPosition;
|
|
101
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
102
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
103
|
+
mvPosition.xy += rotatedPosition;
|
|
104
|
+
|
|
105
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
106
|
+
}
|
|
107
|
+
`,fragmentShader:`
|
|
108
|
+
void main() {
|
|
109
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
110
|
+
}
|
|
111
|
+
`}),[E]);return a.createElement("group",(0,i.default)({},I,{ref:q}),A&&!et&&a.createElement("mesh",{castShadow:_,receiveShadow:z,ref:Q},P||a.createElement("planeGeometry",null),T||a.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:en.vertexShader,fragmentShader:en.fragmentShader})))});e.s(["Html",0,g])},95393,e=>{"use strict";var t=e.i(61949);e.s(["useFrame",()=>t.F])},92923,30728,27530,e=>{"use strict";let t,r;var i=e.i(90072),a=i;let n=new a.Box3,o=new a.Vector3;class s extends a.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new a.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new a.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let r=new a.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new a.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new a.InterleavedBufferAttribute(r,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let r=new a.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new a.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new a.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new a.WireframeGeometry(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new a.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let a=0,n=e.count;a<n;a++)o.fromBufferAttribute(e,a),i=Math.max(i,r.distanceToSquared(o)),o.fromBufferAttribute(t,a),i=Math.max(i,r.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}e.s(["LineSegmentsGeometry",0,s],30728);var l=e.i(8560),c=i;l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},l.ShaderLib.line={uniforms:c.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
112
|
+
#include <common>
|
|
113
|
+
#include <color_pars_vertex>
|
|
114
|
+
#include <fog_pars_vertex>
|
|
115
|
+
#include <logdepthbuf_pars_vertex>
|
|
116
|
+
#include <clipping_planes_pars_vertex>
|
|
117
|
+
|
|
118
|
+
uniform float linewidth;
|
|
119
|
+
uniform vec2 resolution;
|
|
120
|
+
|
|
121
|
+
attribute vec3 instanceStart;
|
|
122
|
+
attribute vec3 instanceEnd;
|
|
123
|
+
|
|
124
|
+
attribute vec3 instanceColorStart;
|
|
125
|
+
attribute vec3 instanceColorEnd;
|
|
126
|
+
|
|
127
|
+
#ifdef WORLD_UNITS
|
|
128
|
+
|
|
129
|
+
varying vec4 worldPos;
|
|
130
|
+
varying vec3 worldStart;
|
|
131
|
+
varying vec3 worldEnd;
|
|
132
|
+
|
|
133
|
+
#ifdef USE_DASH
|
|
134
|
+
|
|
135
|
+
varying vec2 vUv;
|
|
136
|
+
|
|
137
|
+
#endif
|
|
138
|
+
|
|
139
|
+
#else
|
|
140
|
+
|
|
141
|
+
varying vec2 vUv;
|
|
142
|
+
|
|
143
|
+
#endif
|
|
144
|
+
|
|
145
|
+
#ifdef USE_DASH
|
|
146
|
+
|
|
147
|
+
uniform float dashScale;
|
|
148
|
+
attribute float instanceDistanceStart;
|
|
149
|
+
attribute float instanceDistanceEnd;
|
|
150
|
+
varying float vLineDistance;
|
|
151
|
+
|
|
152
|
+
#endif
|
|
153
|
+
|
|
154
|
+
float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {
|
|
155
|
+
|
|
156
|
+
// compute the interpolation factor needed to trim the segment so it terminates
|
|
157
|
+
// between the camera plane and the near plane
|
|
158
|
+
|
|
159
|
+
// conservative estimate of the near plane
|
|
160
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
161
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
162
|
+
|
|
163
|
+
// we need different nearEstimate formula for reversed and default depth buffer
|
|
164
|
+
// a is positive with a reversed depth buffer so it can be used for controlling the code flow
|
|
165
|
+
float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );
|
|
166
|
+
|
|
167
|
+
return ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
void main() {
|
|
172
|
+
|
|
173
|
+
#ifdef USE_COLOR
|
|
174
|
+
|
|
175
|
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
176
|
+
|
|
177
|
+
#endif
|
|
178
|
+
|
|
179
|
+
float aspect = resolution.x / resolution.y;
|
|
180
|
+
|
|
181
|
+
// camera space
|
|
182
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
183
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
184
|
+
|
|
185
|
+
#ifdef USE_DASH
|
|
186
|
+
|
|
187
|
+
float lineDistanceStart = dashScale * instanceDistanceStart;
|
|
188
|
+
float lineDistanceEnd = dashScale * instanceDistanceEnd;
|
|
189
|
+
|
|
190
|
+
#endif
|
|
191
|
+
|
|
192
|
+
#ifdef WORLD_UNITS
|
|
193
|
+
|
|
194
|
+
worldStart = start.xyz;
|
|
195
|
+
worldEnd = end.xyz;
|
|
196
|
+
|
|
197
|
+
#else
|
|
198
|
+
|
|
199
|
+
vUv = uv;
|
|
200
|
+
|
|
201
|
+
#endif
|
|
202
|
+
|
|
203
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
204
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
205
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
206
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
207
|
+
|
|
208
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
209
|
+
|
|
210
|
+
if ( perspective ) {
|
|
211
|
+
|
|
212
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
213
|
+
|
|
214
|
+
float alpha = trimSegmentAlpha( start, end );
|
|
215
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
216
|
+
|
|
217
|
+
#ifdef USE_DASH
|
|
218
|
+
|
|
219
|
+
lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );
|
|
220
|
+
|
|
221
|
+
#endif
|
|
222
|
+
|
|
223
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
224
|
+
|
|
225
|
+
float alpha = trimSegmentAlpha( end, start );
|
|
226
|
+
start.xyz = mix( end.xyz, start.xyz, alpha );
|
|
227
|
+
|
|
228
|
+
#ifdef USE_DASH
|
|
229
|
+
|
|
230
|
+
lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );
|
|
231
|
+
|
|
232
|
+
#endif
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
#ifdef USE_DASH
|
|
239
|
+
|
|
240
|
+
vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;
|
|
241
|
+
vUv = uv;
|
|
242
|
+
|
|
243
|
+
#endif
|
|
244
|
+
|
|
245
|
+
// clip space
|
|
246
|
+
vec4 clipStart = projectionMatrix * start;
|
|
247
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
248
|
+
|
|
249
|
+
// ndc space
|
|
250
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
251
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
252
|
+
|
|
253
|
+
// direction
|
|
254
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
255
|
+
|
|
256
|
+
// account for clip-space aspect ratio
|
|
257
|
+
dir.x *= aspect;
|
|
258
|
+
dir = normalize( dir );
|
|
259
|
+
|
|
260
|
+
#ifdef WORLD_UNITS
|
|
261
|
+
|
|
262
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
263
|
+
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
264
|
+
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
265
|
+
vec3 worldFwd = cross( worldDir, worldUp );
|
|
266
|
+
worldPos = position.y < 0.5 ? start: end;
|
|
267
|
+
|
|
268
|
+
// height offset
|
|
269
|
+
float hw = linewidth * 0.5;
|
|
270
|
+
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
271
|
+
|
|
272
|
+
// don't extend the line if we're rendering dashes because we
|
|
273
|
+
// won't be rendering the endcaps
|
|
274
|
+
#ifndef USE_DASH
|
|
275
|
+
|
|
276
|
+
// cap extension
|
|
277
|
+
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
278
|
+
|
|
279
|
+
// add width to the box
|
|
280
|
+
worldPos.xyz += worldFwd * hw;
|
|
281
|
+
|
|
282
|
+
// endcaps
|
|
283
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
284
|
+
|
|
285
|
+
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
286
|
+
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
#endif
|
|
290
|
+
|
|
291
|
+
// project the worldpos
|
|
292
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
293
|
+
|
|
294
|
+
// shift the depth of the projected points so the line
|
|
295
|
+
// segments overlap neatly
|
|
296
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
297
|
+
clip.z = clipPose.z * clip.w;
|
|
298
|
+
|
|
299
|
+
#else
|
|
300
|
+
|
|
301
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
302
|
+
// undo aspect ratio adjustment
|
|
303
|
+
dir.x /= aspect;
|
|
304
|
+
offset.x /= aspect;
|
|
305
|
+
|
|
306
|
+
// sign flip
|
|
307
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
308
|
+
|
|
309
|
+
// endcaps
|
|
310
|
+
if ( position.y < 0.0 ) {
|
|
311
|
+
|
|
312
|
+
offset += - dir;
|
|
313
|
+
|
|
314
|
+
} else if ( position.y > 1.0 ) {
|
|
315
|
+
|
|
316
|
+
offset += dir;
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// adjust for linewidth
|
|
321
|
+
offset *= linewidth;
|
|
322
|
+
|
|
323
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
324
|
+
offset /= resolution.y;
|
|
325
|
+
|
|
326
|
+
// select end
|
|
327
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
328
|
+
|
|
329
|
+
// back to clip space
|
|
330
|
+
offset *= clip.w;
|
|
331
|
+
|
|
332
|
+
clip.xy += offset;
|
|
333
|
+
|
|
334
|
+
#endif
|
|
335
|
+
|
|
336
|
+
gl_Position = clip;
|
|
337
|
+
|
|
338
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
339
|
+
|
|
340
|
+
#include <logdepthbuf_vertex>
|
|
341
|
+
#include <clipping_planes_vertex>
|
|
342
|
+
#include <fog_vertex>
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
`,fragmentShader:`
|
|
346
|
+
uniform vec3 diffuse;
|
|
347
|
+
uniform float opacity;
|
|
348
|
+
uniform float linewidth;
|
|
349
|
+
|
|
350
|
+
#ifdef USE_DASH
|
|
351
|
+
|
|
352
|
+
uniform float dashOffset;
|
|
353
|
+
uniform float dashSize;
|
|
354
|
+
uniform float gapSize;
|
|
355
|
+
|
|
356
|
+
#endif
|
|
357
|
+
|
|
358
|
+
varying float vLineDistance;
|
|
359
|
+
|
|
360
|
+
#ifdef WORLD_UNITS
|
|
361
|
+
|
|
362
|
+
varying vec4 worldPos;
|
|
363
|
+
varying vec3 worldStart;
|
|
364
|
+
varying vec3 worldEnd;
|
|
365
|
+
|
|
366
|
+
#ifdef USE_DASH
|
|
367
|
+
|
|
368
|
+
varying vec2 vUv;
|
|
369
|
+
|
|
370
|
+
#endif
|
|
371
|
+
|
|
372
|
+
#else
|
|
373
|
+
|
|
374
|
+
varying vec2 vUv;
|
|
375
|
+
|
|
376
|
+
#endif
|
|
377
|
+
|
|
378
|
+
#include <common>
|
|
379
|
+
#include <color_pars_fragment>
|
|
380
|
+
#include <fog_pars_fragment>
|
|
381
|
+
#include <logdepthbuf_pars_fragment>
|
|
382
|
+
#include <clipping_planes_pars_fragment>
|
|
383
|
+
|
|
384
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
385
|
+
|
|
386
|
+
float mua;
|
|
387
|
+
float mub;
|
|
388
|
+
|
|
389
|
+
vec3 p13 = p1 - p3;
|
|
390
|
+
vec3 p43 = p4 - p3;
|
|
391
|
+
|
|
392
|
+
vec3 p21 = p2 - p1;
|
|
393
|
+
|
|
394
|
+
float d1343 = dot( p13, p43 );
|
|
395
|
+
float d4321 = dot( p43, p21 );
|
|
396
|
+
float d1321 = dot( p13, p21 );
|
|
397
|
+
float d4343 = dot( p43, p43 );
|
|
398
|
+
float d2121 = dot( p21, p21 );
|
|
399
|
+
|
|
400
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
401
|
+
|
|
402
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
403
|
+
|
|
404
|
+
mua = numer / denom;
|
|
405
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
406
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
407
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
408
|
+
|
|
409
|
+
return vec2( mua, mub );
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
void main() {
|
|
414
|
+
|
|
415
|
+
float alpha = opacity;
|
|
416
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
417
|
+
|
|
418
|
+
#include <clipping_planes_fragment>
|
|
419
|
+
|
|
420
|
+
#ifdef USE_DASH
|
|
421
|
+
|
|
422
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
423
|
+
|
|
424
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
425
|
+
|
|
426
|
+
#endif
|
|
427
|
+
|
|
428
|
+
#ifdef WORLD_UNITS
|
|
429
|
+
|
|
430
|
+
// Find the closest points on the view ray and the line segment
|
|
431
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
432
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
433
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
434
|
+
|
|
435
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
436
|
+
vec3 p2 = rayEnd * params.y;
|
|
437
|
+
vec3 delta = p1 - p2;
|
|
438
|
+
float len = length( delta );
|
|
439
|
+
float norm = len / linewidth;
|
|
440
|
+
|
|
441
|
+
#ifndef USE_DASH
|
|
442
|
+
|
|
443
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
444
|
+
|
|
445
|
+
float dnorm = fwidth( norm );
|
|
446
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
447
|
+
|
|
448
|
+
#else
|
|
449
|
+
|
|
450
|
+
if ( norm > 0.5 ) {
|
|
451
|
+
|
|
452
|
+
discard;
|
|
453
|
+
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
#endif
|
|
457
|
+
|
|
458
|
+
#endif
|
|
459
|
+
|
|
460
|
+
#else
|
|
461
|
+
|
|
462
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
463
|
+
|
|
464
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
465
|
+
float a = vUv.x;
|
|
466
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
467
|
+
float len2 = a * a + b * b;
|
|
468
|
+
float dlen = fwidth( len2 );
|
|
469
|
+
|
|
470
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
471
|
+
|
|
472
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
473
|
+
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
#else
|
|
477
|
+
|
|
478
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
479
|
+
|
|
480
|
+
float a = vUv.x;
|
|
481
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
482
|
+
float len2 = a * a + b * b;
|
|
483
|
+
|
|
484
|
+
if ( len2 > 1.0 ) discard;
|
|
485
|
+
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
#endif
|
|
489
|
+
|
|
490
|
+
#endif
|
|
491
|
+
|
|
492
|
+
#include <logdepthbuf_fragment>
|
|
493
|
+
#include <color_fragment>
|
|
494
|
+
|
|
495
|
+
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
496
|
+
|
|
497
|
+
#include <tonemapping_fragment>
|
|
498
|
+
#include <colorspace_fragment>
|
|
499
|
+
#include <fog_fragment>
|
|
500
|
+
#include <premultiplied_alpha_fragment>
|
|
501
|
+
|
|
502
|
+
}
|
|
503
|
+
`};class d extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){!0===e!==this.worldUnits&&(this.needsUpdate=!0),!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}e.s(["LineMaterial",0,d],27530);let u=new i.Vector4,f=new i.Vector3,h=new i.Vector3,p=new i.Vector4,m=new i.Vector4,v=new i.Vector4,y=new i.Vector3,g=new i.Matrix4,x=new i.Line3,b=new i.Vector3,w=new i.Box3,S=new i.Sphere,M=new i.Vector4;function E(e,t,i){return M.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),M.multiplyScalar(1/M.w),M.x=r/i.width,M.y=r/i.height,M.applyMatrix4(e.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}class A extends i.Mesh{constructor(e=new s,t=new d({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count);for(let e=0,i=0,n=t.count;e<n;e++,i+=2)f.fromBufferAttribute(t,e),h.fromBufferAttribute(r,e),a[i]=0===i?0:a[i-1],a[i+1]=a[i]+f.distanceTo(h);let n=new i.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(n,1,0)),e.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(n,1,1)),this}raycast(e,a){let n,o,s=this.material.worldUnits,l=e.camera;if(null!==l||s||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),!1===s&&(0===this.material.resolution.x||0===this.material.resolution.y))return;let c=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let d=this.matrixWorld,u=this.geometry,f=this.material;if(r=f.linewidth+c,null===u.boundingSphere&&u.computeBoundingSphere(),S.copy(u.boundingSphere).applyMatrix4(d),s)n=.5*r;else{let e=Math.max(l.near,S.distanceToPoint(t.origin));n=E(l,e,f.resolution)}if(S.radius+=n,!1!==t.intersectsSphere(S)){if(null===u.boundingBox&&u.computeBoundingBox(),w.copy(u.boundingBox).applyMatrix4(d),s)o=.5*r;else{let e=Math.max(l.near,w.distanceToPoint(t.origin));o=E(l,e,f.resolution)}w.expandByScalar(o),!1!==t.intersectsBox(w)&&(s?function(e,a){let n=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,l=o.attributes.instanceEnd,c=Math.min(o.instanceCount,s.count);for(let o=0;o<c;o++){x.start.fromBufferAttribute(s,o),x.end.fromBufferAttribute(l,o),x.applyMatrix4(n);let c=new i.Vector3,d=new i.Vector3;t.distanceSqToSegment(x.start,x.end,d,c),d.distanceTo(c)<.5*r&&a.push({point:d,pointOnLine:c,distance:t.origin.distanceTo(d),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,a):function(e,a,n){let o=a.projectionMatrix,s=e.material.resolution,l=e.matrixWorld,c=e.geometry,d=c.attributes.instanceStart,u=c.attributes.instanceEnd,f=Math.min(c.instanceCount,d.count),h=-a.near;t.at(1,v),v.w=1,v.applyMatrix4(a.matrixWorldInverse),v.applyMatrix4(o),v.multiplyScalar(1/v.w),v.x*=s.x/2,v.y*=s.y/2,v.z=0,y.copy(v),g.multiplyMatrices(a.matrixWorldInverse,l);for(let a=0;a<f;a++){if(p.fromBufferAttribute(d,a),m.fromBufferAttribute(u,a),p.w=1,m.w=1,p.applyMatrix4(g),m.applyMatrix4(g),p.z>h&&m.z>h)continue;if(p.z>h){let e=p.z-m.z,t=(p.z-h)/e;p.lerp(m,t)}else if(m.z>h){let e=m.z-p.z,t=(m.z-h)/e;m.lerp(p,t)}p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w),p.x*=s.x/2,p.y*=s.y/2,m.x*=s.x/2,m.y*=s.y/2,x.start.copy(p),x.start.z=0,x.end.copy(m),x.end.z=0;let c=x.closestPointToPointParameter(y,!0);x.at(c,b);let f=i.MathUtils.lerp(p.z,m.z,c),v=f>=-1&&f<=1,w=y.distanceTo(b)<.5*r;if(v&&w){x.start.fromBufferAttribute(d,a),x.end.fromBufferAttribute(u,a),x.start.applyMatrix4(l),x.end.applyMatrix4(l);let r=new i.Vector3,o=new i.Vector3;t.distanceSqToSegment(x.start,x.end,o,r),n.push({point:o,pointOnLine:r,distance:t.origin.distanceTo(o),object:e,face:null,faceIndex:a,uv:null,uv1:null})}}}(this,l,a))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(u),this.material.uniforms.resolution.value.set(u.z,u.w))}}e.s(["LineSegments2",0,A],92923)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,84226,e=>{"use strict";var t=e.i(43476),n=e.i(71645),r=e.i(57384);e.i(67561);var i=e.i(46991),a=e.i(85709),o=e.i(83402),s=e.i(90072),u=e.i(16196),l=e.i(83646);let d=({position:e=[0,0,0],rotation:n=[0,0,0],speed:r,color:i,fontSize:a=.5,textPosition:o=[0,.8,0],arrowSize:d=1})=>{let{scene:c}=(0,l.default)(),p=i||c.wind;return(0,t.jsxs)("group",{position:e,rotation:n,children:[(0,t.jsx)(u.Text,{characters:".0123456789",color:p,fontSize:a*d,position:o,font:"fonts/Roboto-Bold.ttf",anchorX:"center",anchorY:"middle",children:r.toFixed(1)}),(0,t.jsxs)("mesh",{children:[(0,t.jsx)("shapeGeometry",{args:[new s.Shape([new s.Vector2(0,0),new s.Vector2(.5*d*Math.cos(5*Math.PI/6),.5*d*Math.sin(5*Math.PI/6)),new s.Vector2(0,-.577*d),new s.Vector2(0,-.577*d),new s.Vector2(-.5*d*Math.cos(5*Math.PI/6),.5*d*Math.sin(5*Math.PI/6)),new s.Vector2(0,0)])]}),(0,t.jsx)("meshStandardMaterial",{color:p,side:s.DoubleSide})]})]})};d.propTypes={position:r.default.oneOfType([r.default.instanceOf(s.Vector3),r.default.arrayOf(r.default.number)]).isRequired,rotation:r.default.arrayOf(r.default.number).isRequired,speed:r.default.number.isRequired,color:r.default.oneOfType([r.default.string,r.default.number]).isRequired,fontSize:r.default.number,textPosition:r.default.arrayOf(r.default.number),arrowSize:r.default.number};let c=({outerRadius:e})=>{let r=o.default.get("preferredWindSpeedPath")||"speedTrue",u=o.default.get("preferredWindDirectionPath")||"directionTrue",c=o.default.get("preferredHeadingPath")||"courseOverGroundTrue",p=(0,n.useMemo)(()=>["environment.wind.angleTrueGround","environment.wind.speedOverGround","environment.wind.directionTrue","environment.wind.speedTrue","environment.wind.angleApparent","environment.wind.speedApparent","environment.wind.angleTrueWater","navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic"],[]),h=(0,a.useSignalKPaths)(p),g=(0,n.useMemo)(()=>{if("directionTrue"===u){let e=h[`environment.wind.${u}`]??h["environment.wind.directionTrue"];if(null!=e)return Math.PI/2-(e-(h[`navigation.${c}`]??h["navigation.headingTrue"]??h["navigation.courseOverGroundTrue"]??0));let t=h["environment.wind.angleTrueGround"]??h["environment.wind.angleTrueWater"];if(null!=t)return Math.PI/2-t}else{let e=h[`environment.wind.${u}`]??h["environment.wind.angleTrueGround"]??h["environment.wind.angleTrueWater"];if(null!=e)return Math.PI/2-e;let t=h["environment.wind.directionTrue"];if(null!=t)return Math.PI/2-(t-(h[`navigation.${c}`]??h["navigation.headingTrue"]??h["navigation.courseOverGroundTrue"]??0))}return Math.PI/2},[h,u,c]),f=(0,n.useMemo)(()=>{let e=h[`environment.wind.${r}`]??h["environment.wind.speedOverGround"]??h["environment.wind.speedTrue"];return(0,i.convertSpeedUnit)(e)||0},[h,r]),m=(0,n.useMemo)(()=>Math.PI/2-(h["environment.wind.angleApparent"]||0),[h]),M=(0,n.useMemo)(()=>(0,i.convertSpeedUnit)(h["environment.wind.speedApparent"])||0,[h]),v=(0,n.useMemo)(()=>new s.Vector3((e+.7)*Math.cos(g),0,-(e+.7)*Math.sin(g)),[e,g]),b=(0,n.useMemo)(()=>new s.Vector3((e+.7)*Math.cos(m),0,-(e+.7)*Math.sin(m)),[e,m]),T=(0,l.default)();return(0,t.jsxs)("group",{children:[f>0&&!0!==o.default.get("hideTrueWind")&&(0,t.jsx)(d,{position:v,rotation:[-Math.PI/2,0,-(Math.PI/2-g)],speed:f,color:T.ok,fontSize:1}),M>0&&(0,t.jsx)(d,{position:b,rotation:[-Math.PI/2,0,-(Math.PI/2-m)],speed:M,color:T.accent,fontSize:1})]})};c.propTypes={outerRadius:r.default.number.isRequired},e.s(["default",0,c])},20705,e=>{"use strict";let t=["north","east","south","west"],n=["port","starboard","preferred_channel_port","preferred_channel_starboard"],r=e=>{let r=Number(e);return r>=9&&r<=12?{kind:"cardinal",beacon:!0,category:t[r-9]}:r>=13&&r<=16?{kind:"lateral",beacon:!0,category:n[r-13]}:17===r?{kind:"isolated_danger",beacon:!0}:18===r?{kind:"safe_water",beacon:!0}:19===r?{kind:"special_purpose",beacon:!0}:r>=20&&r<=23?{kind:"cardinal",beacon:!1,category:t[r-20]}:r>=24&&r<=27?{kind:"lateral",beacon:!1,category:n[r-24]}:28===r?{kind:"isolated_danger",beacon:!1}:29===r?{kind:"safe_water",beacon:!1}:30===r?{kind:"special_purpose",beacon:!1}:4===r?{kind:"special_purpose",beacon:!1,colours:["blue","yellow"],pattern:"vertical",topmark:{shape:"cross",colours:["yellow"]}}:{kind:"station",beacon:!0}},i=e=>{let t=r(e.atonType);return{id:`ais:${e.id}`,lat:e.latitude,lon:e.longitude,name:e.name||"",kind:t.kind,beacon:t.beacon,category:t.category||"",shape:"",colours:t.colours||[],pattern:t.pattern||"",system:"",height:null,topmark:t.topmark||null,light:null,ais:!0,virtual:e.virtual,offPosition:e.offPosition}},a=(e,t)=>Math.hypot((t.lat-e.lat)*111320,(t.lon-e.lon)*111320*Math.cos(e.lat*Math.PI/180));e.s(["atonKind",0,r,"mergeAtons",0,(e,t)=>{if(!t.length)return e;let n=e.map(e=>({...e})),r=[];for(let e of t){if(!Number.isFinite(e.latitude)||!Number.isFinite(e.longitude))continue;let t=i(e),o=!t.virtual&&n.find(e=>!e.ais&&("station"===t.kind||e.kind===t.kind)&&60>=a(e,t));o?(o.ais=!0,o.offPosition=t.offPosition,o.name||(o.name=t.name)):r.push(t)}return[...n,...r]}])},83524,e=>{"use strict";var t=e.i(71645),n=e.i(62588),r=e.i(85709),i=e.i(61969),a=e.i(90669),o=e.i(539),s=e.i(83402),u=e.i(77291);let l=Math.PI/180,d=3*l,c=60*l,p=5*l,h=90*l,g=["navigation.speedOverGround","navigation.courseOverGroundTrue"];e.s(["default",0,()=>{let{targets:e}=(0,n.useAIS)({passive:!0}),l=(0,i.default)(),f=(0,r.useSignalKPaths)(g),m=(0,t.useMemo)(()=>(0,a.getCollisionThresholds)(),[]),M=(0,u.default)(),v=s.default.get("aisLengthScalingFactor")||.7;return(0,t.useMemo)(()=>{let t=f["navigation.speedOverGround"],n=f["navigation.courseOverGroundTrue"]??l.heading,r=M.giveWayTo||M.primary;if(r&&Number.isFinite(t)&&t>.3&&Number.isFinite(n)){let{target:i,role:s}=r,u={targetName:i.name,rule:s.rule,reason:s.reason},l="stand-on"===s.ownRole&&Number.isFinite(i.tcpaSeconds)&&i.tcpaSeconds<180&&Number.isFinite(i.cpaMeters)&&i.cpaMeters<.3*m.cpaMeters;if("stand-on"===s.ownRole&&!l)return{kind:"standOn",change:0,heading:n,...u};let d=Math.sign(Math.sin(Math.atan2(i.sceneX,-i.sceneZ)-n))||1,c=(({targets:e,sog:t,cog:n,scale:r,thresholds:i,preferSide:o=0})=>{let s=e.filter(e=>null!==e.distanceMeters&&null!==e.sceneX&&Number.isFinite(e.sog)&&Number.isFinite(e.cog??e.cogMagnetic)),u=(e,n=i.cpaMeters)=>s.every(o=>{let s=(0,a.closestApproach)({rx:o.sceneX/r,ry:-o.sceneZ/r,ownSog:t,ownCog:e,targetSog:o.sog,targetCog:o.cog??o.cogMagnetic});return!s||s.tcpa<=0||s.tcpa>i.tcpaSeconds||s.cpa>=n}),l=o<0?[-1,1]:[1,-1],d=(e,t)=>{for(let r=p;r<=h+1e-9;r+=p)if(u(n+e*r,t))return e*r;return null};if(0!==o)return d(l[0])??d(l[0],i.cpaMeters/2)??d(l[1]);for(let e=p;e<=h+1e-9;e+=p){if(u(n+e))return e;if(u(n-e))return-e}return null})({targets:e,sog:t,cog:n,scale:v,thresholds:m,preferSide:"both"===s.ownRole||"power"===M.ownCategory||l?1:d});return null!==c?{kind:"avoid",change:c,heading:(0,o.wrapPi)(n+c),lastMoment:l,...u}:{kind:"avoid",change:null,heading:n,lastMoment:l,noSolution:!0,...u}}let i=l.vmc;if(i&&Number.isFinite(i.current)&&Number.isFinite(l.heading)){let e=(0,o.wrapPi)(i.best.heading-l.heading),t=(i.best.vmc-i.current)*1.943844;if(t>=.15&&Math.abs(e)>=d&&Math.abs(e)<=c)return{kind:"vmg",change:e,heading:i.best.heading,gainKn:t}}return null},[e,l,f,v,m,M])}])},71029,e=>{"use strict";var t=e.i(71645),n=e.i(85709),r=e.i(66799),i=e.i(46991);let a="notifications.mob",o=e=>e*Math.PI/180;e.s(["distanceAndBearing",0,(e,t)=>{if(!Number.isFinite(e?.latitude)||!Number.isFinite(e?.longitude)||!Number.isFinite(t?.latitude)||!Number.isFinite(t?.longitude))return null;let n=o(e.latitude),r=o(t.latitude),a=o(t.longitude-e.longitude),s=Math.sin((r-n)/2)**2+Math.cos(n)*Math.cos(r)*Math.sin(a/2)**2;return{distance:2*i.EARTH_RADIUS_METERS*Math.asin(Math.min(1,Math.sqrt(s))),bearing:(180*Math.atan2(Math.sin(a)*Math.cos(r),Math.cos(n)*Math.sin(r)-Math.sin(n)*Math.cos(r)*Math.cos(a))/Math.PI+360)%360}},"useActiveMobs",0,()=>{let e=(0,n.useSignalKPrefix)(a);return(0,t.useMemo)(()=>Object.entries(e).filter(([e,t])=>(e===a||e.startsWith(`${a}.`))&&t?.state&&"normal"!==t.state).map(([e,t])=>({...t,path:e})).sort((e,t)=>String(e.createdAt??"").localeCompare(String(t.createdAt??""))),[e])},"useMobSupport",0,()=>{let e=(()=>{let[e,n]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let e=!1,t=null,i=async()=>{let a=await r.default.getFeatures();e||(a?n(a):t=setTimeout(i,3e4))};return i(),()=>{e=!0,clearTimeout(t)}},[]),e})();return(0,t.useMemo)(()=>({raise:!!e?.apis.includes("notifications"),navigate:!!e?.apis.includes("course")}),[e])}],71029)},32189,(e,t,n)=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},65156,(e,t,n)=>{"use strict";var r=e.r(32189);function i(){}function a(){}a.resetWarningCache=i,t.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},57384,(e,t,n)=>{e.i(47167),t.exports=e.r(65156)()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,14922,37917,e=>{"use strict";var t=e.i(43476),i=e.i(71645);e.s(["default",0,({title:e,right:i,className:s="",children:l})=>(0,t.jsxs)("div",{className:`hud-halo px-1 py-1 select-none ${s}`,children:[(e||i)&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted",children:e}),i]}),l]})],14922);let s=({values:e,width:i=240,height:s=60,color:l="var(--color-oBlue)",marker:n=null,endDot:r=!1,invert:a=!1})=>{let d=e.filter(Number.isFinite);if(d.length<2)return(0,t.jsx)("svg",{width:i,height:s});let c=Math.min(...d),u=Math.max(...d)-c||1,h=i/(e.length-1),o=e=>(a?(e-c)/u:1-(e-c)/u)*(s-8)+4,x="";e.forEach((e,t)=>{Number.isFinite(e)&&(x+=`${x?"L":"M"}${(t*h).toFixed(1)},${o(e).toFixed(1)}`)});let m=`${x}L${i},${a?0:s}L0,${a?0:s}Z`,f=null;if(null!==n){let t=n*(e.length-1),s=Math.min(e.length-2,Math.floor(t)),l=e[s],r=e[s+1];Number.isFinite(l)&&Number.isFinite(r)&&(f={x:n*i,y:o(l+(r-l)*(t-s))})}let p=e[e.length-1];return(0,t.jsxs)("svg",{width:i,height:s,className:"block overflow-visible",children:[(0,t.jsx)("path",{d:m,fill:l,opacity:"0.12"}),(0,t.jsx)("path",{d:x,fill:"none",stroke:l,strokeWidth:"2",strokeLinejoin:"round"}),null!==n&&(0,t.jsx)("line",{x1:n*i,x2:n*i,y1:"0",y2:s,stroke:"var(--hud-text-main)",strokeWidth:"1.5"}),f&&(0,t.jsx)("circle",{cx:f.x,cy:f.y,r:"4",fill:l,stroke:"var(--hud-text-main)",strokeWidth:"1.5"}),r&&Number.isFinite(p)&&(0,t.jsx)("circle",{cx:i,cy:o(p),r:"3.5",fill:l})]})},l=e=>{let l=(0,i.useRef)(null),[n,r]=(0,i.useState)(0);return(0,i.useEffect)(()=>{let e=l.current;if(!e)return;let t=new ResizeObserver(([e])=>r(Math.floor(e.contentRect.width)));return t.observe(e),()=>t.disconnect()},[]),(0,t.jsx)("div",{ref:l,className:"w-full",style:{height:e.height},children:n>0&&(0,t.jsx)(s,{...e,width:n})})};e.s(["default",0,({fluid:e=!1,...i})=>e?(0,t.jsx)(l,{...i}):(0,t.jsx)(s,{...i})],37917)},77498,e=>{"use strict";var t=e.i(43476),i=e.i(71645);e.i(85269);var s=e.i(22831),l=e.i(85709),n=e.i(46991),r=e.i(14922),a=e.i(37917);let d=["navigation.speedOverGround","navigation.speedThroughWater"];e.s(["default",0,()=>{let{t:e}=(0,s.useTranslation)(),c=(0,l.useSignalKPaths)(d),u=c["navigation.speedOverGround"],h=c["navigation.speedThroughWater"],o=(0,i.useRef)(u),[x,m]=(0,i.useState)([]);(0,i.useEffect)(()=>{o.current=u},[u]),(0,i.useEffect)(()=>{let e=setInterval(()=>{let e=o.current;Number.isFinite(e)&&m(t=>[...t.slice(-119),e])},5e3);return()=>clearInterval(e)},[]);let f=(0,n.getSpeedUnitLabel)();if(!Number.isFinite(u))return(0,t.jsx)(r.default,{title:e("hud.speed"),className:"w-[17rem]",children:(0,t.jsx)("span",{className:"text-value font-semibold text-hud-muted",children:"--"})});let p=x.length?(0,n.convertSpeedUnit)(Math.max(...x,u)):null;return(0,t.jsxs)(r.default,{title:e("hud.speed"),className:"w-[17rem]",children:[(0,t.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,t.jsx)("span",{className:"text-value font-semibold text-hud-main",children:(0,n.convertSpeedUnit)(u)?.toFixed(1)}),(0,t.jsx)("span",{className:"text-caption text-hud-secondary",children:f}),Number.isFinite(h)&&(0,t.jsxs)("span",{className:"text-caption text-hud-secondary whitespace-nowrap",children:[e("hud.stw")," ",(0,n.convertSpeedUnit)(h)?.toFixed(1)]}),Number.isFinite(p)&&(0,t.jsx)("span",{className:"text-caption text-hud-muted whitespace-nowrap",children:e("hud.best",{value:p.toFixed(1)})})]}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(a.default,{values:x,width:240,height:48,endDot:!0,color:"var(--color-oGreen)"})}),(0,t.jsx)("div",{className:"text-caption text-hud-muted mt-1",children:e("hud.depthHistory")})]})}])},64587,function(e){e.n(e.i(77498))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5445,t=>{"use strict";var e=t.i(71645),i=t.i(18566),a=t.i(83402);t.s(["default",0,function(){let t=(0,i.useRouter)();return(0,e.useEffect)(()=>{a.default.setCurrentView("settings"),t.replace("/")},[t]),null}])},18566,(t,e,i)=>{e.exports=t.r(76562)},79866,(t,e,i)=>{e.exports={boats:[{name:"Racer 10.8",modelPath:"racer",capabilities:["navigation","sail","color"]},{name:"Catamaran 14",modelPath:"catamaran",capabilities:["navigation","sail","color"]},{name:"Sailboat",modelPath:"default",capabilities:["navigation","rudder","sail","color"]},{name:"Ship",modelPath:"ship",capabilities:["navigation","ais"]},{name:"Windsurf",modelPath:"windsurf",capabilities:["navigation","ais"]},{name:"Wing foil",modelPath:"wingfoil",capabilities:["navigation","ais"]}]}},83402,t=>{"use strict";var e=t.i(79866);let i=new class{constructor(){this.defaultConfig={signalkUrl:"http://localhost:3000",username:"",password:"",useAuthentication:!1,signalKUrlSet:!1,debugMode:!1,selectedBoat:"Racer 10.8",primaryColor:null,metallicEffect:!1,aisLengthScalingFactor:.7,compassNorthUp:!1,hide3DCompass:!1,hideTrueWind:!1,showCustomUrls:!1,customExternalUrls:{},currentView:"default",theme:"dark",language:"en",distanceUnits:"nm",depthUnits:"m",speedUnits:"kn",temperatureUnits:"C",positionFormat:"DD",preferTrueValues:!0,preferredWindSpeedPath:"speedTrue",preferredWindDirectionPath:"directionTrue",preferredHeadingPath:"courseOverGroundTrue",debugWindOverride:!1,debugWindSpeed:10,debugWindDirection:0,debugShowAxes:!1,showSailTrimSliders:!0,showRigging:!0,showSeamarks3D:!0,seamarksOverpass:!0,staleDataTimeout:30},this.configKey="ocearoConfig",this.inMemoryConfig={...this.defaultConfig},this.config=this.loadConfig()}isLocalStorageAvailable(){try{return"u">typeof localStorage}catch{return!1}}loadConfig(){if(this.isLocalStorageAvailable()){let t=localStorage.getItem(this.configKey);if(!t)return this.saveConfig(this.defaultConfig),{...this.defaultConfig};try{let e={...this.defaultConfig,...JSON.parse(t)};return(e.boatChosen||"Default"!==e.selectedBoat)&&"RM1080"!==e.selectedBoat&&"Optimist"!==e.selectedBoat||(e.selectedBoat="Racer 10.8"),"Default"===e.selectedBoat&&(e.selectedBoat="Sailboat"),e}catch(t){return console.error("Failed to parse stored configuration:",t),{...this.defaultConfig}}}return{...this.inMemoryConfig}}saveConfig(t){this.config={...this.config,...t},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.config}}get(t){return this.config[t]}set(t,e){this.config[t]=e,this.saveConfig(this.config)}resetConfig(){this.config={...this.defaultConfig},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.defaultConfig}}getAll(){return{...this.config}}getDefaultConfig(){return{...this.defaultConfig}}getSelectedBoat(){let t=this.config.selectedBoat;return t?this.getBoatsData().find(e=>e.name===t):null}getBoatsData(){return e.default.boats}getSignalKUrl(){return this.config.signalKUrlSet&&this.config.signalkUrl?this.normalizeSignalKUrl(this.config.signalkUrl):this.getComputedSignalKUrl()}normalizeSignalKUrl(t){let e=String(t).trim().replace(/\/+$/,"");if(!e)return e;e=e.replace(/^wss:\/\//i,"https://").replace(/^ws:\/\//i,"http://");let i="https:"===window.location.protocol;return/^https?:\/\//i.test(e)||(e=`${i?"https":"http"}://${e}`),e=e.replace(/^https?:/i,t=>t.toLowerCase()),i&&e.startsWith("http://")&&(e="https://"+e.slice(7).replace(/:80(?=\/|$)/,"")),e}getComputedSignalKUrl(){return this.config.debugMode?"https://demo.signalk.org:443":`${window.location.protocol}//${window.location.hostname}${window.location.port?":"+window.location.port:""}`}getCurrentView(){return this.config.currentView||this.defaultConfig.currentView}setCurrentView(t){this.set("currentView",t)}};t.s(["default",0,i])}]);
|