@rr0/ufoathome 0.185.3 → 0.187.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.
Files changed (165) hide show
  1. package/dist-embed-scene/{AdsbLolArchiveProvider-CzTJVwX_.js → AdsbLolArchiveProvider-DdUpO-EA.js} +1 -1
  2. package/dist-embed-scene/{BeamEditor-B1rrWZ8t.js → BeamEditor-RO5pPyvd.js} +1 -1
  3. package/dist-embed-scene/BeamSystem-Ab_wCPf_.js +1 -0
  4. package/dist-embed-scene/BirdKindMessages_en-c_-L7frF.js +1 -0
  5. package/dist-embed-scene/BirdKindMessages_es-8Zo2t0o4.js +1 -0
  6. package/dist-embed-scene/BirdKindMessages_fr-C1TuqqEj.js +1 -0
  7. package/dist-embed-scene/BirdKindMessages_it-DQZcrCkf.js +1 -0
  8. package/dist-embed-scene/ContrailSystem-BYqjhyyF.js +1 -0
  9. package/dist-embed-scene/ControlPasses-BZIhjZfW.js +29 -0
  10. package/dist-embed-scene/FlareKindMessages_en-j3CY_TxX.js +1 -0
  11. package/dist-embed-scene/FlareKindMessages_es-CZgrFIOO.js +1 -0
  12. package/dist-embed-scene/FlareKindMessages_fr-B2MezoN2.js +1 -0
  13. package/dist-embed-scene/FlareKindMessages_it-CmZmb3RP.js +1 -0
  14. package/dist-embed-scene/{Flightradar24Provider-ae0_oe2g.js → Flightradar24Provider-DnJbUJ3f.js} +1 -1
  15. package/dist-embed-scene/GLTFLoader-BmUyASZK.js +1 -0
  16. package/dist-embed-scene/HeadlightSystem-DOQSyusn.js +34 -0
  17. package/dist-embed-scene/{LanternEditor-DbaHa2ey.js → LanternEditor-B6YtPdnz.js} +1 -1
  18. package/dist-embed-scene/LanternKindMessages_en-CQXdJ-k6.js +1 -0
  19. package/dist-embed-scene/LanternKindMessages_es-BOO6kPjs.js +1 -0
  20. package/dist-embed-scene/LanternKindMessages_fr-D7tQa_tQ.js +1 -0
  21. package/dist-embed-scene/LanternKindMessages_it-B8J-29Mj.js +1 -0
  22. package/dist-embed-scene/{LaserBeam-DW1f0LPn.js → LaserBeam-BS0xtrAx.js} +1 -1
  23. package/dist-embed-scene/{LaunchEditor-M8G5W83U.js → LaunchEditor-C6-Ovt8V.js} +1 -1
  24. package/dist-embed-scene/{LaunchPlume-BtEO63Vx.js → LaunchPlume-GdjoMQQa.js} +1 -1
  25. package/dist-embed-scene/{LaunchSimulation-xgRnC8OK.js → LaunchSimulation-C_x89oL_.js} +1 -1
  26. package/dist-embed-scene/{ModuleSession-BGUJHOk9.js → ModuleSession-CwJVkcpn.js} +2 -2
  27. package/dist-embed-scene/ModuleThree-BHjFJ_bC.js +1 -0
  28. package/dist-embed-scene/{ParameterForm-DMplRkcQ.js → ParameterForm-BEITBqB0.js} +1 -1
  29. package/dist-embed-scene/{RailwaySystem-C3Y0a9aT.js → RailwaySystem-8h9OGJkr.js} +1 -1
  30. package/dist-embed-scene/{ReentryEditor-FFxrv4q7.js → ReentryEditor-BAC0cNg_.js} +1 -1
  31. package/dist-embed-scene/{ReentrySimulation-xFQ_R53U.js → ReentrySimulation-DCNhQGDE.js} +1 -1
  32. package/dist-embed-scene/ReferenceSystem-BTDpVH4u.js +1 -0
  33. package/dist-embed-scene/{RoadMarkings-C3oJCHLk.js → RoadMarkings-DAs6evab.js} +1 -1
  34. package/dist-embed-scene/{SceneNames_en-CIzANCLW.js → SceneNames_en-BLm2h3zy.js} +1 -1
  35. package/dist-embed-scene/{SceneNames_es-DntR6o9V.js → SceneNames_es-DrJ24RvP.js} +1 -1
  36. package/dist-embed-scene/{SceneNames_fr-7wmERMPd.js → SceneNames_fr-CddH0oWD.js} +1 -1
  37. package/dist-embed-scene/{SceneNames_it-Bxtenoxp.js → SceneNames_it-DL3AbXlk.js} +1 -1
  38. package/dist-embed-scene/{TimelineTracks-CZBILU3f.js → TimelineTracks-B73gWzRB.js} +1 -1
  39. package/dist-embed-scene/{TraceSystem-BD6YpW6g.js → TraceSystem-vEBDgerB.js} +2 -2
  40. package/dist-embed-scene/{UfoMessages_en-AS8tBKJW.js → UfoMessages_en-BzK4iS9N.js} +1 -1
  41. package/dist-embed-scene/WaterSystem-QZGlpcQ7.js +19 -0
  42. package/dist-embed-scene/rr0-scene.mjs +271 -265
  43. package/dist-embed-scene/{sightingSchema-B8Xs45w9.js → sightingSchema-Dz2hCtcS.js} +1 -1
  44. package/dist-embed-sighting/{AdsbLolArchiveProvider-D9EKDsic.js → AdsbLolArchiveProvider-BYOz5Wdl.js} +1 -1
  45. package/dist-embed-sighting/{BeamEditor-Cod7HUNj.js → BeamEditor-mDSavUYe.js} +2 -2
  46. package/dist-embed-sighting/BeamSystem-5WJWP1Ad.js +1 -0
  47. package/dist-embed-sighting/BirdKindMessages_en-c_-L7frF.js +1 -0
  48. package/dist-embed-sighting/BirdKindMessages_es-8Zo2t0o4.js +1 -0
  49. package/dist-embed-sighting/BirdKindMessages_fr-C1TuqqEj.js +1 -0
  50. package/dist-embed-sighting/BirdKindMessages_it-DQZcrCkf.js +1 -0
  51. package/dist-embed-sighting/{CaseReportExport-lbuI40c8.js → CaseReportExport-B9N0s2JX.js} +1 -1
  52. package/dist-embed-sighting/ContrailSystem-C1pCwq7H.js +1 -0
  53. package/dist-embed-sighting/ControlPasses-B78JMfGN.js +29 -0
  54. package/dist-embed-sighting/FlareKindMessages_en-j3CY_TxX.js +1 -0
  55. package/dist-embed-sighting/FlareKindMessages_es-CZgrFIOO.js +1 -0
  56. package/dist-embed-sighting/FlareKindMessages_fr-B2MezoN2.js +1 -0
  57. package/dist-embed-sighting/FlareKindMessages_it-CmZmb3RP.js +1 -0
  58. package/dist-embed-sighting/{Flightradar24Provider-DQ-bvlMM.js → Flightradar24Provider-RjrQ963H.js} +1 -1
  59. package/dist-embed-sighting/GLTFLoader-BrNCkGT3.js +1 -0
  60. package/dist-embed-sighting/{HeadlightSystem-B4RR270O.js → HeadlightSystem-LMaOhpkj.js} +1 -1
  61. package/dist-embed-sighting/{LanternEditor-9zPknaGj.js → LanternEditor-Czo3tup9.js} +1 -1
  62. package/dist-embed-sighting/LanternKindMessages_en-CQXdJ-k6.js +1 -0
  63. package/dist-embed-sighting/LanternKindMessages_es-BOO6kPjs.js +1 -0
  64. package/dist-embed-sighting/LanternKindMessages_fr-D7tQa_tQ.js +1 -0
  65. package/dist-embed-sighting/LanternKindMessages_it-B8J-29Mj.js +1 -0
  66. package/dist-embed-sighting/{LaserBeam-CFUYJu2F.js → LaserBeam-BuVmy_0s.js} +1 -1
  67. package/dist-embed-sighting/{LaunchEditor-GiZERDOz.js → LaunchEditor-DZ2V0dHc.js} +1 -1
  68. package/dist-embed-sighting/{LaunchPlume-CuDQMA8K.js → LaunchPlume-Quo7JzI8.js} +1 -1
  69. package/dist-embed-sighting/LaunchSimulation-DZ4pDnrh.js +1 -0
  70. package/dist-embed-sighting/{ModuleSession-CY6DsJx0.js → ModuleSession-xCJtw_IT.js} +2 -2
  71. package/dist-embed-sighting/ModuleThree-D1QGUDll.js +1 -0
  72. package/dist-embed-sighting/{ParameterForm-BHITM-mQ.js → ParameterForm-GKeZmZAL.js} +4 -4
  73. package/dist-embed-sighting/RailwaySystem-m2A18WjN.js +41 -0
  74. package/dist-embed-sighting/{ReentryEditor-C_AN8aTr.js → ReentryEditor-CnYz3Q7Q.js} +2 -2
  75. package/dist-embed-sighting/{ReentrySimulation-sBnymskP.js → ReentrySimulation-BnYP6UwW.js} +1 -1
  76. package/dist-embed-sighting/ReferenceSystem-C1iPC-1U.js +1 -0
  77. package/dist-embed-sighting/{TimelineTracks-B7EcGLEf.js → TimelineTracks-BjJwL-DC.js} +1 -1
  78. package/dist-embed-sighting/{TraceSystem-BkUPo1Xf.js → TraceSystem-ZNrHrAPL.js} +2 -2
  79. package/dist-embed-sighting/WaterSystem-BtEY0XLc.js +19 -0
  80. package/dist-embed-sighting/rr0-sighting.mjs +248 -242
  81. package/dist-embed-sighting/{sightingSchema-B8Xs45w9.js → sightingSchema-Dz2hCtcS.js} +1 -1
  82. package/dist-embed-sighting-editor/BirdKindMessages_en-c_-L7frF.js +1 -0
  83. package/dist-embed-sighting-editor/BirdKindMessages_es-8Zo2t0o4.js +1 -0
  84. package/dist-embed-sighting-editor/BirdKindMessages_fr-C1TuqqEj.js +1 -0
  85. package/dist-embed-sighting-editor/BirdKindMessages_it-DQZcrCkf.js +1 -0
  86. package/dist-embed-sighting-editor/{CaseReportExport-QyaWB9n9.js → CaseReportExport-RjSpSvFT.js} +1 -1
  87. package/dist-embed-sighting-editor/{ControlPasses-BsZQ-_CW.js → ControlPasses-D9A8NPRi.js} +1 -1
  88. package/dist-embed-sighting-editor/FlareKindMessages_en-j3CY_TxX.js +1 -0
  89. package/dist-embed-sighting-editor/FlareKindMessages_es-CZgrFIOO.js +1 -0
  90. package/dist-embed-sighting-editor/FlareKindMessages_fr-B2MezoN2.js +1 -0
  91. package/dist-embed-sighting-editor/FlareKindMessages_it-CmZmb3RP.js +1 -0
  92. package/dist-embed-sighting-editor/{GLTFLoader-D7spTlJl.js → GLTFLoader-GAmboVFk.js} +1 -1
  93. package/dist-embed-sighting-editor/{HeadlightSystem-DZN_EX7x.js → HeadlightSystem-CDAFEIP8.js} +1 -1
  94. package/dist-embed-sighting-editor/{InterviewEditorElement-CD-k5bQB.js → InterviewEditorElement-Bq8INvJ8.js} +2 -2
  95. package/dist-embed-sighting-editor/LanternKindMessages_en-CQXdJ-k6.js +1 -0
  96. package/dist-embed-sighting-editor/LanternKindMessages_es-BOO6kPjs.js +1 -0
  97. package/dist-embed-sighting-editor/LanternKindMessages_fr-D7tQa_tQ.js +1 -0
  98. package/dist-embed-sighting-editor/LanternKindMessages_it-B8J-29Mj.js +1 -0
  99. package/dist-embed-sighting-editor/{ModuleConformance-D7QNv2-c.js → ModuleConformance-Qm-EHVoc.js} +2 -2
  100. package/dist-embed-sighting-editor/{ModuleSession-DTZs4At5.js → ModuleSession-BZ3xmE8Y.js} +2 -2
  101. package/dist-embed-sighting-editor/ModuleThree-BFSbIe18.js +1 -0
  102. package/dist-embed-sighting-editor/{ModulesPanelElement-9x7kP_Tx.js → ModulesPanelElement-DuyRnhEj.js} +3 -3
  103. package/dist-embed-sighting-editor/{RailwaySystem-BxHS7Jka.js → RailwaySystem-DG0WQQfc.js} +1 -1
  104. package/dist-embed-sighting-editor/{ReferenceSystem-ZQRGSWgC.js → ReferenceSystem-DMmt1GR2.js} +1 -1
  105. package/dist-embed-sighting-editor/{SightingFileEditor-BXWkp08k.js → SightingFileEditor-6F5VGGUe.js} +1 -1
  106. package/dist-embed-sighting-editor/{TraceSystem-DAa5Lzof.js → TraceSystem-eEbqZeYs.js} +1 -1
  107. package/dist-embed-sighting-editor/WaterSystem-CbmcniYb.js +19 -0
  108. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +220 -214
  109. package/dist-embed-sighting-editor/{sightingSchema-B8Xs45w9.js → sightingSchema-Dz2hCtcS.js} +1 -1
  110. package/package.json +1 -1
  111. package/dist-embed-scene/BeamSystem-BxfhSMvb.js +0 -1
  112. package/dist-embed-scene/BirdKindMessages_en-DvojmvJ5.js +0 -1
  113. package/dist-embed-scene/BirdKindMessages_es-CTyGOBqo.js +0 -1
  114. package/dist-embed-scene/BirdKindMessages_fr-DqcvqMrp.js +0 -1
  115. package/dist-embed-scene/BirdKindMessages_it-CIRyyI_k.js +0 -1
  116. package/dist-embed-scene/ContrailSystem-Bn--uCNU.js +0 -1
  117. package/dist-embed-scene/ControlPasses-X_kTXa-p.js +0 -29
  118. package/dist-embed-scene/FlareKindMessages_en-BroHgiwr.js +0 -1
  119. package/dist-embed-scene/FlareKindMessages_es-SraQyQ3Y.js +0 -1
  120. package/dist-embed-scene/FlareKindMessages_fr-Dy5SlSna.js +0 -1
  121. package/dist-embed-scene/FlareKindMessages_it-CF39wmrC.js +0 -1
  122. package/dist-embed-scene/GLTFLoader-CZ-8eVJ4.js +0 -1
  123. package/dist-embed-scene/HeadlightSystem-l2XbBvXf.js +0 -34
  124. package/dist-embed-scene/LanternKindMessages_en-fUfoRYC0.js +0 -1
  125. package/dist-embed-scene/LanternKindMessages_es-Chyc607D.js +0 -1
  126. package/dist-embed-scene/LanternKindMessages_fr-CDem7PTY.js +0 -1
  127. package/dist-embed-scene/LanternKindMessages_it-yOojym1u.js +0 -1
  128. package/dist-embed-scene/ModuleThree-BljKXj42.js +0 -1
  129. package/dist-embed-scene/ReferenceSystem-Dyc08-lR.js +0 -1
  130. package/dist-embed-scene/WaterSystem-DbyWlKho.js +0 -1
  131. package/dist-embed-sighting/BeamSystem-BZ2f4hh1.js +0 -1
  132. package/dist-embed-sighting/BirdKindMessages_en-DvojmvJ5.js +0 -1
  133. package/dist-embed-sighting/BirdKindMessages_es-CTyGOBqo.js +0 -1
  134. package/dist-embed-sighting/BirdKindMessages_fr-DqcvqMrp.js +0 -1
  135. package/dist-embed-sighting/BirdKindMessages_it-CIRyyI_k.js +0 -1
  136. package/dist-embed-sighting/ContrailSystem-CqpZgLkb.js +0 -1
  137. package/dist-embed-sighting/ControlPasses-BnlLorfW.js +0 -29
  138. package/dist-embed-sighting/FlareKindMessages_en-BroHgiwr.js +0 -1
  139. package/dist-embed-sighting/FlareKindMessages_es-SraQyQ3Y.js +0 -1
  140. package/dist-embed-sighting/FlareKindMessages_fr-Dy5SlSna.js +0 -1
  141. package/dist-embed-sighting/FlareKindMessages_it-CF39wmrC.js +0 -1
  142. package/dist-embed-sighting/GLTFLoader-DPrksej_.js +0 -1
  143. package/dist-embed-sighting/LanternKindMessages_en-fUfoRYC0.js +0 -1
  144. package/dist-embed-sighting/LanternKindMessages_es-Chyc607D.js +0 -1
  145. package/dist-embed-sighting/LanternKindMessages_fr-CDem7PTY.js +0 -1
  146. package/dist-embed-sighting/LanternKindMessages_it-yOojym1u.js +0 -1
  147. package/dist-embed-sighting/LaunchSimulation-Fpwvzpf1.js +0 -1
  148. package/dist-embed-sighting/ModuleThree-EigESy50.js +0 -1
  149. package/dist-embed-sighting/RailwaySystem-C1nfRJfj.js +0 -41
  150. package/dist-embed-sighting/ReferenceSystem-Cn6gWxGT.js +0 -1
  151. package/dist-embed-sighting/WaterSystem-DrSAhM5g.js +0 -1
  152. package/dist-embed-sighting-editor/BirdKindMessages_en-DvojmvJ5.js +0 -1
  153. package/dist-embed-sighting-editor/BirdKindMessages_es-CTyGOBqo.js +0 -1
  154. package/dist-embed-sighting-editor/BirdKindMessages_fr-DqcvqMrp.js +0 -1
  155. package/dist-embed-sighting-editor/BirdKindMessages_it-CIRyyI_k.js +0 -1
  156. package/dist-embed-sighting-editor/FlareKindMessages_en-BroHgiwr.js +0 -1
  157. package/dist-embed-sighting-editor/FlareKindMessages_es-SraQyQ3Y.js +0 -1
  158. package/dist-embed-sighting-editor/FlareKindMessages_fr-Dy5SlSna.js +0 -1
  159. package/dist-embed-sighting-editor/FlareKindMessages_it-CF39wmrC.js +0 -1
  160. package/dist-embed-sighting-editor/LanternKindMessages_en-fUfoRYC0.js +0 -1
  161. package/dist-embed-sighting-editor/LanternKindMessages_es-Chyc607D.js +0 -1
  162. package/dist-embed-sighting-editor/LanternKindMessages_fr-CDem7PTY.js +0 -1
  163. package/dist-embed-sighting-editor/LanternKindMessages_it-yOojym1u.js +0 -1
  164. package/dist-embed-sighting-editor/ModuleThree-COSQVAvF.js +0 -1
  165. package/dist-embed-sighting-editor/WaterSystem-C7hE-tnY.js +0 -1
@@ -1,41 +0,0 @@
1
- import{G as F,K as P,C as H,m as K,E as w,N,x as U,Q as k}from"./rr0-sighting.mjs";class b{static HOLLOW_M=1;static COVERED_M=3;static WINDOW_M=30;static SAMPLE_M=4;static MAX_GRADE={rail:.025,highSpeed:.035,subway:.04,light_rail:.06,tram:.08,funicular:1/0};static heights(t,s,e){const n=t.map(a=>a.level===0),o=t.map((a,i)=>n[i]?b.targets(a,s,e):[]),c=t.map((a,i)=>n[i]?b.samples(a,o[i]):[]),r=new Map;t.forEach((a,i)=>{if(n[i])for(const h of b.ends(a)){const u=b.key(h),p=r.get(u);p?p.push(i):r.set(u,[i])}});const M=a=>{const i=r.get(b.key(a));if(i)return b.median(i.flatMap(h=>c[h]),a)};return t.map((a,i)=>{if(n[i]){const h=[...new Set([i,...b.ends(a).flatMap(d=>r.get(b.key(d))??[])])].flatMap(d=>c[d]),u=a.centre.map((d,O)=>b.median(h,d)??o[i][O]),[p,A]=b.ends(a);return u[0]=M(p)??u[0],u[u.length-1]=M(A)??u[u.length-1],b.graded(u,a.along,a.highSpeed?b.MAX_GRADE.highSpeed:b.MAX_GRADE[a.kind])}return b.carried(a,s,e,M)})}static targets(t,s,e){return t.centre.map(n=>{const o=s(n.x,n.z);if(e===void 0||n.altitudeM===void 0)return o;const c=n.altitudeM+e;return c-o>b.HOLLOW_M||o-c>b.COVERED_M?c:o})}static samples(t,s){const e=[];let n=0;return t.centre.forEach((o,c)=>{t.along[c]+1e-6<n&&c<t.centre.length-1||(e.push({x:o.x,z:o.z,y:s[c]}),n=t.along[c]+b.SAMPLE_M)}),e}static median(t,s){const e=[];for(const o of t)Math.hypot(o.x-s.x,o.z-s.z)<=b.WINDOW_M&&e.push(o.y);if(e.length===0)return;e.sort((o,c)=>o-c);const n=e.length>>1;return e.length%2===1?e[n]:(e[n-1]+e[n])/2}static graded(t,s,e){if(!Number.isFinite(e)||t.length<3)return t;const n=[...t],o=n.length-1,c=s[o];if(Math.abs(n[o]-n[0])>e*c)return s.map(r=>n[0]+(n[o]-n[0])*r/c);for(let r=1;r<o;r++){const M=e*(s[r]-s[r-1]);n[r]=Math.min(n[r-1]+M,Math.max(n[r-1]-M,n[r]))}for(let r=o-1;r>0;r--){const M=e*(s[r+1]-s[r]);n[r]=Math.min(n[r+1]+M,Math.max(n[r+1]-M,n[r]))}return n}static carried(t,s,e,n){const[o,c]=b.ends(t),r=t.along[t.along.length-1],M=n(o),a=n(c);if(e!==void 0&&t.centre.every(u=>u.altitudeM!==void 0)){const u=t.centre.map(d=>d.altitudeM+e),p=M!==void 0?M-u[0]:0,A=a!==void 0?a-u[u.length-1]:0;return u.map((d,O)=>d+p+(A-p)*t.along[O]/r)}const i=M??s(o.x,o.z),h=a??s(c.x,c.z);return t.along.map(u=>i+(h-i)*u/r)}static ends(t){return[t.centre[0],t.centre[t.centre.length-1]]}static key(t){return`${Math.round(t.x*2)},${Math.round(t.z*2)}`}}class B{positions=[];indices=[];along=[];get vertexCount(){return this.positions.length/3}strip(t,s,e){const n=this.vertexCount;for(let o=0;o<t.length;o++)this.positions.push(t[o].x,t[o].y,t[o].z,s[o].x,s[o].y,s[o].z),e&&this.along.push(e[o],e[o]);for(let o=0;o<t.length-1;o++){const c=n+o*2;this.indices.push(c,c+2,c+1,c+1,c+2,c+3)}}beam(t,s,e,n=!0){const o=s.x-t.x,c=s.y-t.y,r=s.z-t.z,M=Math.hypot(o,c,r);if(M<1e-6)return;const a={x:o/M,y:c/M,z:r/M},i=Math.abs(a.y)>.9?{x:1,y:0,z:0}:{x:0,y:1,z:0},h=a.y*i.z-a.z*i.y,u=a.z*i.x-a.x*i.z,p=a.x*i.y-a.y*i.x,A=Math.hypot(h,u,p),d={x:h/A*e/2,y:u/A*e/2,z:p/A*e/2},O={x:a.y*d.z-a.z*d.y,y:a.z*d.x-a.x*d.z,z:a.x*d.y-a.y*d.x},g=(f,x,E)=>({x:f.x+d.x*x+O.x*E,y:f.y+d.y*x+O.y*E,z:f.z+d.z*x+O.z*E}),_=[[1,1],[-1,1],[-1,-1],[1,-1]];for(let f=0;f<4;f++){const[x,E]=_[f],[z,v]=_[(f+1)%4];this.quad(g(t,x,E),g(t,z,v),g(s,z,v),g(s,x,E))}n&&(this.quad(...[..._].reverse().map(([f,x])=>g(t,f,x))),this.quad(..._.map(([f,x])=>g(s,f,x))))}quad(t,s,e,n){const o=this.vertexCount;this.positions.push(t.x,t.y,t.z,s.x,s.y,s.z,e.x,e.y,e.z,n.x,n.y,n.z),this.indices.push(o,o+1,o+2,o,o+2,o+3)}}class l{static STEP_M=6;static BALLAST_HEIGHT_M=.5;static BALLAST_SLOPE=1.5;static BALLAST_SHOULDER_M=.45;static DECK_DEPTH_M=.8;static BANK_SLOPE=1.5;static SLEEPER_LENGTH_M=2.4;static SLEEPER_WIDTH_M=.29;static SLEEPER_SPACING_M=.6;static RAIL_HEAD_M=.072;static RAIL_HEIGHT_M=.18;static TRAM_RAIL_HEIGHT_M=.03;static LIFT_M=.06;static CATENARY={rail:{contactM:5.5,systemM:1.4,spanM:54,staggerM:.2},highSpeed:{contactM:5.08,systemM:1.4,spanM:63,staggerM:.2},service:{contactM:5.5,systemM:1.2,spanM:45,staggerM:.2},tram:{contactM:6,systemM:0,spanM:30,staggerM:.2}};static MESSENGER_SAG_M=.55;static MAST_SIDE_M=.26;static MAST_OFFSET_M=3.1;static MAST_ABOVE_M=.6;static CONTACT_DIAMETER_M=.012;static MESSENGER_DIAMETER_M=.011;static ARM_SIDE_M=.06;static TRACK_SPACING_M={rail:3.7,highSpeed:4.5,tram:3.1,subway:3.4,light_rail:3.4,funicular:3.2};static BALLAST_ALBEDO=[.17,.16,.15];static BANK_ALBEDO=[.085,.09,.05];static DECK_ALBEDO=[.26,.255,.24];static CONCRETE_ALBEDO=[.36,.35,.33];static WOOD_ALBEDO=[.07,.055,.045];static RUST_ALBEDO=[.085,.068,.058];static STEEL_ALBEDO=[.3,.31,.32];static COPPER_ALBEDO=[.09,.085,.07];static LINE_REACH_M=20;group=new F;stepM=l.STEP_M;drawn=0;laid=[];ballastMaterial=l.pebbled(l.lambert(l.BALLAST_ALBEDO,!0));earthMaterial=l.lambert(l.BANK_ALBEDO,!0);deckMaterial=l.lambert(l.DECK_ALBEDO,!1);concreteSleepers=l.sleeperMaterial(l.CONCRETE_ALBEDO);woodSleepers=l.sleeperMaterial(l.WOOD_ALBEDO);rustMaterial=l.lambert(l.RUST_ALBEDO,!0);headMaterial=new P({color:new H(.62,.62,.62),metalness:1,roughness:.28,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});steelMaterial=l.lambert(l.STEEL_ALBEDO,!1);wireMaterial=l.lambert(l.COPPER_ALBEDO,!1);constructor(){this.group.name="railways"}get count(){return this.drawn}setGroundSpacing(t){this.stepM=Number.isFinite(t)&&t>0?Math.min(l.STEP_M,Math.max(1.5,t/2)):l.STEP_M}set(t,s,e,n,o=1/0){this.clear();const r=t.map(p=>({line:p,path:p.points.map(A=>({...K(A.lat,A.lng,s,e),altitudeM:A.altitudeM}))})).filter(({line:p,path:A})=>p.level>=0&&l.within(A,o)),M=l.altitudeOffset(r,n),a=r.flatMap(({line:p,path:A})=>{const d=this.layoutOf(p,A);return d?[{line:p,layout:d}]:[]}),i=b.heights(a.map(({layout:p})=>p),n,M),h={ballast:new B,earth:new B,deck:new B,concrete:new B,wood:new B,rust:new B,head:new B,steel:new B,wire:new B};a.forEach(({line:p,layout:A},d)=>{this.lay(p,{...A,y:i[d]},n,h),this.laid.push({line:p,centre:A.centre}),this.drawn++});const u=[[h.ballast,this.ballastMaterial,"ballast",!1],[h.earth,this.earthMaterial,"embankments",!1],[h.deck,this.deckMaterial,"decks",!0],[h.concrete,this.concreteSleepers,"sleepers",!1],[h.wood,this.woodSleepers,"sleepers wood",!1],[h.rust,this.rustMaterial,"rails",!1],[h.head,this.headMaterial,"rail heads",!1],[h.steel,this.steelMaterial,"catenary masts",!0],[h.wire,this.wireMaterial,"catenary wires",!1]];for(const[p,A,d,O]of u){const g=l.meshOf(p,A);g&&(g.name=`railways ${d}`,g.castShadow=O,g.receiveShadow=!0,this.group.add(g))}}clear(){for(const t of[...this.group.children])this.group.remove(t),t.geometry?.dispose();this.drawn=0,this.laid=[]}lineAt(t,s){let e;for(const{line:n,centre:o}of this.laid)for(let c=0;c<o.length-1;c++){const r=o[c],M=o[c+1],a=M.x-r.x,i=M.z-r.z,h=a*a+i*i,u=h===0?0:Math.max(0,Math.min(1,((t-r.x)*a+(s-r.z)*i)/h)),p=Math.hypot(t-(r.x+a*u),s-(r.z+i*u));p<=l.LINE_REACH_M&&(!e||p<e.distance)&&(e={line:n,distance:p})}return e?.line}mayMeet(t,s,e,n){const o=Math.hypot(s.x,s.z);if(o<1e-6)return this.lineAt(t.x,t.z)!==void 0;const c=s.x/o,r=s.z/o,M=l.LINE_REACH_M;for(const{centre:a}of this.laid)for(let i=0;i<a.length-1;i++){const h=a[i],u=a[i+1];for(const p of[0,.5,1]){const A=h.x+(u.x-h.x)*p,d=h.z+(u.z-h.z)*p,O=(A-t.x)*c+(d-t.z)*r;if(O<0)continue;const g=Math.abs((A-t.x)*r-(d-t.z)*c),_=Math.hypot(u.x-h.x,u.z-h.z)/2;if(g>M+_)continue;if(t.y+s.y*(O/o)<=e(A,d)+n)return!0}}return!1}contactHeightM(t){if(!(t.electrification!=="overhead"||t.kind==="subway"||t.kind==="funicular"))return l.catenaryOf(t).contactM}static catenaryOf(t){return t.kind==="tram"?l.CATENARY.tram:t.highSpeed?l.CATENARY.highSpeed:t.service?l.CATENARY.service:l.CATENARY.rail}dispose(){this.clear();for(const t of[this.ballastMaterial,this.earthMaterial,this.deckMaterial,this.concreteSleepers,this.woodSleepers,this.rustMaterial,this.headMaterial,this.steelMaterial,this.wireMaterial])t.dispose()}static within(t,s){if(!Number.isFinite(s))return!0;const e=s*1.1+100;return t.some((n,o)=>Math.hypot(n.x,n.z)<=e||o>0&&Math.hypot((n.x+t[o-1].x)/2,(n.z+t[o-1].z)/2)<=e)}static altitudeOffset(t,s){const e=[];for(const{line:n,path:o}of t)if(n.level===0)for(const c of o)c.altitudeM!==void 0&&e.push(s(c.x,c.z)-c.altitudeM);if(!(e.length<5))return e.sort((n,o)=>n-o),e[Math.floor(e.length/2)]}layoutOf(t,s){const e=[];for(let c=0;c<s.length-1;c++){const r=s[c],M=s[c+1],a=Math.max(1,Math.ceil(Math.hypot(M.x-r.x,M.z-r.z)/this.stepM));for(let i=0;i<a;i++){const h=i/a,u=r.altitudeM!==void 0&&M.altitudeM!==void 0?r.altitudeM+(M.altitudeM-r.altitudeM)*h:void 0;e.push({x:r.x+(M.x-r.x)*h,z:r.z+(M.z-r.z)*h,altitudeM:u})}}if(e.push(s[s.length-1]),e.length<2)return;const n=[0];for(let c=1;c<e.length;c++)n.push(n[c-1]+Math.hypot(e[c].x-e[c-1].x,e[c].z-e[c-1].z));if(n[n.length-1]<.5)return;const o=e.map((c,r)=>{const M=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],i=a.x-M.x,h=a.z-M.z,u=Math.hypot(i,h);return u<1e-6?{x:1,z:0}:{x:i/u,z:h/u}});return{kind:t.kind,...t.highSpeed?{highSpeed:!0}:{},level:t.level,centre:e,along:n,dir:o}}lay(t,s,e,n){const o=t.highSpeed?l.TRACK_SPACING_M.highSpeed:l.TRACK_SPACING_M[t.kind],c=Math.min(8,Math.max(1,t.tracks)),r=Array.from({length:c},(g,_)=>(_-(c-1)/2)*o),M=t.kind==="tram",a=M?0:l.BALLAST_HEIGHT_M,i=l.LIFT_M,h=(g,_,f)=>({x:s.centre[g].x-s.dir[g].z*_,y:s.y[g]+f,z:s.centre[g].z+s.dir[g].x*_}),u=s.centre.map((g,_)=>_);if(!M){const g=l.SLEEPER_LENGTH_M/2+l.BALLAST_SHOULDER_M+(r[r.length-1]??0),_=u.map(x=>h(x,g,a+i)),f=u.map(x=>h(x,-g,a+i));if(n.ballast.strip(_,f),t.level===0){const x=g+a*l.BALLAST_SLOPE;for(const E of[1,-1]){const z=[],v=[];let m=!1;for(const L of u){const C=h(L,E*x,i),S=e(C.x,C.z)+i,T=C.y-S;T<0&&(C.y=Math.min(S,s.y[L]+a-.05+i)),z.push(C);const I=h(L,E*(x+Math.max(0,T)*l.BANK_SLOPE),i);I.y=Math.min(e(I.x,I.z)+i,C.y),C.y-I.y>.02&&(m=!0),v.push(I)}const D=E>0?_:f;E>0?n.ballast.strip(z,D):n.ballast.strip(D,z),m&&(E>0?n.earth.strip(v,z):n.earth.strip(z,v))}}else{const x=-l.DECK_DEPTH_M,E=g+.15,z=u.map(L=>h(L,E,a+i+.1)),v=u.map(L=>h(L,-E,a+i+.1)),m=u.map(L=>h(L,E,x)),D=u.map(L=>h(L,-E,x));n.deck.strip(m,z),n.deck.strip(v,D),n.deck.strip(D,m),n.deck.strip(z,u.map(L=>h(L,g,a+i+.1))),n.deck.strip(u.map(L=>h(L,-g,a+i+.1)),v)}}const p=t.service?n.wood:n.concrete,A=t.gaugeMm/2e3+l.RAIL_HEAD_M/2,d=M?l.TRAM_RAIL_HEIGHT_M:l.RAIL_HEIGHT_M,O=a+i;for(const g of r){if(!M){const _=l.SLEEPER_LENGTH_M/2;p.strip(u.map(f=>h(f,g+_,O+.004)),u.map(f=>h(f,g-_,O+.004)),s.along)}for(const _ of[1,-1]){const f=g+_*A,x=l.RAIL_HEAD_M/2,E=u.map(v=>h(v,f+x,O+d)),z=u.map(v=>h(v,f-x,O+d));n.head.strip(E,z),n.rust.strip(u.map(v=>h(v,f+x,O)),E),n.rust.strip(z,u.map(v=>h(v,f-x,O)))}}t.electrification==="overhead"&&t.kind!=="subway"&&t.kind!=="funicular"&&this.catenary(t,s,r,O+d,h,e,n)}catenary(t,s,e,n,o,c,r){const M=l.catenaryOf(t),a=s.along[s.along.length-1],i=Math.max(1,Math.round(a/M.spanM)),h=a/i,u=Array.from({length:i},(E,z)=>(z+.5)*h),p=n+M.contactM,A=p+M.systemM,d=(M.systemM>0?A:p)+l.MAST_ABOVE_M,O=e[e.length-1],g=e.length>2,_=e.length===1?[1]:[1,-1],f=(E,z,v)=>{let m=0,D=s.along.length-2;for(;m<D;){const T=m+D+1>>1;s.along[T]<=E?m=T:D=T-1}const L=Math.min(1,Math.max(0,(E-s.along[m])/Math.max(1e-6,s.along[m+1]-s.along[m]))),C=o(m,z,v),S=o(m+1,z,v);return{x:C.x+(S.x-C.x)*L,y:C.y+(S.y-C.y)*L,z:C.z+(S.z-C.z)*L}};for(const E of u){const z=f(E,0,p);if(!(t.level===0&&c(z.x,z.z)>z.y)){for(const v of _){const m=v*(O+l.MAST_OFFSET_M),D=f(E,m,0);t.level===0&&(D.y=Math.min(D.y,c(D.x,D.z)));const L=f(E,m,d);if(r.steel.beam(D,L,l.MAST_SIDE_M),g)continue;const S=(_.length===1?e[0]:v*O)-v*.6,T=M.systemM>0?A:p+.3;r.steel.beam(f(E,m,T),f(E,S,T),l.ARM_SIDE_M),r.steel.beam(f(E,m,p-.4),f(E,S,T),l.ARM_SIDE_M)}if(g){const v=O+l.MAST_OFFSET_M;r.steel.beam(f(E,v,d-.2),f(E,-v,d-.2),l.MAST_SIDE_M*.8)}}}const x=[0,...u,a];for(const[E,z]of e.entries()){const v=m=>m===0||m===x.length-1?0:((m+E)%2===0?1:-1)*M.staggerM;for(let m=0;m<x.length-1;m++){const D=x[m],L=x[m+1];if(L-D<.1||(r.wire.beam(f(D,z+v(m),p),f(L,z+v(m+1),p),l.CONTACT_DIAMETER_M,!1),M.systemM<=0))continue;const C=4,S=T=>{const I=m===0?.5+T/2:m===x.length-2?T/2:T;return A-l.MESSENGER_SAG_M*4*I*(1-I)};for(let T=0;T<C;T++){const I=T/C,G=(T+1)/C;r.wire.beam(f(D+(L-D)*I,z,S(I)),f(D+(L-D)*G,z,S(G)),l.MESSENGER_DIAMETER_M,!1)}}}}static meshOf(t,s){if(t.indices.length===0)return;const e=new w;return e.setAttribute("position",new N(new Float32Array(t.positions),3)),t.along.length>0&&e.setAttribute("aAlong",new N(new Float32Array(t.along),1)),e.setIndex(new N(new Uint32Array(t.indices),1)),e.computeVertexNormals(),new U(e,s)}static lambert(t,s){return new k({color:new H(...t),...s?{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}:{}})}static pebbled(t){return t.onBeforeCompile=s=>{s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
2
- varying vec3 vBallast;`).replace("#include <begin_vertex>",`#include <begin_vertex>
3
- vBallast = position;`),s.fragmentShader=s.fragmentShader.replace("#include <common>",`#include <common>
4
- varying vec3 vBallast;
5
- float ballastHash(vec2 p) {
6
- p = fract(p * vec2(127.1, 311.7));
7
- p += dot(p, p + 34.5);
8
- return fract(p.x * p.y);
9
- }
10
- float ballastNoise(vec2 p) {
11
- vec2 i = floor(p);
12
- vec2 f = fract(p);
13
- f = f * f * (3.0 - 2.0 * f);
14
- return mix(mix(ballastHash(i), ballastHash(i + vec2(1.0, 0.0)), f.x), mix(ballastHash(i + vec2(0.0, 1.0)), ballastHash(i + vec2(1.0, 1.0)), f.x), f.y);
15
- }`).replace("#include <map_fragment>",`#include <map_fragment>
16
- {
17
- float eye = length(vViewPosition);
18
- vec2 at = vBallast.xz + vec2(0.0, vBallast.y);
19
- float stones = (ballastHash(floor(at * 22.0)) - 0.5) * 0.9 * (1.0 - smoothstep(4.0, 18.0, eye))
20
- + (ballastNoise(at * 6.0) - 0.5) * 0.5 * (1.0 - smoothstep(15.0, 60.0, eye))
21
- + (ballastNoise(at * 0.7) - 0.5) * 0.35 * (1.0 - smoothstep(80.0, 300.0, eye));
22
- diffuseColor.rgb *= 1.0 + stones;
23
- }`)},t.customProgramCacheKey=()=>"rr0-railway-ballast",t}static sleeperMaterial(t){const s=new k({color:new H(1,1,1),polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3}),e=new H(...t),n=new H(...l.BALLAST_ALBEDO);return s.onBeforeCompile=o=>{o.uniforms.uSleeper={value:e},o.uniforms.uCrib={value:n},o.uniforms.uSpacing={value:l.SLEEPER_SPACING_M},o.uniforms.uDuty={value:l.SLEEPER_WIDTH_M/l.SLEEPER_SPACING_M},o.vertexShader=o.vertexShader.replace("#include <common>",`#include <common>
24
- attribute float aAlong;
25
- varying float vAlong;`).replace("#include <begin_vertex>",`#include <begin_vertex>
26
- vAlong = aAlong;`),o.fragmentShader=o.fragmentShader.replace("#include <common>",`#include <common>
27
- varying float vAlong;
28
- uniform vec3 uSleeper;
29
- uniform vec3 uCrib;
30
- uniform float uSpacing;
31
- uniform float uDuty;
32
- // How much of [0, x] periods is sleeper: the integral of a pulse of width uDuty at the start of each period.
33
- float sleeperIntegral(float x) {
34
- return floor(x) * uDuty + min(fract(x), uDuty);
35
- }`).replace("#include <map_fragment>",`#include <map_fragment>
36
- {
37
- float u = vAlong / uSpacing;
38
- float w = max(fwidth(u), 1e-4);
39
- float cover = (sleeperIntegral(u + 0.5 * w) - sleeperIntegral(u - 0.5 * w)) / w;
40
- diffuseColor.rgb *= mix(uCrib, uSleeper, clamp(cover, 0.0, 1.0));
41
- }`)},s.customProgramCacheKey=()=>"rr0-railway-sleepers",s}}export{l as RailwaySystem};
@@ -1 +0,0 @@
1
- import{m as D,at as A,au as b,av as M,aw as p,ax as O,x as I,ah as x,ay as T,az as S,aA as N,aB as F}from"./rr0-sighting.mjs";class h{static SEEK_BEYOND_S=.25;static SAME_FRAME_S=1/60;static CATCH_UP_SHARE=.1;static MIN_RATE=.0625;static MAX_RATE=16;static rollOfPicture(t){return t&&-t}static kindOfSource(t){if(t.type?.startsWith("video/"))return"video";if(t.type?.startsWith("image/"))return"photo";const i=t.url??"";if(i.startsWith("data:video/")||/\.(mp4|m4v|webm|ogv|mov)(?:[?#].*)?$/i.test(i))return"video";if(i.startsWith("data:image/")||/\.(jpe?g|png|gif|webp|avif)(?:[?#].*)?$/i.test(i))return"photo"}static mediaSecondsAt(t,i,s,a){const e=t.video?.fromS??0,o=t.video?.toS??a??Number.POSITIVE_INFINITY,n=i-(t.t??0);if(n<0)return;const r=e+n/(h.positive(s)*1e3)*h.rateOf(t);return r<=o?r:void 0}static rateOf(t){return h.positive(t.video?.rate??1)}static registrationAt(t,i){const s=t.registration,a=t.registrationTrack;if(!a||a.length===0)return s;let e=a.findIndex(E=>E.t>i);e===-1&&(e=a.length);const o=a[Math.max(e-1,0)],n=a[Math.min(e,a.length-1)],r=n.t>o.t?Math.min(Math.max((i-o.t)/(n.t-o.t),0),1):0,c=((n.headingDeg-o.headingDeg)%360+540)%360-180,f=o.rollDeg??0,y=n.rollDeg??0,v=f+(y-f)*r,w=o.fovDeg??s.fovDeg;return{headingDeg:((o.headingDeg+c*r)%360+360)%360,pitchDeg:o.pitchDeg+(n.pitchDeg-o.pitchDeg)*r,rollDeg:v===0?void 0:v,fovDeg:w+((n.fovDeg??s.fovDeg)-w)*r}}static keyIndexAt(t,i){return(t.registrationTrack??[]).findIndex(s=>Math.abs(s.t-i)<20)}static withKey(t,i,s){const a={t:i,...s},e=h.keyIndexAt(t,i),n=[...(t.registrationTrack??[]).filter((r,c)=>c!==e),e>=0?{...a,t:t.registrationTrack[e].t}:a].sort((r,c)=>r.t-c.t);return{...t,registrationTrack:n,registration:h.plainOf(n[0],t.registration)}}static withoutKey(t,i){const s=h.keyIndexAt(t,i);if(s<0)return t;const a=t.registrationTrack.filter((e,o)=>o!==s);return a.length===0?{...t,registrationTrack:void 0}:{...t,registrationTrack:a,registration:h.plainOf(a[0],t.registration)}}static plainOf(t,i){return{headingDeg:t.headingDeg,pitchDeg:t.pitchDeg,rollDeg:t.rollDeg,fovDeg:t.fovDeg??i.fovDeg}}static command(t,i,s,a){const e=Math.min(Math.max(a,h.MIN_RATE),h.MAX_RATE),o=i-t;if(!s)return{seekS:Math.abs(o)>h.SAME_FRAME_S?i:void 0,play:!1,rate:e};if(Math.abs(o)>h.SEEK_BEYOND_S)return{seekS:i,play:!0,rate:e};const n=Math.min(Math.max(o/h.SEEK_BEYOND_S,-1),1)*h.CATCH_UP_SHARE;return{play:!0,rate:Math.min(Math.max(e*(1+n),h.MIN_RATE),h.MAX_RATE)}}static positive(t){return t>0?t:1}}class u extends Error{constructor(t,i){super(`${t}: ${i.kind==="status"?i.status:i.kind}`),this.src=t,this.failure=i}}class g{static async blob(t){let i;try{i=await fetch(t)}catch{throw new u(t,await g.whyUnread(t))}if(!i.ok)throw new u(t,{kind:"status",status:i.status});const s=await i.blob();if(s.type&&!s.type.startsWith("image/"))throw new u(t,{kind:"notPicture"});return s}static failureOf(t){return t instanceof u?t.failure:{kind:"notPicture"}}static async whyVideoUnread(t){if(t.startsWith("data:")||t.startsWith("blob:"))return{kind:"notVideo"};let i;try{i=await fetch(t,{method:"HEAD"})}catch{return g.whyUnread(t)}return i.ok?{kind:"notVideo"}:{kind:"status",status:i.status}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const k=3,m=800,l=Math.PI/180;class d{constructor(t,i,s=d.fetchImage,a=d.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=a}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=D(i.lat,i.lng,t.from.lat,t.from.lng),e=(Math.hypot(s.x,s.z)-d.PRESENT_WITHIN_M)/(d.GONE_BEYOND_M-d.PRESENT_WITHIN_M),o=Math.min(Math.max(e,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const a=new Set(t.map(e=>e.id));for(const[e,o]of this.meshes)a.has(e)||(this.dispose(o),this.meshes.delete(e),this.signatures.delete(e));for(const[e,o]of this.images){const n=t.find(c=>c.id===e);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;d.release(o),this.images.delete(e);const r=this.meshes.get(e);r&&(this.dispose(r),this.meshes.delete(e),this.signatures.delete(e))}for(const e of t){const o=this.images.get(e.id);if(!o){this.load(e);continue}this.build(e,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=k;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const a=i?.get(s);a&&s.quaternion.copy(this.cameraTurn).multiply(a),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new A;get furthestM(){return this.meshes.size>0?m:0}directionOfPixel(t,i,s,a){const e=this.images.get(t.id),o=e?e.width/e.height:1,n=h.registrationAt(t,this.clock.t),r=Math.tan(n.fovDeg/2*l),c=r*o;return a.set((i*2-1)*c,(1-s*2)*r,-1).normalize(),a.applyQuaternion(d.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&d.point(i,t,h.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const a=h.command(i.currentTime,s,this.clock.playing,h.rateOf(t));i.playbackRate=a.rate,a.seekS!==void 0&&!i.seeking&&(i.currentTime=a.seekS),a.play&&i.paused&&i.play().catch(()=>{}),!a.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",e=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(r=>r.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){d.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,g.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,e)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,a)=>{const e=document.createElement("video");e.crossOrigin="anonymous",e.muted=!0,e.playsInline=!0,e.preload="auto",e.addEventListener("loadeddata",()=>{const o=new b(e);o.colorSpace=M,o.minFilter=p,o.magFilter=p,o.generateMipmaps=!1,e.addEventListener("seeked",i);const n=()=>{e.paused&&i(),e.src&&e.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(n),s({texture:o,width:e.videoWidth,height:e.videoHeight,video:e})},{once:!0}),e.addEventListener("error",()=>{g.whyVideoUnread(t).then(o=>a(new u(t,o)))},{once:!0}),e.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await g.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new u(t,{kind:"notPicture"})}),a=new O(s);return a.flipY=!1,a.colorSpace=M,a.minFilter=p,a.magFilter=p,a.generateMipmaps=!1,a.needsUpdate=!0,{texture:a,width:s.width,height:s.height}}build(t,i){const s=d.signatureOf(t,i);let a=this.meshes.get(t.id);if(a&&this.signatures.get(t.id)===s){this.applyOpacity(a,t.id);return}a&&(this.dispose(a),this.meshes.delete(t.id)),a=new I(d.geometryOf(t,i),new x({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(a.material.side=T),a.frustumCulled=!1,a.layers.set(k),a.userData.id=t.id,d.point(a,t,h.registrationAt(t,this.clock.t)),this.scene.add(a),this.meshes.set(t.id,a),this.signatures.set(t.id,s),this.applyOpacity(a,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new S(m,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 s=2*m*Math.tan(t.registration.fovDeg/2*l),a=s*(i.width/Math.max(i.height,1)),e=new N(a,s);return e.translate(0,0,-m),e}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const a=new F;return a.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),a.quaternion}static point(t,i,s){if(t.quaternion.copy(d.orientation(s)),i.kind==="panorama")return;const a=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(a,a,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(e=>e.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),a=i?d.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*a}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:a,rollDeg:e,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,a,e??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())d.release(t);this.images.clear()}}export{k as REFERENCE_LAYER,d as ReferenceSystem};
@@ -1 +0,0 @@
1
- import{G as L,w as O,C as A,m as R,x as M,y as v,z as D,E as N,J as w}from"./rr0-sighting.mjs";class r{static LIFT_M=.05;static RENDER_ORDER=1.04;static LEVEL_QUANTILE=.2;static BODY_ALBEDO=[.035,.045,.04];static IOR=1.33;static ROUGHNESS=.08;static MAX_SAMPLES=48;group=new L;material=new O({color:new A(...r.BODY_ALBEDO),roughness:r.ROUGHNESS,metalness:0,ior:r.IOR,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});constructor(){this.group.name="water"}set(s,e,n,p,t,o){this.clear();for(const l of s){const f=l.rings.map(i=>r.clip(i.map(h=>R(h.lat,h.lng,e,n)),t)),a=f[0];if(!a||a.length<3)continue;const g=f.slice(1).filter(i=>i.length>=3),u=r.level(a,g,p,o);if(u===void 0)continue;const c=r.geometry(a,g,u+r.LIFT_M);if(!c)continue;const x=new M(c,this.material);x.name=`water ${l.id}`,x.renderOrder=r.RENDER_ORDER,x.receiveShadow=!0,this.group.add(x)}}get count(){return this.group.children.length}clear(){for(const s of[...this.group.children])s.geometry.dispose(),this.group.remove(s)}dispose(){this.clear(),this.material.dispose()}static level(s,e,n,p){const t=s.map(i=>i.x),o=s.map(i=>i.z),[l,f,a,g]=[Math.min(...t),Math.max(...t),Math.min(...o),Math.max(...o)],u=Math.max(p,(f-l)/r.MAX_SAMPLES,(g-a)/r.MAX_SAMPLES,.5),c=[];for(let i=a+u/2;i<g;i+=u)for(let h=l+u/2;h<f;h+=u){const z={x:h,z:i};if(!r.contains(s,z)||e.some(d=>r.contains(d,z)))continue;const E=n(h,i);Number.isFinite(E)&&c.push(E)}if(c.length===0)for(const i of s)c.push(n(i.x,i.z));const x=c.filter(Number.isFinite).sort((i,h)=>i-h);if(x.length!==0)return x[Math.floor((x.length-1)*r.LEVEL_QUANTILE)]}static clip(s,e){let n=s;const p=[{inside:t=>t.x>=-e,cross:(t,o)=>r.atX(t,o,-e)},{inside:t=>t.x<=e,cross:(t,o)=>r.atX(t,o,e)},{inside:t=>t.z>=-e,cross:(t,o)=>r.atZ(t,o,-e)},{inside:t=>t.z<=e,cross:(t,o)=>r.atZ(t,o,e)}];for(const t of p){const o=[];for(let l=0;l<n.length;l++){const f=n[l],a=n[(l+n.length-1)%n.length];t.inside(f)?(t.inside(a)||o.push(t.cross(a,f)),o.push(f)):t.inside(a)&&o.push(t.cross(a,f))}if(n=o,n.length===0)break}return n}static atX(s,e,n){return{x:n,z:s.z+(e.z-s.z)*(n-s.x)/(e.x-s.x)}}static atZ(s,e,n){return{x:s.x+(e.x-s.x)*(n-s.z)/(e.z-s.z),z:n}}static contains(s,e){let n=!1;for(let p=0,t=s.length-1;p<s.length;t=p++){const o=s[p],l=s[t];o.z>e.z!=l.z>e.z&&e.x<(l.x-o.x)*(e.z-o.z)/(l.z-o.z)+o.x&&(n=!n)}return n}static geometry(s,e,n){const p=c=>new v(c.x,c.z),t=s.map(p),o=e.map(c=>c.map(p)),l=D.triangulateShape(t,o);if(l.length===0)return;const f=[...t,...o.flat()],a=[];for(const[c,x,i]of l){const[h,z,E]=[f[c],f[x],f[i]],d=(z.y-h.y)*(E.x-h.x)-(z.x-h.x)*(E.y-h.y)>0;for(const m of d?[h,z,E]:[h,E,z])a.push(m.x,n,m.y)}const g=new N;g.setAttribute("position",new w(a,3));const u=new Float32Array(a.length);for(let c=1;c<u.length;c+=3)u[c]=1;return g.setAttribute("normal",new w(u,3)),g.computeBoundingSphere(),g}}export{r as WaterSystem};
@@ -1 +0,0 @@
1
- const e={title:"Birds"};export{e as birdKindMessages_en};
@@ -1 +0,0 @@
1
- const e={title:"Aves"};export{e as birdKindMessages_es};
@@ -1 +0,0 @@
1
- const e={title:"Oiseaux"};export{e as birdKindMessages_fr};
@@ -1 +0,0 @@
1
- const e={title:"Uccelli"};export{e as birdKindMessages_it};
@@ -1 +0,0 @@
1
- const e={title:"Decoy flares"};export{e as flareKindMessages_en};
@@ -1 +0,0 @@
1
- const e={title:"Bengalas señuelo"};export{e as flareKindMessages_es};
@@ -1 +0,0 @@
1
- const e={title:"Leurres pyrotechniques"};export{e as flareKindMessages_fr};
@@ -1 +0,0 @@
1
- const e={title:"Bengala esca"};export{e as flareKindMessages_it};
@@ -1 +0,0 @@
1
- const e={title:"Lanterns"};export{e as lanternKindMessages_en};
@@ -1 +0,0 @@
1
- const e={title:"Farolillos"};export{e as lanternKindMessages_es};
@@ -1 +0,0 @@
1
- const e={title:"Lanternes"};export{e as lanternKindMessages_fr};
@@ -1 +0,0 @@
1
- const e={title:"Lanterne"};export{e as lanternKindMessages_it};
@@ -1 +0,0 @@
1
- import{V as a,b1 as e,cd as s,bi as t,bk as r,bz as i,b9 as o,Q as n,bh as b,aQ as l,bI as c,bA as d,G as m,ce as u,ar as M,aD as B,ap as S,K as y,bZ as G,bW as f,b_ as h,am as p,cb as g,b3 as x,J as C,aE as D,cf as E,cg as L,ch as A,aS as P,bj as T,aB as F,aC as Q,ci as V,by as j,aF as k}from"./rr0-sighting-editor.mjs";const O={AdditiveBlending:k,BackSide:j,BoxGeometry:V,BufferAttribute:Q,BufferGeometry:F,CanvasTexture:T,Color:P,ConeGeometry:A,CylinderGeometry:L,DataTexture:E,DoubleSide:D,Euler:C,Float32BufferAttribute:x,FrontSide:g,Group:p,Line:h,LineBasicMaterial:f,LineSegments:G,Matrix4:y,Mesh:S,MeshBasicMaterial:B,MeshStandardMaterial:M,NormalBlending:u,Object3D:m,PlaneGeometry:d,PointLight:c,Points:l,PointsMaterial:b,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{O as MODULE_THREE};
@@ -1 +0,0 @@
1
- import{am as O,b0 as w,aS as A,n as R,ap as b,b1 as M,b2 as v,aB as B,b3 as L}from"./rr0-sighting-editor.mjs";class r{static LIFT_M=.05;static RENDER_ORDER=1.04;static LEVEL_QUANTILE=.2;static BODY_ALBEDO=[.035,.045,.04];static IOR=1.33;static ROUGHNESS=.08;static MAX_SAMPLES=48;group=new O;material=new w({color:new A(...r.BODY_ALBEDO),roughness:r.ROUGHNESS,metalness:0,ior:r.IOR,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});constructor(){this.group.name="water"}set(s,e,n,p,t,o){this.clear();for(const a of s){const f=a.rings.map(i=>r.clip(i.map(h=>R(h.lat,h.lng,e,n)),t)),l=f[0];if(!l||l.length<3)continue;const g=f.slice(1).filter(i=>i.length>=3),u=r.level(l,g,p,o);if(u===void 0)continue;const c=r.geometry(l,g,u+r.LIFT_M);if(!c)continue;const x=new b(c,this.material);x.name=`water ${a.id}`,x.renderOrder=r.RENDER_ORDER,x.receiveShadow=!0,this.group.add(x)}}get count(){return this.group.children.length}clear(){for(const s of[...this.group.children])s.geometry.dispose(),this.group.remove(s)}dispose(){this.clear(),this.material.dispose()}static level(s,e,n,p){const t=s.map(i=>i.x),o=s.map(i=>i.z),[a,f,l,g]=[Math.min(...t),Math.max(...t),Math.min(...o),Math.max(...o)],u=Math.max(p,(f-a)/r.MAX_SAMPLES,(g-l)/r.MAX_SAMPLES,.5),c=[];for(let i=l+u/2;i<g;i+=u)for(let h=a+u/2;h<f;h+=u){const z={x:h,z:i};if(!r.contains(s,z)||e.some(m=>r.contains(m,z)))continue;const d=n(h,i);Number.isFinite(d)&&c.push(d)}if(c.length===0)for(const i of s)c.push(n(i.x,i.z));const x=c.filter(Number.isFinite).sort((i,h)=>i-h);if(x.length!==0)return x[Math.floor((x.length-1)*r.LEVEL_QUANTILE)]}static clip(s,e){let n=s;const p=[{inside:t=>t.x>=-e,cross:(t,o)=>r.atX(t,o,-e)},{inside:t=>t.x<=e,cross:(t,o)=>r.atX(t,o,e)},{inside:t=>t.z>=-e,cross:(t,o)=>r.atZ(t,o,-e)},{inside:t=>t.z<=e,cross:(t,o)=>r.atZ(t,o,e)}];for(const t of p){const o=[];for(let a=0;a<n.length;a++){const f=n[a],l=n[(a+n.length-1)%n.length];t.inside(f)?(t.inside(l)||o.push(t.cross(l,f)),o.push(f)):t.inside(l)&&o.push(t.cross(l,f))}if(n=o,n.length===0)break}return n}static atX(s,e,n){return{x:n,z:s.z+(e.z-s.z)*(n-s.x)/(e.x-s.x)}}static atZ(s,e,n){return{x:s.x+(e.x-s.x)*(n-s.z)/(e.z-s.z),z:n}}static contains(s,e){let n=!1;for(let p=0,t=s.length-1;p<s.length;t=p++){const o=s[p],a=s[t];o.z>e.z!=a.z>e.z&&e.x<(a.x-o.x)*(e.z-o.z)/(a.z-o.z)+o.x&&(n=!n)}return n}static geometry(s,e,n){const p=c=>new M(c.x,c.z),t=s.map(p),o=e.map(c=>c.map(p)),a=v.triangulateShape(t,o);if(a.length===0)return;const f=[...t,...o.flat()],l=[];for(const[c,x,i]of a){const[h,z,d]=[f[c],f[x],f[i]],m=(z.y-h.y)*(d.x-h.x)-(z.x-h.x)*(d.y-h.y)>0;for(const E of m?[h,z,d]:[h,d,z])l.push(E.x,n,E.y)}const g=new B;g.setAttribute("position",new L(l,3));const u=new Float32Array(l.length);for(let c=1;c<u.length;c+=3)u[c]=1;return g.setAttribute("normal",new L(u,3)),g.computeBoundingSphere(),g}}export{r as WaterSystem};