@rr0/ufoathome 0.164.0 → 0.165.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 (188) hide show
  1. package/dist-embed-scene/{AdsbLolArchiveProvider-CO4IRthj.js → AdsbLolArchiveProvider-Cea0LAnZ.js} +1 -1
  2. package/dist-embed-scene/BeamEditor-DcUBLvPh.js +30 -0
  3. package/dist-embed-scene/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  4. package/dist-embed-scene/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  5. package/dist-embed-scene/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  6. package/dist-embed-scene/BeamEditorMessages_it-DVweRQFi.js +1 -0
  7. package/dist-embed-scene/BeamSystem-B80EaJKx.js +1 -0
  8. package/dist-embed-scene/{ContrailSystem-GO0Hkyj3.js → ContrailSystem-CcDlnjiD.js} +1 -1
  9. package/dist-embed-scene/GLTFLoader-YecOnQON.js +1 -0
  10. package/dist-embed-scene/{HeadlightSystem-DNMtQJ-Z.js → HeadlightSystem-B0Ubhwxs.js} +1 -1
  11. package/dist-embed-scene/LanternEditor-DQ9Y_eBl.js +9 -0
  12. package/dist-embed-scene/LanternEditorMessages_en-DaT3UNfD.js +1 -0
  13. package/dist-embed-scene/LanternEditorMessages_es-TDV5lKeJ.js +1 -0
  14. package/dist-embed-scene/LanternEditorMessages_fr-9mByTFMG.js +1 -0
  15. package/dist-embed-scene/LanternEditorMessages_it-MRkJnDQp.js +1 -0
  16. package/dist-embed-scene/LaserBeam-DXzWB-xk.js +1 -0
  17. package/dist-embed-scene/LaunchEditor-Csb2Pfq3.js +22 -0
  18. package/dist-embed-scene/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  19. package/dist-embed-scene/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  20. package/dist-embed-scene/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  21. package/dist-embed-scene/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  22. package/dist-embed-scene/LaunchPlume-DwOSrKP_.js +1 -0
  23. package/dist-embed-scene/LaunchSimulation-ClGdZJHr.js +1 -0
  24. package/dist-embed-scene/ModuleSession-DAQNvnRi.js +3 -0
  25. package/dist-embed-scene/ModuleThree-Cozd8KlK.js +1 -0
  26. package/dist-embed-scene/ParameterForm-D0GvLmqx.js +85 -0
  27. package/dist-embed-scene/{RailwaySystem-1yA_UYdB.js → RailwaySystem-DZQr_rS_.js} +1 -1
  28. package/dist-embed-scene/ReentryEditor-AsKtWLMw.js +27 -0
  29. package/dist-embed-scene/ReentryEditorMessages_en-O-YSmHxv.js +1 -0
  30. package/dist-embed-scene/ReentryEditorMessages_es-CvO9Jwz5.js +1 -0
  31. package/dist-embed-scene/ReentryEditorMessages_fr-xuC-qZ6M.js +1 -0
  32. package/dist-embed-scene/ReentryEditorMessages_it-B7vyCX9o.js +1 -0
  33. package/dist-embed-scene/ReentrySimulation-rnJU2x1Y.js +1 -0
  34. package/dist-embed-scene/ReferenceSystem-BgT1nVgA.js +1 -0
  35. package/dist-embed-scene/{SceneNames_es-xcbww_vR.js → SceneNames_es-DL0IWHOw.js} +1 -1
  36. package/dist-embed-scene/{SceneNames_fr-COj1rUw_.js → SceneNames_fr-B2NX5JJO.js} +1 -1
  37. package/dist-embed-scene/{SceneNames_it-BiqZMsLB.js → SceneNames_it-wq6fqU10.js} +1 -1
  38. package/dist-embed-scene/TimelineTracks-Bv2FX3_W.js +35 -0
  39. package/dist-embed-scene/{TraceSystem-B9WBM9ut.js → TraceSystem-D7pxye9d.js} +1 -1
  40. package/dist-embed-scene/WaterSystem-DI_NBDfH.js +1 -0
  41. package/dist-embed-scene/rr0-scene.mjs +345 -345
  42. package/dist-embed-scene/{sightingSchema-CnDwuCov.js → sightingSchema-CKUYrwgu.js} +1 -1
  43. package/dist-embed-scene/trafficRuntime-C3sA3Jg_.js +2 -0
  44. package/dist-embed-sighting/{AdsbLolArchiveProvider-CX1R8zJF.js → AdsbLolArchiveProvider-BGg8e-TS.js} +1 -1
  45. package/dist-embed-sighting/{BallesterGuaspAssessor-CCjRjJck.js → BallesterGuaspAssessor-DHpHbF6s.js} +1 -1
  46. package/dist-embed-sighting/BeamEditor-KLBjeTRU.js +30 -0
  47. package/dist-embed-sighting/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  48. package/dist-embed-sighting/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  49. package/dist-embed-sighting/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  50. package/dist-embed-sighting/BeamEditorMessages_it-DVweRQFi.js +1 -0
  51. package/dist-embed-sighting/BeamSystem-C6YXI9Da.js +1 -0
  52. package/dist-embed-sighting/ContrailSystem-BUKo3qVd.js +1 -0
  53. package/dist-embed-sighting/GLTFLoader-BYMKgQLE.js +1 -0
  54. package/dist-embed-sighting/HeadlightSystem-CXPE3feA.js +34 -0
  55. package/dist-embed-sighting/{HynekAssessor-B8Iw0Cbz.js → HynekAssessor-Cc8hHe3R.js} +1 -1
  56. package/dist-embed-sighting/LanternEditor-J_d2le0V.js +9 -0
  57. package/dist-embed-sighting/LanternEditorMessages_en-DaT3UNfD.js +1 -0
  58. package/dist-embed-sighting/LanternEditorMessages_es-TDV5lKeJ.js +1 -0
  59. package/dist-embed-sighting/LanternEditorMessages_fr-9mByTFMG.js +1 -0
  60. package/dist-embed-sighting/LanternEditorMessages_it-MRkJnDQp.js +1 -0
  61. package/dist-embed-sighting/LaserBeam-CovzRtac.js +1 -0
  62. package/dist-embed-sighting/LaunchEditor-DuVZmb3n.js +22 -0
  63. package/dist-embed-sighting/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  64. package/dist-embed-sighting/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  65. package/dist-embed-sighting/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  66. package/dist-embed-sighting/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  67. package/dist-embed-sighting/LaunchPlume-DONCQxUE.js +1 -0
  68. package/dist-embed-sighting/LaunchSimulation-C0cSHpLE.js +1 -0
  69. package/dist-embed-sighting/ModuleSession-CRVX-5Br.js +3 -0
  70. package/dist-embed-sighting/ModuleThree-YgLqKZM9.js +1 -0
  71. package/dist-embed-sighting/NearestApproach-BOWntoKZ.js +1 -0
  72. package/dist-embed-sighting/ParameterForm-BMfViRUv.js +85 -0
  73. package/dist-embed-sighting/{PoherAssessor-CwQN9pB1.js → PoherAssessor-CM7oCyEk.js} +1 -1
  74. package/dist-embed-sighting/{RailwaySystem-9blFcIdg.js → RailwaySystem-D8yJRUc8.js} +1 -1
  75. package/dist-embed-sighting/ReentryEditor-DCDavAGw.js +27 -0
  76. package/dist-embed-sighting/ReentryEditorMessages_en-O-YSmHxv.js +1 -0
  77. package/dist-embed-sighting/ReentryEditorMessages_es-CvO9Jwz5.js +1 -0
  78. package/dist-embed-sighting/ReentryEditorMessages_fr-xuC-qZ6M.js +1 -0
  79. package/dist-embed-sighting/ReentryEditorMessages_it-B7vyCX9o.js +1 -0
  80. package/dist-embed-sighting/ReentrySimulation-BzMMTqck.js +1 -0
  81. package/dist-embed-sighting/{ReferenceSystem-DFM_jZ-Q.js → ReferenceSystem-Dt28-Egu.js} +1 -1
  82. package/dist-embed-sighting/{RoadMarkings-DKxgMzE-.js → RoadMarkings-BC76NPX4.js} +1 -1
  83. package/dist-embed-sighting/TimelineTracks-C7uTt9N5.js +35 -0
  84. package/dist-embed-sighting/{TraceSystem-CLYZFxAf.js → TraceSystem-Cd2FqhcV.js} +2 -2
  85. package/dist-embed-sighting/{WaterSystem-BulddAwi.js → WaterSystem-S81tdPno.js} +1 -1
  86. package/dist-embed-sighting/rr0-sighting.mjs +345 -345
  87. package/dist-embed-sighting/{sightingSchema-CnDwuCov.js → sightingSchema-CKUYrwgu.js} +1 -1
  88. package/dist-embed-sighting/trafficRuntime-DL5Zul8z.js +2 -0
  89. package/dist-embed-sighting-editor/AdsbLolArchiveProvider-k2xqWyaR.js +1 -0
  90. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-gX_y6kL8.js → BallesterGuaspAssessor-CRfTg7iA.js} +1 -1
  91. package/dist-embed-sighting-editor/BeamEditor-DTkjy61A.js +30 -0
  92. package/dist-embed-sighting-editor/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  93. package/dist-embed-sighting-editor/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  94. package/dist-embed-sighting-editor/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  95. package/dist-embed-sighting-editor/BeamEditorMessages_it-DVweRQFi.js +1 -0
  96. package/dist-embed-sighting-editor/BeamSystem-BQbLn-3t.js +1 -0
  97. package/dist-embed-sighting-editor/BodyEditor-D5PfqEg2.js +28 -0
  98. package/dist-embed-sighting-editor/BodyEditorMessages_en-zfy3BJb5.js +1 -0
  99. package/dist-embed-sighting-editor/BodyEditorMessages_es-w95anMnI.js +1 -0
  100. package/dist-embed-sighting-editor/BodyEditorMessages_fr-ixsDgTbt.js +1 -0
  101. package/dist-embed-sighting-editor/BodyEditorMessages_it-B3oQzqHE.js +1 -0
  102. package/dist-embed-sighting-editor/{ContrailSystem-BXARgrR4.js → ContrailSystem-BQXLg_WA.js} +1 -1
  103. package/dist-embed-sighting-editor/{CoverageAssessor-mvpHgNx3.js → CoverageAssessor-D3HBwZuC.js} +1 -1
  104. package/dist-embed-sighting-editor/{GLTFLoader-BVRuOnnK.js → GLTFLoader-CQeR3NC8.js} +1 -1
  105. package/dist-embed-sighting-editor/{HeadlightSystem-9ywZKJNB.js → HeadlightSystem-Cy4jSEsq.js} +1 -1
  106. package/dist-embed-sighting-editor/{HynekAssessor-B9lO770Q.js → HynekAssessor-Covu9I3x.js} +1 -1
  107. package/dist-embed-sighting-editor/{InterviewEditorElement-1brfxXM5.js → InterviewEditorElement-IBABfqta.js} +2 -2
  108. package/dist-embed-sighting-editor/LanternEditor-BoxxG443.js +9 -0
  109. package/dist-embed-sighting-editor/LaserBeam-j5Z4tIOw.js +1 -0
  110. package/dist-embed-sighting-editor/LaunchEditor-rJud4C3y.js +22 -0
  111. package/dist-embed-sighting-editor/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  112. package/dist-embed-sighting-editor/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  113. package/dist-embed-sighting-editor/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  114. package/dist-embed-sighting-editor/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  115. package/dist-embed-sighting-editor/LaunchPlume-Dm1YdsZp.js +1 -0
  116. package/dist-embed-sighting-editor/LaunchSimulation-4f9-9d7Z.js +1 -0
  117. package/dist-embed-sighting-editor/{ModelSource-D0ZuOymh.js → ModelSource-CYfSBTeB.js} +1 -1
  118. package/dist-embed-sighting-editor/{ModelThumbnails-BA3zFrn5.js → ModelThumbnails-DYWQQdaZ.js} +1 -1
  119. package/dist-embed-sighting-editor/{ModelViewer-BDorZEms.js → ModelViewer-BjIOswb8.js} +1 -1
  120. package/dist-embed-sighting-editor/ModuleSession-D3GrBJ3j.js +3 -0
  121. package/dist-embed-sighting-editor/ModuleThree-CkOgRXM2.js +1 -0
  122. package/dist-embed-sighting-editor/ModulesPanelElement-Uz0lPYwu.js +13 -0
  123. package/dist-embed-sighting-editor/ModulesPanelMessages_en-D97Nh2yy.js +1 -0
  124. package/dist-embed-sighting-editor/ModulesPanelMessages_es-CE9Ajw2-.js +1 -0
  125. package/dist-embed-sighting-editor/ModulesPanelMessages_fr-BWsj-7_t.js +1 -0
  126. package/dist-embed-sighting-editor/ModulesPanelMessages_it-CtKrboEg.js +1 -0
  127. package/dist-embed-sighting-editor/{NearestApproach-DCFh8vV6.js → NearestApproach-DCUW8bB4.js} +1 -1
  128. package/dist-embed-sighting-editor/{PictureRegistration-cp0utyhJ.js → PictureRegistration-ZyvGfReK.js} +1 -1
  129. package/dist-embed-sighting-editor/{PoherAssessor-CzLQhAxP.js → PoherAssessor-BoGGdasd.js} +1 -1
  130. package/dist-embed-sighting-editor/{RailwaySystem-BfDjza60.js → RailwaySystem-C8Dby19B.js} +1 -1
  131. package/dist-embed-sighting-editor/ReentryEditor-8sfHq7hY.js +27 -0
  132. package/dist-embed-sighting-editor/ReentryEditorMessages_en-O-YSmHxv.js +1 -0
  133. package/dist-embed-sighting-editor/ReentryEditorMessages_es-CvO9Jwz5.js +1 -0
  134. package/dist-embed-sighting-editor/ReentryEditorMessages_fr-xuC-qZ6M.js +1 -0
  135. package/dist-embed-sighting-editor/ReentryEditorMessages_it-B7vyCX9o.js +1 -0
  136. package/dist-embed-sighting-editor/ReentrySimulation-KMMVK82G.js +1 -0
  137. package/dist-embed-sighting-editor/{ReferenceSystem-DHPnvAXN.js → ReferenceSystem-PYF540r7.js} +1 -1
  138. package/dist-embed-sighting-editor/{RoadMarkings-HF9xJtTp.js → RoadMarkings-VqRLMg59.js} +1 -1
  139. package/dist-embed-sighting-editor/{SceneNames_es-DFcAoDph.js → SceneNames_es-CLvEspFd.js} +1 -1
  140. package/dist-embed-sighting-editor/{SceneNames_fr-Cf8NgtIe.js → SceneNames_fr-oYQgZ-TZ.js} +1 -1
  141. package/dist-embed-sighting-editor/{SceneNames_it-CLLu_NHU.js → SceneNames_it-CDTw3VAX.js} +1 -1
  142. package/dist-embed-sighting-editor/SightingEditorMessages_es-CQU200Hj.js +12 -0
  143. package/dist-embed-sighting-editor/SightingEditorMessages_fr-Bd4Ht-jW.js +12 -0
  144. package/dist-embed-sighting-editor/SightingEditorMessages_it-CSnPiCy2.js +12 -0
  145. package/dist-embed-sighting-editor/{SightingFileEditor-BekK-f3R.js → SightingFileEditor-DB3jyBzw.js} +1 -1
  146. package/dist-embed-sighting-editor/SkyEventEditorStyle-CvY_AhbI.js +1 -0
  147. package/dist-embed-sighting-editor/{TraceSystem-C1HaC0DX.js → TraceSystem-BX0FwUB1.js} +2 -2
  148. package/dist-embed-sighting-editor/{WaterSystem-BDkfNF8C.js → WaterSystem-uWnkivpP.js} +1 -1
  149. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +433 -435
  150. package/dist-embed-sighting-editor/{sightingSchema-CnDwuCov.js → sightingSchema-CKUYrwgu.js} +1 -1
  151. package/dist-embed-sighting-editor/surroundingsSources-DXpzMDPy.js +1 -0
  152. package/dist-embed-sighting-editor/trafficRuntime-BeMCM4Ap.js +2 -0
  153. package/package.json +1 -1
  154. package/dist-embed-scene/BeamSystem-Dp1WU1Zx.js +0 -1
  155. package/dist-embed-scene/GLTFLoader-wJ0bjCoG.js +0 -1
  156. package/dist-embed-scene/ReferenceSystem-DOCydyPG.js +0 -1
  157. package/dist-embed-scene/WaterSystem-yC8sKIc5.js +0 -1
  158. package/dist-embed-scene/trafficRuntime-BPEJW9KZ.js +0 -2
  159. package/dist-embed-sighting/BeamSystem-B0H346X_.js +0 -1
  160. package/dist-embed-sighting/ContrailSystem-BeK11Jxe.js +0 -1
  161. package/dist-embed-sighting/GLTFLoader-B_T3zy3i.js +0 -1
  162. package/dist-embed-sighting/HeadlightSystem-DjtbpwEp.js +0 -34
  163. package/dist-embed-sighting/NearestApproach-B5s-b6tU.js +0 -1
  164. package/dist-embed-sighting/trafficRuntime-CfPqH9j0.js +0 -2
  165. package/dist-embed-sighting-editor/AdsbLolArchiveProvider-DS9ev-HU.js +0 -1
  166. package/dist-embed-sighting-editor/BeamEditor-DDNul0KE.js +0 -13
  167. package/dist-embed-sighting-editor/BeamEditorMessages_en-SQumGyrS.js +0 -1
  168. package/dist-embed-sighting-editor/BeamEditorMessages_es-BrR6Pk6G.js +0 -1
  169. package/dist-embed-sighting-editor/BeamEditorMessages_fr-CT24bHfq.js +0 -1
  170. package/dist-embed-sighting-editor/BeamEditorMessages_it-BgwwRjlh.js +0 -1
  171. package/dist-embed-sighting-editor/BeamSystem-BBonCZQ1.js +0 -1
  172. package/dist-embed-sighting-editor/BodyEditor-Br-GYDsy.js +0 -27
  173. package/dist-embed-sighting-editor/BodyEditorMessages_en-esgrRKGZ.js +0 -1
  174. package/dist-embed-sighting-editor/BodyEditorMessages_es-C1ZvwV-v.js +0 -1
  175. package/dist-embed-sighting-editor/BodyEditorMessages_fr-B_exFt_Q.js +0 -1
  176. package/dist-embed-sighting-editor/BodyEditorMessages_it-AJ_KrzkS.js +0 -1
  177. package/dist-embed-sighting-editor/LanternEditor-DpZQqBGL.js +0 -9
  178. package/dist-embed-sighting-editor/LaserBeam-DZ6ILkZ8.js +0 -1
  179. package/dist-embed-sighting-editor/LaunchEditor-BvnOtPyj.js +0 -18
  180. package/dist-embed-sighting-editor/LaunchEditorMessages_en-9lV7bQZy.js +0 -1
  181. package/dist-embed-sighting-editor/LaunchEditorMessages_es-D-Kz7fI5.js +0 -1
  182. package/dist-embed-sighting-editor/LaunchEditorMessages_fr-VEZBh9Ky.js +0 -1
  183. package/dist-embed-sighting-editor/LaunchEditorMessages_it-B0MeP7ki.js +0 -1
  184. package/dist-embed-sighting-editor/SightingEditorMessages_es-oZAu3CCU.js +0 -12
  185. package/dist-embed-sighting-editor/SightingEditorMessages_fr-ycaYW34j.js +0 -12
  186. package/dist-embed-sighting-editor/SightingEditorMessages_it-Chlr7U2v.js +0 -12
  187. package/dist-embed-sighting-editor/surroundingsSources-Bq5A0HA5.js +0 -1
  188. package/dist-embed-sighting-editor/trafficRuntime-DVOOnJGD.js +0 -2
@@ -1 +1 @@
1
- import{g as f,a2 as w,a3 as M,a4 as p,e as y,X as v,a5 as O,a6 as b,a7 as E,a8 as D}from"./rr0-sighting.mjs";class c extends Error{constructor(t,s){super(`${t}: ${s.kind==="status"?s.status:s.kind}`),this.src=t,this.failure=s}}class u{static async blob(t){let s;try{s=await fetch(t)}catch{throw new c(t,await u.whyUnread(t))}if(!s.ok)throw new c(t,{kind:"status",status:s.status});const e=await s.blob();if(e.type&&!e.type.startsWith("image/"))throw new c(t,{kind:"notPicture"});return e}static failureOf(t){return t instanceof c?t.failure:{kind:"notPicture"}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const g=3,l=800,d=Math.PI/180;class h{constructor(t,s,e=h.fetchImage){this.scene=t,this.onImageLoaded=s,this.loadImage=e}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,s){if(!t.from||!s)return 1;const e=f(s.lat,s.lng,t.from.lat,t.from.lng),a=(Math.hypot(e.x,e.z)-h.PRESENT_WITHIN_M)/(h.GONE_BEYOND_M-h.PRESENT_WITHIN_M),o=Math.min(Math.max(a,0),1);return 1-o*o*(3-2*o)}set(t,s=this.views,e){this.references=t,this.observerAt=e,this.views=s;const i=new Set(t.map(a=>a.id));for(const[a,o]of this.meshes)i.has(a)||(this.dispose(o),this.meshes.delete(a),this.signatures.delete(a));for(const[a,o]of this.images){const n=t.find(m=>m.id===a);if(n&&n.src===o.texture.userData.src)continue;o.texture.dispose(),this.images.delete(a);const r=this.meshes.get(a);r&&(this.dispose(r),this.meshes.delete(a),this.signatures.delete(a))}for(const a of t){const o=this.images.get(a.id);if(!o){this.load(a);continue}this.build(a,o)}}setShown(t){this.shown=t;for(const s of this.meshes.values())s.visible=t&&this.opacityOf(s.userData.id)>0}setView(t,s){this.views.set(t,s);const e=this.meshes.get(t);e&&this.applyOpacity(e,t)}layer=g;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){for(const s of this.meshes.values())s.visible&&(s.position.copy(t.position),s.updateMatrixWorld())}get furthestM(){return this.meshes.size>0?l:0}directionOfPixel(t,s,e,i){const a=this.images.get(t.id),o=a?a.width/a.height:1,n=Math.tan(t.registration.fovDeg/2*d),r=n*o;return i.set((s*2-1)*r,(1-e*2)*n,-1).normalize(),i.applyQuaternion(h.orientation(t))}aspectOf(t){const s=this.images.get(t);return s?s.width/s.height:void 0}failureOf(t){return this.failed.get(t)}load(t){const s=t.src;if(this.loading.has(t.id)||this.failed.has(s))return;const e=this.loadImage(s).then(i=>{this.loading.delete(t.id);const a=this.references.find(o=>o.id===t.id);if(!a||a.src!==s){i.texture.dispose();return}i.texture.userData.src=s,this.images.set(t.id,i),this.build(a,i),this.onImageLoaded()},i=>{this.loading.delete(t.id),this.failed.set(s,u.failureOf(i)),this.onImageLoaded()});this.loading.set(t.id,e)}static async fetchImage(t){const s=await u.blob(t),e=await createImageBitmap(s,{imageOrientation:"flipY"}).catch(()=>{throw new c(t,{kind:"notPicture"})}),i=new w(e);return i.flipY=!1,i.colorSpace=M,i.minFilter=p,i.magFilter=p,i.generateMipmaps=!1,i.needsUpdate=!0,{texture:i,width:e.width,height:e.height}}build(t,s){const e=h.signatureOf(t,s);let i=this.meshes.get(t.id);if(i&&this.signatures.get(t.id)===e){this.applyOpacity(i,t.id);return}i&&(this.dispose(i),this.meshes.delete(t.id)),i=new y(h.geometryOf(t,s),new v({map:s.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(i.material.side=O),i.frustumCulled=!1,i.layers.set(g),i.userData.id=t.id,i.quaternion.copy(h.orientation(t)),this.scene.add(i),this.meshes.set(t.id,i),this.signatures.set(t.id,e),this.applyOpacity(i,t.id)}static geometryOf(t,s){if(t.kind==="panorama"){const o=new b(l,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const e=2*l*Math.tan(t.registration.fovDeg/2*d),i=e*(s.width/Math.max(s.height,1)),a=new E(i,e);return a.translate(0,0,-l),a}static orientation(t){const{headingDeg:s,pitchDeg:e,rollDeg:i}=t.registration,a=new D;return a.rotation.set(e*d,-s*d,-(i??0)*d,"YXZ"),a.quaternion}opacityOf(t){const s=this.references.find(a=>a.id===t),e=this.views.get(t),i=s?h.presenceAt(s,this.observerAt):1;return(e?.opacity??s?.opacity??0)*i}applyOpacity(t,s){const e=this.opacityOf(s);t.material.opacity=e,t.visible=this.shown&&e>0}static signatureOf(t,s){const{headingDeg:e,pitchDeg:i,rollDeg:a,fovDeg:o}=t.registration;return[t.kind,t.src,s.width,s.height,e,i,a??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())t.texture.dispose();this.images.clear()}}export{g as REFERENCE_LAYER,h as ReferenceSystem};
1
+ import{h as f,a4 as w,a5 as M,a6 as p,i as y,$ as v,a7 as O,a8 as b,a9 as E,aa as D}from"./rr0-sighting.mjs";class c extends Error{constructor(t,s){super(`${t}: ${s.kind==="status"?s.status:s.kind}`),this.src=t,this.failure=s}}class u{static async blob(t){let s;try{s=await fetch(t)}catch{throw new c(t,await u.whyUnread(t))}if(!s.ok)throw new c(t,{kind:"status",status:s.status});const e=await s.blob();if(e.type&&!e.type.startsWith("image/"))throw new c(t,{kind:"notPicture"});return e}static failureOf(t){return t instanceof c?t.failure:{kind:"notPicture"}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const g=3,l=800,d=Math.PI/180;class h{constructor(t,s,e=h.fetchImage){this.scene=t,this.onImageLoaded=s,this.loadImage=e}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,s){if(!t.from||!s)return 1;const e=f(s.lat,s.lng,t.from.lat,t.from.lng),a=(Math.hypot(e.x,e.z)-h.PRESENT_WITHIN_M)/(h.GONE_BEYOND_M-h.PRESENT_WITHIN_M),o=Math.min(Math.max(a,0),1);return 1-o*o*(3-2*o)}set(t,s=this.views,e){this.references=t,this.observerAt=e,this.views=s;const i=new Set(t.map(a=>a.id));for(const[a,o]of this.meshes)i.has(a)||(this.dispose(o),this.meshes.delete(a),this.signatures.delete(a));for(const[a,o]of this.images){const n=t.find(m=>m.id===a);if(n&&n.src===o.texture.userData.src)continue;o.texture.dispose(),this.images.delete(a);const r=this.meshes.get(a);r&&(this.dispose(r),this.meshes.delete(a),this.signatures.delete(a))}for(const a of t){const o=this.images.get(a.id);if(!o){this.load(a);continue}this.build(a,o)}}setShown(t){this.shown=t;for(const s of this.meshes.values())s.visible=t&&this.opacityOf(s.userData.id)>0}setView(t,s){this.views.set(t,s);const e=this.meshes.get(t);e&&this.applyOpacity(e,t)}layer=g;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){for(const s of this.meshes.values())s.visible&&(s.position.copy(t.position),s.updateMatrixWorld())}get furthestM(){return this.meshes.size>0?l:0}directionOfPixel(t,s,e,i){const a=this.images.get(t.id),o=a?a.width/a.height:1,n=Math.tan(t.registration.fovDeg/2*d),r=n*o;return i.set((s*2-1)*r,(1-e*2)*n,-1).normalize(),i.applyQuaternion(h.orientation(t))}aspectOf(t){const s=this.images.get(t);return s?s.width/s.height:void 0}failureOf(t){return this.failed.get(t)}load(t){const s=t.src;if(this.loading.has(t.id)||this.failed.has(s))return;const e=this.loadImage(s).then(i=>{this.loading.delete(t.id);const a=this.references.find(o=>o.id===t.id);if(!a||a.src!==s){i.texture.dispose();return}i.texture.userData.src=s,this.images.set(t.id,i),this.build(a,i),this.onImageLoaded()},i=>{this.loading.delete(t.id),this.failed.set(s,u.failureOf(i)),this.onImageLoaded()});this.loading.set(t.id,e)}static async fetchImage(t){const s=await u.blob(t),e=await createImageBitmap(s,{imageOrientation:"flipY"}).catch(()=>{throw new c(t,{kind:"notPicture"})}),i=new w(e);return i.flipY=!1,i.colorSpace=M,i.minFilter=p,i.magFilter=p,i.generateMipmaps=!1,i.needsUpdate=!0,{texture:i,width:e.width,height:e.height}}build(t,s){const e=h.signatureOf(t,s);let i=this.meshes.get(t.id);if(i&&this.signatures.get(t.id)===e){this.applyOpacity(i,t.id);return}i&&(this.dispose(i),this.meshes.delete(t.id)),i=new y(h.geometryOf(t,s),new v({map:s.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(i.material.side=O),i.frustumCulled=!1,i.layers.set(g),i.userData.id=t.id,i.quaternion.copy(h.orientation(t)),this.scene.add(i),this.meshes.set(t.id,i),this.signatures.set(t.id,e),this.applyOpacity(i,t.id)}static geometryOf(t,s){if(t.kind==="panorama"){const o=new b(l,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const e=2*l*Math.tan(t.registration.fovDeg/2*d),i=e*(s.width/Math.max(s.height,1)),a=new E(i,e);return a.translate(0,0,-l),a}static orientation(t){const{headingDeg:s,pitchDeg:e,rollDeg:i}=t.registration,a=new D;return a.rotation.set(e*d,-s*d,-(i??0)*d,"YXZ"),a.quaternion}opacityOf(t){const s=this.references.find(a=>a.id===t),e=this.views.get(t),i=s?h.presenceAt(s,this.observerAt):1;return(e?.opacity??s?.opacity??0)*i}applyOpacity(t,s){const e=this.opacityOf(s);t.material.opacity=e,t.visible=this.shown&&e>0}static signatureOf(t,s){const{headingDeg:e,pitchDeg:i,rollDeg:a,fovDeg:o}=t.registration;return[t.kind,t.src,s.width,s.height,e,i,a??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())t.texture.dispose();this.images.clear()}}export{g as REFERENCE_LAYER,h as ReferenceSystem};
@@ -1 +1 @@
1
- import{g as D}from"./rr0-sighting.mjs";class M{static MIN_ROAD_M=5.5;static WIDE_ROAD_M=9;static LINE_WIDTH_M=.12;static DASH_M=3;static GAP_M=10;static RIVE_DASH_M=2.5;static RIVE_GAP_M=3.5;static MIN_DASH_M=.5;static LANE_M=3.5;static SHOULDER_MIN_M=1.5;static SOLID_EDGE_FROM_M=7;static SOLID_EDGE_FROM_KMH=80;static BEND_RADIUS_M=300;static EDGE_SETBACK_M=.4;static PAINT_RADIUS_M=450;static LIFT_M=.015;static BARRIER_MAX_AXES_M=40;static BARRIER_MIN_AXES_M=5;static BARRIER_HEIGHT_M=.8;static BARRIER_HALF_WIDTH_M=.2;static BARRIER_STEP_M=4;static painted(t){return t.surface==="paved"&&t.widthM>=M.MIN_ROAD_M&&t.kind!=="roundabout"}static plan(t){if(!M.painted(t))return[];const u=t.widthM,l=u/2,i=M.EDGE_SETBACK_M;if(!(t.direction!==void 0&&t.lanes!==void 0)){const I=[{offsetM:l-i,pattern:"solid"},{offsetM:-(l-i),pattern:"solid"}],A=u>=M.WIDE_ROAD_M?[-u/4,u/4]:[0];for(const x of A)I.push({offsetM:x,pattern:"dashed"});return I}const s=t.lanes,n=u>=M.SOLID_EDGE_FROM_M||(t.speedKmh??0)>=M.SOLID_EDGE_FROM_KMH?"solid":"rive";if(t.direction==="both"){if(s<2)return[];const I=[{offsetM:l-i,pattern:n},{offsetM:-(l-i),pattern:n}];if(s>=4){I.push({offsetM:.1,pattern:"solid"},{offsetM:-.1,pattern:"solid"});const A=Math.floor(s/2),x=u/s;for(let z=1;z<A;z++)I.push({offsetM:z*x,pattern:"dashed"},{offsetM:-z*x,pattern:"dashed"})}else I.push({offsetM:0,pattern:"dashed",solidInBends:!0});return I}const r=t.direction==="backward"?-1:1,o=I=>r*(l-I),c=Math.min(M.LANE_M,u/Math.max(s,1)),h=s*c,d=u-h,_=(t.kind==="motorway"||t.kind==="dual")&&d>=M.SHOULDER_MIN_M,E=[{offsetM:o(i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n}];E.push({offsetM:o(_?h:u-i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n});for(let I=1;I<s;I++)E.push({offsetM:o(I*c),pattern:"dashed"});return E}static lay(t,u,l,i){let e=0;const s=(f,n)=>{i(f,M.LINE_WIDTH_M,{offsetM:n,liftM:M.LIFT_M,minHalfM:M.LINE_WIDTH_M/2}),e++};for(const f of t){const n=M.plan(f);if(n.length===0)continue;const r=f.points.map(o=>D(o.lat,o.lng,u,l));for(const o of M.near(r,M.PAINT_RADIUS_M))for(const c of n){if(c.pattern==="solid"){s(o,c.offsetM);continue}const[h,d]=c.pattern==="dashed"?[M.DASH_M,M.GAP_M]:[M.RIVE_DASH_M,M.RIVE_GAP_M];for(const _ of c.solidInBends?M.byBends(o):[{path:o,bend:!1}])if(_.bend)s(_.path,c.offsetM);else for(const E of M.dashes(_.path,h,d))s(E,c.offsetM)}}return e}static byBends(t){if(t.length<3)return[{path:t,bend:!1}];const u=(e,s)=>Math.atan2(s.x-e.x,-(s.z-e.z)),l=new Array(t.length-1).fill(!1);for(let e=1;e<t.length-1;e++){const s=Math.hypot(t[e].x-t[e-1].x,t[e].z-t[e-1].z),f=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6||f<1e-6)continue;let n=Math.abs(u(t[e],t[e+1])-u(t[e-1],t[e]));n>Math.PI&&(n=2*Math.PI-n),(s+f)/2/Math.max(n,1e-6)<M.BEND_RADIUS_M&&(l[e-1]=!0,l[e]=!0)}const i=[];for(let e=0;e<l.length;e++){const s=i.at(-1);s&&s.bend===l[e]?s.path.push(t[e+1]):i.push({path:[t[e],t[e+1]],bend:l[e]})}return i}static barriers(t,u,l){const i=t.filter(n=>(n.kind==="motorway"||n.kind==="dual")&&(n.direction==="forward"||n.direction==="backward")),e=i.map(n=>{const r=n.points.map(o=>D(o.lat,o.lng,u,l));return n.direction==="backward"?[...r].reverse():r}),s=[],f=M.BARRIER_STEP_M;return i.forEach((n,r)=>{for(const o of M.near(e[r],M.PAINT_RADIUS_M)){let c=[];for(const h of M.resample(o,f)){const d=M.midwayToOpposite(h,r,i,e);d?c.push(d):c.length>0&&(c.length>=2&&s.push(c),c=[])}c.length>=2&&s.push(c)}}),s}static midwayToOpposite(t,u,l,i){let e;for(let s=0;s<i.length;s++){if(s===u||l[s].id<l[u].id)continue;const f=i[s];for(let n=0;n<f.length-1;n++){const r=f[n+1].x-f[n].x,o=f[n+1].z-f[n].z,c=r*r+o*o;if(c<1e-9||(r*t.dx+o*t.dz)/Math.sqrt(c)>-.9)continue;const h=Math.max(0,Math.min(1,((t.x-f[n].x)*r+(t.z-f[n].z)*o)/c)),d={x:f[n].x+r*h,z:f[n].z+o*h},_=Math.hypot(t.x-d.x,t.z-d.z);_<M.BARRIER_MIN_AXES_M||_>M.BARRIER_MAX_AXES_M||(!e||_<e.distance)&&(e={distance:_,point:d})}}return e?{x:(t.x+e.point.x)/2,z:(t.z+e.point.z)/2}:void 0}static resample(t,u){const l=[];for(let e=0;e<t.length-1;e++){const s=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6)continue;const f=(t[e+1].x-t[e].x)/s,n=(t[e+1].z-t[e].z)/s;for(let r=0;r<s;r+=u)l.push({x:t[e].x+f*r,z:t[e].z+n*r,dx:f,dz:n})}const i=l.at(-1);return i&&l.push({...t[t.length-1],dx:i.dx,dz:i.dz}),l}static barrierGeometry(t,u){const l=[],i=[],e=M.BARRIER_HALF_WIDTH_M;for(const s of t){if(s.length<2)continue;const f=l.length/3;for(let n=0;n<s.length;n++){const r=s[Math.max(0,n-1)],o=s[Math.min(s.length-1,n+1)],c=Math.hypot(o.x-r.x,o.z-r.z)||1,h=-(o.z-r.z)/c*e,d=(o.x-r.x)/c*e,_=u(s[n].x,s[n].z);l.push(s[n].x+h,_,s[n].z+d,s[n].x+h,_+M.BARRIER_HEIGHT_M,s[n].z+d,s[n].x-h,_+M.BARRIER_HEIGHT_M,s[n].z-d,s[n].x-h,_,s[n].z-d)}for(let n=0;n<s.length-1;n++){const r=f+n*4,o=r+4;for(let c=0;c<3;c++)i.push(r+c,o+c,r+c+1,r+c+1,o+c,o+c+1)}}return{positions:l,indices:i}}static near(t,u){const l=[];let i;for(let e=0;e<t.length-1;e++)Math.min(Math.hypot(t[e].x,t[e].z),Math.hypot(t[e+1].x,t[e+1].z))<=u||Math.hypot((t[e].x+t[e+1].x)/2,(t[e].z+t[e+1].z)/2)<=u?(i||(i=[t[e]]),i.push(t[e+1])):i&&(l.push(i),i=void 0);return i&&l.push(i),l}static dashes(t,u,l){const i=[],e=u+l;let s=0,f;const n=(o,c)=>({x:t[o].x+(t[o+1].x-t[o].x)*c,z:t[o].z+(t[o+1].z-t[o].z)*c});for(let o=0;o<t.length-1;o++){const c=Math.hypot(t[o+1].x-t[o].x,t[o+1].z-t[o].z);if(c<1e-6)continue;let h=0;for(;h<c;){const d=(s+h)%e,_=d<u,E=_?u-d:e-d,I=Math.min(c,h+E);_&&(f||(f=[n(o,h/c)]),f.push(n(o,I/c)),I-h>=E-1e-9&&(i.push(f),f=void 0)),h=I}s+=c}f&&f.length>=2&&i.push(f);const r=o=>o.slice(1).reduce((c,h,d)=>c+Math.hypot(h.x-o[d].x,h.z-o[d].z),0);return i.filter(o=>o.length>=2&&r(o)>=M.MIN_DASH_M)}}export{M as RoadMarkings};
1
+ import{h as D}from"./rr0-sighting.mjs";class M{static MIN_ROAD_M=5.5;static WIDE_ROAD_M=9;static LINE_WIDTH_M=.12;static DASH_M=3;static GAP_M=10;static RIVE_DASH_M=2.5;static RIVE_GAP_M=3.5;static MIN_DASH_M=.5;static LANE_M=3.5;static SHOULDER_MIN_M=1.5;static SOLID_EDGE_FROM_M=7;static SOLID_EDGE_FROM_KMH=80;static BEND_RADIUS_M=300;static EDGE_SETBACK_M=.4;static PAINT_RADIUS_M=450;static LIFT_M=.015;static BARRIER_MAX_AXES_M=40;static BARRIER_MIN_AXES_M=5;static BARRIER_HEIGHT_M=.8;static BARRIER_HALF_WIDTH_M=.2;static BARRIER_STEP_M=4;static painted(t){return t.surface==="paved"&&t.widthM>=M.MIN_ROAD_M&&t.kind!=="roundabout"}static plan(t){if(!M.painted(t))return[];const u=t.widthM,l=u/2,i=M.EDGE_SETBACK_M;if(!(t.direction!==void 0&&t.lanes!==void 0)){const I=[{offsetM:l-i,pattern:"solid"},{offsetM:-(l-i),pattern:"solid"}],A=u>=M.WIDE_ROAD_M?[-u/4,u/4]:[0];for(const x of A)I.push({offsetM:x,pattern:"dashed"});return I}const s=t.lanes,n=u>=M.SOLID_EDGE_FROM_M||(t.speedKmh??0)>=M.SOLID_EDGE_FROM_KMH?"solid":"rive";if(t.direction==="both"){if(s<2)return[];const I=[{offsetM:l-i,pattern:n},{offsetM:-(l-i),pattern:n}];if(s>=4){I.push({offsetM:.1,pattern:"solid"},{offsetM:-.1,pattern:"solid"});const A=Math.floor(s/2),x=u/s;for(let z=1;z<A;z++)I.push({offsetM:z*x,pattern:"dashed"},{offsetM:-z*x,pattern:"dashed"})}else I.push({offsetM:0,pattern:"dashed",solidInBends:!0});return I}const r=t.direction==="backward"?-1:1,o=I=>r*(l-I),c=Math.min(M.LANE_M,u/Math.max(s,1)),h=s*c,d=u-h,_=(t.kind==="motorway"||t.kind==="dual")&&d>=M.SHOULDER_MIN_M,E=[{offsetM:o(i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n}];E.push({offsetM:o(_?h:u-i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n});for(let I=1;I<s;I++)E.push({offsetM:o(I*c),pattern:"dashed"});return E}static lay(t,u,l,i){let e=0;const s=(f,n)=>{i(f,M.LINE_WIDTH_M,{offsetM:n,liftM:M.LIFT_M,minHalfM:M.LINE_WIDTH_M/2}),e++};for(const f of t){const n=M.plan(f);if(n.length===0)continue;const r=f.points.map(o=>D(o.lat,o.lng,u,l));for(const o of M.near(r,M.PAINT_RADIUS_M))for(const c of n){if(c.pattern==="solid"){s(o,c.offsetM);continue}const[h,d]=c.pattern==="dashed"?[M.DASH_M,M.GAP_M]:[M.RIVE_DASH_M,M.RIVE_GAP_M];for(const _ of c.solidInBends?M.byBends(o):[{path:o,bend:!1}])if(_.bend)s(_.path,c.offsetM);else for(const E of M.dashes(_.path,h,d))s(E,c.offsetM)}}return e}static byBends(t){if(t.length<3)return[{path:t,bend:!1}];const u=(e,s)=>Math.atan2(s.x-e.x,-(s.z-e.z)),l=new Array(t.length-1).fill(!1);for(let e=1;e<t.length-1;e++){const s=Math.hypot(t[e].x-t[e-1].x,t[e].z-t[e-1].z),f=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6||f<1e-6)continue;let n=Math.abs(u(t[e],t[e+1])-u(t[e-1],t[e]));n>Math.PI&&(n=2*Math.PI-n),(s+f)/2/Math.max(n,1e-6)<M.BEND_RADIUS_M&&(l[e-1]=!0,l[e]=!0)}const i=[];for(let e=0;e<l.length;e++){const s=i.at(-1);s&&s.bend===l[e]?s.path.push(t[e+1]):i.push({path:[t[e],t[e+1]],bend:l[e]})}return i}static barriers(t,u,l){const i=t.filter(n=>(n.kind==="motorway"||n.kind==="dual")&&(n.direction==="forward"||n.direction==="backward")),e=i.map(n=>{const r=n.points.map(o=>D(o.lat,o.lng,u,l));return n.direction==="backward"?[...r].reverse():r}),s=[],f=M.BARRIER_STEP_M;return i.forEach((n,r)=>{for(const o of M.near(e[r],M.PAINT_RADIUS_M)){let c=[];for(const h of M.resample(o,f)){const d=M.midwayToOpposite(h,r,i,e);d?c.push(d):c.length>0&&(c.length>=2&&s.push(c),c=[])}c.length>=2&&s.push(c)}}),s}static midwayToOpposite(t,u,l,i){let e;for(let s=0;s<i.length;s++){if(s===u||l[s].id<l[u].id)continue;const f=i[s];for(let n=0;n<f.length-1;n++){const r=f[n+1].x-f[n].x,o=f[n+1].z-f[n].z,c=r*r+o*o;if(c<1e-9||(r*t.dx+o*t.dz)/Math.sqrt(c)>-.9)continue;const h=Math.max(0,Math.min(1,((t.x-f[n].x)*r+(t.z-f[n].z)*o)/c)),d={x:f[n].x+r*h,z:f[n].z+o*h},_=Math.hypot(t.x-d.x,t.z-d.z);_<M.BARRIER_MIN_AXES_M||_>M.BARRIER_MAX_AXES_M||(!e||_<e.distance)&&(e={distance:_,point:d})}}return e?{x:(t.x+e.point.x)/2,z:(t.z+e.point.z)/2}:void 0}static resample(t,u){const l=[];for(let e=0;e<t.length-1;e++){const s=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6)continue;const f=(t[e+1].x-t[e].x)/s,n=(t[e+1].z-t[e].z)/s;for(let r=0;r<s;r+=u)l.push({x:t[e].x+f*r,z:t[e].z+n*r,dx:f,dz:n})}const i=l.at(-1);return i&&l.push({...t[t.length-1],dx:i.dx,dz:i.dz}),l}static barrierGeometry(t,u){const l=[],i=[],e=M.BARRIER_HALF_WIDTH_M;for(const s of t){if(s.length<2)continue;const f=l.length/3;for(let n=0;n<s.length;n++){const r=s[Math.max(0,n-1)],o=s[Math.min(s.length-1,n+1)],c=Math.hypot(o.x-r.x,o.z-r.z)||1,h=-(o.z-r.z)/c*e,d=(o.x-r.x)/c*e,_=u(s[n].x,s[n].z);l.push(s[n].x+h,_,s[n].z+d,s[n].x+h,_+M.BARRIER_HEIGHT_M,s[n].z+d,s[n].x-h,_+M.BARRIER_HEIGHT_M,s[n].z-d,s[n].x-h,_,s[n].z-d)}for(let n=0;n<s.length-1;n++){const r=f+n*4,o=r+4;for(let c=0;c<3;c++)i.push(r+c,o+c,r+c+1,r+c+1,o+c,o+c+1)}}return{positions:l,indices:i}}static near(t,u){const l=[];let i;for(let e=0;e<t.length-1;e++)Math.min(Math.hypot(t[e].x,t[e].z),Math.hypot(t[e+1].x,t[e+1].z))<=u||Math.hypot((t[e].x+t[e+1].x)/2,(t[e].z+t[e+1].z)/2)<=u?(i||(i=[t[e]]),i.push(t[e+1])):i&&(l.push(i),i=void 0);return i&&l.push(i),l}static dashes(t,u,l){const i=[],e=u+l;let s=0,f;const n=(o,c)=>({x:t[o].x+(t[o+1].x-t[o].x)*c,z:t[o].z+(t[o+1].z-t[o].z)*c});for(let o=0;o<t.length-1;o++){const c=Math.hypot(t[o+1].x-t[o].x,t[o+1].z-t[o].z);if(c<1e-6)continue;let h=0;for(;h<c;){const d=(s+h)%e,_=d<u,E=_?u-d:e-d,I=Math.min(c,h+E);_&&(f||(f=[n(o,h/c)]),f.push(n(o,I/c)),I-h>=E-1e-9&&(i.push(f),f=void 0)),h=I}s+=c}f&&f.length>=2&&i.push(f);const r=o=>o.slice(1).reduce((c,h,d)=>c+Math.hypot(h.x-o[d].x,h.z-o[d].z),0);return i.filter(o=>o.length>=2&&r(o)>=M.MIN_DASH_M)}}export{M as RoadMarkings};
@@ -0,0 +1,35 @@
1
+ import{I as u}from"./ParameterForm-BMfViRUv.js";class p{constructor(t,a,e){this.host=t,this.seek=a,this.messages=e,t.classList.add("timeline-tracks"),this.scroll=document.createElement("div"),this.scroll.className="track-scroll",this.scroll.hidden=!0,this.thumb=document.createElement("div"),this.thumb.className="thumb",this.scroll.append(this.thumb),this.scroll.addEventListener("pointerdown",s=>this.dragWindow(s)),t.addEventListener("wheel",s=>this.wheel(s),{passive:!1})}static CSS=`
2
+ .timeline-tracks { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 10px 14px 12px; }
3
+ .timeline-tracks[hidden] { display: none; }
4
+ .track-name { display: inline-block; justify-self: start; min-height: 0; padding: 2px 0; border: 0; background: none; color: var(--ink-dim, inherit); font: 600 12px/1.3 var(--sans, inherit); cursor: pointer; }
5
+ /* The tracks' names are the words the marks of the seek bar use inside a sentence ("Keyframe (shapes)"): capitalised here, where they stand alone. */
6
+ .track-name::first-letter { text-transform: uppercase; }
7
+ .track-name:hover { color: var(--ink, inherit); text-decoration: underline; background: none; }
8
+ /* The track whose details are shown below, among several that could be: its name stands out, and its lane is outlined. */
9
+ .track-row[data-active="true"] .track-name { color: var(--ink, inherit); text-decoration: underline; text-decoration-thickness: 2px; }
10
+ .track-row[data-active="true"] .track-lane { box-shadow: inset 0 0 0 2px var(--track); }
11
+ .track-row { display: contents; }
12
+ .track-lane { position: relative; height: 24px; border-radius: 6px; background: var(--ground-sunken, rgba(127, 127, 127, .12)); cursor: pointer; transition: height .15s ease; touch-action: pan-y; }
13
+ .track-lane:focus-visible { outline: 2px solid var(--track); outline-offset: 1px; }
14
+ /* A track focused (its name, its lane or its "+") unfolds to show all its events, each row at a readable height; it folds back when the focus leaves. */
15
+ .track-row:focus-within .track-lane { height: max(24px, calc(var(--rows, 1) * 18px + 4px)); }
16
+ .track-row:focus-within .track-lane .span { font-size: 11px; }
17
+ .track-lane .kf { position: absolute; top: 50%; width: 9px; height: 9px; margin: -5px 0 0 -5px; border: 1.5px solid var(--track); background: transparent; transform: rotate(45deg); pointer-events: none; }
18
+ .track-lane .kf[aria-current="true"] { background: var(--track); }
19
+ .track-lane .kf[data-selected="true"] { width: 11px; height: 11px; margin: -6px 0 0 -6px; background: var(--track); box-shadow: 0 0 0 2px var(--ink, #fff); }
20
+ .track-lane[data-movable] .kf { cursor: ew-resize; }
21
+ /* Before the recording's start or after its end: keyframes stand there, the playhead cannot. */
22
+ .track-lane .outside { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(127, 127, 127, .18) 0 4px, transparent 4px 8px); pointer-events: none; }
23
+ .track-lane .span { position: absolute; box-sizing: border-box; min-width: 3px; border: 1px solid var(--track); border-radius: 4px; background: color-mix(in srgb, var(--track) 30%, transparent);
24
+ overflow: hidden; padding: 0 4px; font: 600 10px/1 var(--sans, inherit); color: var(--ink, inherit); white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; pointer-events: none; }
25
+ .track-lane .span[data-id] { pointer-events: auto; cursor: pointer; }
26
+ .track-lane .span[data-id]:hover { background: color-mix(in srgb, var(--track) 45%, transparent); }
27
+ .track-lane .span[aria-selected="true"] { border-width: 2px; background: color-mix(in srgb, var(--track) 65%, transparent); }
28
+ .track-lane .playhead { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #f5c451; pointer-events: none; }
29
+ .track-lane [hidden] { display: none; }
30
+ .track-add { width: 28px; height: 28px; min-width: 28px; min-height: 28px; padding: 0; border-radius: 8px; }
31
+ .track-scroll { grid-column: 2; position: relative; height: 8px; border-radius: 4px; background: var(--ground-sunken, rgba(127, 127, 127, .12)); cursor: pointer; touch-action: none; }
32
+ .track-scroll[hidden] { display: none; }
33
+ .track-scroll .thumb { position: absolute; top: 0; bottom: 0; min-width: 12px; border-radius: 4px; background: color-mix(in srgb, currentColor 35%, transparent); cursor: grab; }
34
+ .track-scroll .thumb:active { cursor: grabbing; }
35
+ `;static MIN_WINDOW_MS=200;tracks=[];duration=0;currentTime=0;extentStart=0;extentEnd=1;drawn="";windowStart=0;windowLength=0;lanes=new Map;adds=new Map;scroll;thumb;setMessages(t){this.messages=t,this.drawn=""}show(t,a,e,s){this.tracks=t;const i=s?s.from:0,n=s?Math.max(s.from+1,s.to):Math.max(1,a);(a!==this.duration||i!==this.extentStart||n!==this.extentEnd||this.windowLength===0)&&(this.windowStart=i,this.windowLength=n-i),this.duration=a,this.extentStart=i,this.extentEnd=n,this.currentTime=e;const r=JSON.stringify([a,i,n,t.map(l=>[l.id,l.label,l.times,l.spans])]);r!==this.drawn&&(this.drawn=r,this.draw()),this.place(e)}setTime(t){this.currentTime=t,this.place(t)}get zoomed(){return this.windowLength<this.extentEnd-this.extentStart}zoomTo(t,a=this.windowStart+this.windowLength/2){const e=this.extentEnd-this.extentStart,s=Math.min(e,Math.max(Math.min(e,p.MIN_WINDOW_MS),t)),i=(a-this.windowStart)/this.windowLength;this.windowLength=s,this.scrollTo(a-i*s)}scrollTo(t){this.windowStart=Math.min(this.extentEnd-this.windowLength,Math.max(this.extentStart,t)),this.layout(),this.place(this.currentTime)}wheel(t){const a=t.target.closest?.(".track-lane, .track-scroll");if(!a)return;const e=a.getBoundingClientRect();if(e.width===0)return;if(t.ctrlKey||t.metaKey){t.preventDefault();const i=this.windowStart+(t.clientX-e.left)/e.width*this.windowLength;this.zoomTo(this.windowLength*Math.exp(t.deltaY*.01),i);return}const s=t.shiftKey&&t.deltaX===0?t.deltaY:t.deltaX;!this.zoomed||Math.abs(s)<=Math.abs(t.shiftKey?0:t.deltaY)||(t.preventDefault(),this.scrollTo(this.windowStart+s/e.width*this.windowLength))}dragWindow(t){const a=this.scroll.getBoundingClientRect();if(a.width===0)return;const e=this.extentEnd-this.extentStart;t.target!==this.thumb&&this.scrollTo(this.extentStart+(t.clientX-a.left)/a.width*e-this.windowLength/2);const s=t.clientX,i=this.windowStart;this.scroll.setPointerCapture?.(t.pointerId);const n=l=>this.scrollTo(i+(l.clientX-s)/a.width*e),r=()=>{this.scroll.removeEventListener("pointermove",n),this.scroll.removeEventListener("pointerup",r),this.scroll.removeEventListener("pointercancel",r)};this.scroll.addEventListener("pointermove",n),this.scroll.addEventListener("pointerup",r),this.scroll.addEventListener("pointercancel",r)}x(t){return(t-this.windowStart)/this.windowLength*100}draw(){this.host.replaceChildren(),this.lanes.clear(),this.adds.clear();for(const t of this.tracks){const a=document.createElement("button");a.type="button",a.className="track-name",a.textContent=t.label,a.addEventListener("click",()=>t.open());const e=document.createElement("div");e.className="track-lane",e.style.setProperty("--track",t.color),e.setAttribute("role","group"),e.setAttribute("aria-label",t.label),e.tabIndex=0;const s=[],i=(t.spans??[]).map(d=>{let h=s.findIndex(o=>o<=d.t);return h<0&&(h=s.push(0)-1),s[h]=d.until,{event:d,row:h}});e.style.setProperty("--rows",String(Math.max(1,s.length)));for(const{event:d,row:h}of i){const o=document.createElement("span");if(o.className="span",o.textContent=d.label,o.title=d.label,o.dataset.t=String(d.t),o.dataset.until=String(d.until),d.id!==void 0&&t.select){const c=d.id;o.dataset.id=c,o.addEventListener("pointerdown",m=>{m.stopPropagation(),t.select(c)})}o.style.top=`${h/s.length*100}%`,o.style.height=`${100/s.length}%`,e.append(o)}for(const d of t.times){const h=document.createElement("span");h.className="kf",h.dataset.t=String(d),e.append(h)}t.move&&(e.dataset.movable="");for(const d of["before","after"]){const h=document.createElement("span");h.className="outside",h.dataset.side=d,e.prepend(h)}const n=document.createElement("span");n.className="playhead",e.append(n),e.addEventListener("pointerdown",d=>this.dragPlayhead(e,t,d));const r=document.createElement("button");r.type="button",r.className="icon-btn track-add",r.innerHTML=u.PLUS,r.addEventListener("click",()=>t.add());const l=document.createElement("div");l.className="track-row",l.append(a,e,r),this.host.append(l),this.lanes.set(t.id,e),this.adds.set(t.id,r)}this.host.append(this.scroll),this.layout()}layout(){const t=this.windowStart+this.windowLength,a=Math.max(1,this.duration);for(const s of this.lanes.values()){for(const i of s.querySelectorAll(".outside")){const[n,r]=i.dataset.side==="before"?[this.windowStart,Math.min(t,0)]:[Math.max(this.windowStart,a),t];i.hidden=r<=n,i.style.left=`${this.x(n)}%`,i.style.width=`${this.x(r)-this.x(n)}%`}for(const i of s.querySelectorAll(".span")){const n=Math.max(this.windowStart,Number(i.dataset.t)),r=Math.min(t,Number(i.dataset.until));i.hidden=r<=n,i.style.left=`${this.x(n)}%`,i.style.width=`${this.x(r)-this.x(n)}%`}for(const i of s.querySelectorAll(".kf")){const n=Number(i.dataset.t);i.hidden=n<this.windowStart||n>t,i.style.left=`${this.x(n)}%`}}const e=this.extentEnd-this.extentStart;this.scroll.hidden=!this.zoomed,this.scroll.title=this.messages.zoomHint,this.thumb.style.left=`${(this.windowStart-this.extentStart)/e*100}%`,this.thumb.style.width=`${this.windowLength/e*100}%`}dragPlayhead(t,a,e){const s=this.instantAt(t,e);if(s===void 0)return;const i=this.keyNear(t,a,s);t.setPointerCapture?.(e.pointerId);let n=d=>this.seekFrom(t,a,d),r=()=>{};if(i!==void 0&&a.move){const d=[...t.querySelectorAll(".kf")].find(o=>Number(o.dataset.t)===i);let h=i;this.seekTo(i),n=o=>{const c=this.instantAt(t,o);c===void 0||!d||(h=Math.round(Math.min(this.extentEnd,Math.max(this.extentStart,c))/100)*100,d.style.left=`${this.x(h)}%`,this.seekTo(h))},r=()=>{h!==i&&a.move(i,h)}}else this.seekTo(i??s);a.pressed?.(s,i);const l=()=>{r(),t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",l)};t.addEventListener("pointermove",n),t.addEventListener("pointerup",l),t.addEventListener("pointercancel",l)}seekFrom(t,a,e){const s=this.instantAt(t,e);s!==void 0&&this.seekTo(this.keyNear(t,a,s)??s)}instantAt(t,a){const e=t.getBoundingClientRect();if(e.width!==0)return this.windowStart+(a.clientX-e.left)/e.width*this.windowLength}keyNear(t,a,e){const s=6/t.getBoundingClientRect().width*this.windowLength;return a.times.reduce((i,n)=>Math.abs(n-e)<=s&&(i===void 0||Math.abs(n-e)<Math.abs(i-e))?n:i,void 0)}seekTo(t){this.seek(Math.round(Math.min(Math.max(1,this.duration),Math.max(0,t))))}place(t){const a=this.windowStart+this.windowLength;for(const e of this.tracks){const s=this.lanes.get(e.id),i=this.adds.get(e.id);if(!s||!i)continue;const n=s.parentElement,r=n.querySelector(".track-name");e.active===void 0?(delete n.dataset.active,r?.removeAttribute("aria-pressed")):(n.dataset.active=String(e.active),r?.setAttribute("aria-pressed",String(e.active)));const l=e.times.some(o=>Math.abs(o-t)<1);for(const o of s.querySelectorAll(".kf")){const c=Number(o.dataset.t);o.setAttribute("aria-current",String(Math.abs(c-t)<1)),o.dataset.selected=String(e.selectedTime!==void 0&&Math.abs(e.selectedTime-c)<1)}for(const o of s.querySelectorAll(".span[data-id]"))o.setAttribute("aria-selected",String(o.dataset.id===e.selected));const d=s.querySelector(".playhead");d.hidden=t<this.windowStart||t>a,d.style.left=`${this.x(Math.min(Math.max(1,this.duration),t))}%`;const h=`${e.label} · ${l?this.messages.keyframeHere:this.messages.addKeyframeHere}`;i.title=h,i.setAttribute("aria-label",h)}}}export{p as T};
@@ -1,4 +1,4 @@
1
- import{I as ee,F,n as G,o as M,W as te,q as j,t as Z,u as E,v as ie,w as O,U as $,f as ne,x as I,e as se,y as B,z as oe,E as ae,H as re,G as le,C as ce,J as de,i as fe,P as ue,K as pe,N as he,O as me,Q as V,g as ge}from"./rr0-sighting.mjs";const k=new j,P=new E;class Q extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,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 te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new j);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Z),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),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(){}}I.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};O.line={uniforms:$.merge([I.common,I.fog,I.line]),vertexShader:`
1
+ import{I as ee,F,t as G,u as M,W as te,v as j,w as J,x as E,y as ie,z as O,U as $,j as ne,E as I,i as se,H as B,J as oe,K as ae,N as re,G as le,C as ce,O as de,m as fe,P as ue,Q as pe,X as he,Y as me,Z as V,h as ge}from"./rr0-sighting.mjs";const k=new j,P=new E;class Q extends ee{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new F(e,3)),this.setAttribute("uv",new F(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceStart",new M(i,3,0)),this.setAttribute("instanceEnd",new M(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new G(n,6,1);return this.setAttribute("instanceColorStart",new M(i,3,0)),this.setAttribute("instanceColorEnd",new M(i,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 te(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new j);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),k.setFromBufferAttribute(n),this.boundingBox.union(k))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new J),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let t=0;for(let o=0,l=e.count;o<l;o++)P.fromBufferAttribute(e,o),t=Math.max(t,i.distanceToSquared(P)),P.fromBufferAttribute(n,o),t=Math.max(t,i.distanceToSquared(P));this.boundingSphere.radius=Math.sqrt(t),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(){}}I.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new ne},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};O.line={uniforms:$.merge([I.common,I.fog,I.line]),vertexShader:`
2
2
  #include <common>
3
3
  #include <color_pars_vertex>
4
4
  #include <fog_pars_vertex>
@@ -390,4 +390,4 @@ import{I as ee,F,n as G,o as M,W as te,q as j,t as Z,u as E,v as ie,w as O,U as
390
390
  #include <premultiplied_alpha_fragment>
391
391
 
392
392
  }
393
- `};class N extends ie{constructor(e){super({type:"LineMaterial",uniforms:$.clone(O.line.uniforms),vertexShader:O.line.vertexShader,fragmentShader:O.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){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?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){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?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&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const H=new B,q=new E,X=new E,f=new B,u=new B,x=new B,W=new E,R=new ae,p=new oe,K=new E,T=new j,C=new Z,S=new B;let b,z;function J(h,e,n){return S.set(0,0,-e,1).applyMatrix4(h.projectionMatrix),S.multiplyScalar(1/S.w),S.x=z/n.width,S.y=z/n.height,S.applyMatrix4(h.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}function ve(h,e){const n=h.matrixWorld,i=h.geometry,t=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,t.count);for(let s=0,a=l;s<a;s++){p.start.fromBufferAttribute(t,s),p.end.fromBufferAttribute(o,s),p.applyMatrix4(n);const d=new E,m=new E;b.distanceSqToSegment(p.start,p.end,m,d),m.distanceTo(d)<z*.5&&e.push({point:m,pointOnLine:d,distance:b.origin.distanceTo(m),object:h,face:null,faceIndex:s,uv:null,uv1:null})}}function ye(h,e,n){const i=e.projectionMatrix,o=h.material.resolution,l=h.matrixWorld,s=h.geometry,a=s.attributes.instanceStart,d=s.attributes.instanceEnd,m=Math.min(s.instanceCount,a.count),c=-e.near;b.at(1,x),x.w=1,x.applyMatrix4(e.matrixWorldInverse),x.applyMatrix4(i),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,W.copy(x),R.multiplyMatrices(e.matrixWorldInverse,l);for(let g=0,r=m;g<r;g++){if(f.fromBufferAttribute(a,g),u.fromBufferAttribute(d,g),f.w=1,u.w=1,f.applyMatrix4(R),u.applyMatrix4(R),f.z>c&&u.z>c)continue;if(f.z>c){const _=f.z-u.z,w=(f.z-c)/_;f.lerp(u,w)}else if(u.z>c){const _=u.z-f.z,w=(u.z-c)/_;u.lerp(f,w)}f.applyMatrix4(i),u.applyMatrix4(i),f.multiplyScalar(1/f.w),u.multiplyScalar(1/u.w),f.x*=o.x/2,f.y*=o.y/2,u.x*=o.x/2,u.y*=o.y/2,p.start.copy(f),p.start.z=0,p.end.copy(u),p.end.z=0;const y=p.closestPointToPointParameter(W,!0);p.at(y,K);const U=re.lerp(f.z,u.z,y),L=U>=-1&&U<=1,D=W.distanceTo(K)<z*.5;if(L&&D){p.start.fromBufferAttribute(a,g),p.end.fromBufferAttribute(d,g),p.start.applyMatrix4(l),p.end.applyMatrix4(l);const _=new E,w=new E;b.distanceSqToSegment(p.start,p.end,w,_),n.push({point:w,pointOnLine:_,distance:b.origin.distanceTo(w),object:h,face:null,faceIndex:g,uv:null,uv1:null})}}}class we extends se{constructor(e=new Q,n=new N({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,t=new Float32Array(2*n.count);for(let l=0,s=0,a=n.count;l<a;l++,s+=2)q.fromBufferAttribute(n,l),X.fromBufferAttribute(i,l),t[s]=s===0?0:t[s-1],t[s+1]=t[s]+q.distanceTo(X);const o=new G(t,2,1);return e.setAttribute("instanceDistanceStart",new M(o,1,0)),e.setAttribute("instanceDistanceEnd",new M(o,1,1)),this}raycast(e,n){const i=this.material.worldUnits,t=e.camera;if(t===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),i===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;b=e.ray;const l=this.matrixWorld,s=this.geometry,a=this.material;z=a.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const c=Math.max(t.near,C.distanceToPoint(b.origin));d=J(t,c,a.resolution)}if(C.radius+=d,b.intersectsSphere(C)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),T.copy(s.boundingBox).applyMatrix4(l);let m;if(i)m=z*.5;else{const c=Math.max(t.near,T.distanceToPoint(b.origin));m=J(t,c,a.resolution)}T.expandByScalar(m),b.intersectsBox(T)!==!1&&(i?ve(this,n):ye(this,t,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(H),this.material.uniforms.resolution.value.set(H.z,H.w))}}class Y extends Q{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setColors(i),this}setFromPoints(e){const n=e.length-1,i=new Float32Array(6*n);for(let t=0;t<n;t++)i[6*t]=e[t].x,i[6*t+1]=e[t].y,i[6*t+2]=e[t].z||0,i[6*t+3]=e[t+1].x,i[6*t+4]=e[t+1].y,i[6*t+5]=e[t+1].z||0;return super.setPositions(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class xe extends we{constructor(e=new Y,n=new N({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class A{constructor(e){this.layer=e,this.group.name="traces"}static LINE_WIDTH_PX=2.5;static MARKER_SIZE_PX=9;static LABEL_HEIGHT_PX=15;static STEP_M=15;static LIFT_M=.3;group=new le;materials=[];pointsMaterials=[];labels=[];viewportHeightPx=720;fovDeg=60;set(e,n,i,t,o,l){this.empty();for(const s of e){const a=this.positions(s,i,t,o,l),d=new ce(s.color??de),m=n.get(s.id);if(m&&a.length>=3&&this.addLabel(m,this.labelAnchor(a,s.kind)),s.kind==="point"){const c=new fe;c.setAttribute("position",new F(a.slice(0,3),3));const g=new ue({color:d,size:A.MARKER_SIZE_PX,sizeAttenuation:!1,depthTest:!1,fog:!1});this.pointsMaterials.push(g);const r=new pe(c,g);r.name="trace point",r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}else if(a.length>=6){const c=new Y;c.setPositions(s.kind==="polygon"?[...a,a[0],a[1],a[2]]:a);const g=new N({color:d.getHex(),linewidth:A.LINE_WIDTH_PX,worldUnits:!1,transparent:!0,opacity:.92,depthTest:!1,fog:!1});this.materials.push(g);const r=new xe(c,g);r.name=`trace ${s.kind}`,r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}}}setView(e,n){for(const i of this.materials)i.resolution.copy(e);e.y===this.viewportHeightPx&&n===this.fovDeg||(this.viewportHeightPx=e.y,this.fovDeg=n,this.scaleLabels())}get any(){return this.group.children.length>0}dispose(){this.empty()}labelAnchor(e,n){let i=0;if(n==="line"){let t=-1;for(let o=0;o+2<e.length;o+=3){const l=Math.hypot(e[o],e[o+2]);l>t&&(t=l,i=o)}}return[e[i],e[i+1],e[i+2]]}addLabel(e,n){const i=document.createElement("canvas"),t=i.getContext("2d");if(!t)return;const o="bold 30px sans-serif";t.font=o;const l=10;i.width=Math.ceil(t.measureText(e).width)+l*2,i.height=44,t.font=o,t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.roundRect(0,0,i.width,i.height,10),t.fill(),t.fillStyle="#ffffff",t.textBaseline="middle",t.fillText(e,l,i.height/2+2);const s=new he({map:new me(i),depthTest:!1,depthWrite:!1,fog:!1,sizeAttenuation:!1}),a=new V(s);a.name="trace name",a.center.set(0,0),a.position.set(n[0],n[1],n[2]),a.frustumCulled=!1,a.layers.set(this.layer),this.labels.push({sprite:a,aspect:i.width/i.height}),this.group.add(a),this.scaleLabels()}scaleLabels(){const e=A.LABEL_HEIGHT_PX/(this.viewportHeightPx/2)*Math.tan(this.fovDeg*Math.PI/360);for(const{sprite:n,aspect:i}of this.labels)n.scale.set(e*i,e,1)}empty(){for(const e of[...this.group.children])this.group.remove(e),e instanceof V?(e.material.map?.dispose(),e.material.dispose()):e.geometry.dispose();this.labels.length=0;for(const e of this.materials.splice(0))e.dispose();for(const e of this.pointsMaterials.splice(0))e.dispose()}positions(e,n,i,t,o){const l=e.altitude??"ground",s=e.points.map(r=>{const{x:v,z:y}=ge(r.lat,r.lng,n,i);return{x:v,z:y,altM:r.altM??0}}),a=l!=="absolute",d=[],m=(r,v,y)=>l==="absolute"?y-t:o(r,v)+(l==="relative"?y:0)+A.LIFT_M,c=e.kind==="polygon",g=c?s.length:s.length-1;for(let r=0;r<Math.max(g,1);r++){const v=s[r],y=s[(r+1)%s.length],U=a&&e.kind!=="point"?Math.max(1,Math.ceil(Math.hypot(y.x-v.x,y.z-v.z)/A.STEP_M)):1;for(let L=0;L<U;L++){const D=L/U,_=v.x+(y.x-v.x)*D,w=v.z+(y.z-v.z)*D;d.push(_,m(_,w,v.altM+(y.altM-v.altM)*D),w)}}if(!c&&e.kind!=="point"){const r=s[s.length-1];d.push(r.x,m(r.x,r.z,r.altM),r.z)}return d}}export{A as TraceSystem};
393
+ `};class N extends ie{constructor(e){super({type:"LineMaterial",uniforms:$.clone(O.line.uniforms),vertexShader:O.line.vertexShader,fragmentShader:O.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){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?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){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?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&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const H=new B,X=new E,q=new E,f=new B,u=new B,x=new B,W=new E,R=new ae,p=new oe,K=new E,T=new j,C=new J,S=new B;let b,z;function Z(h,e,n){return S.set(0,0,-e,1).applyMatrix4(h.projectionMatrix),S.multiplyScalar(1/S.w),S.x=z/n.width,S.y=z/n.height,S.applyMatrix4(h.projectionMatrixInverse),S.multiplyScalar(1/S.w),Math.abs(Math.max(S.x,S.y))}function ve(h,e){const n=h.matrixWorld,i=h.geometry,t=i.attributes.instanceStart,o=i.attributes.instanceEnd,l=Math.min(i.instanceCount,t.count);for(let s=0,a=l;s<a;s++){p.start.fromBufferAttribute(t,s),p.end.fromBufferAttribute(o,s),p.applyMatrix4(n);const d=new E,m=new E;b.distanceSqToSegment(p.start,p.end,m,d),m.distanceTo(d)<z*.5&&e.push({point:m,pointOnLine:d,distance:b.origin.distanceTo(m),object:h,face:null,faceIndex:s,uv:null,uv1:null})}}function ye(h,e,n){const i=e.projectionMatrix,o=h.material.resolution,l=h.matrixWorld,s=h.geometry,a=s.attributes.instanceStart,d=s.attributes.instanceEnd,m=Math.min(s.instanceCount,a.count),c=-e.near;b.at(1,x),x.w=1,x.applyMatrix4(e.matrixWorldInverse),x.applyMatrix4(i),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,W.copy(x),R.multiplyMatrices(e.matrixWorldInverse,l);for(let g=0,r=m;g<r;g++){if(f.fromBufferAttribute(a,g),u.fromBufferAttribute(d,g),f.w=1,u.w=1,f.applyMatrix4(R),u.applyMatrix4(R),f.z>c&&u.z>c)continue;if(f.z>c){const _=f.z-u.z,w=(f.z-c)/_;f.lerp(u,w)}else if(u.z>c){const _=u.z-f.z,w=(u.z-c)/_;u.lerp(f,w)}f.applyMatrix4(i),u.applyMatrix4(i),f.multiplyScalar(1/f.w),u.multiplyScalar(1/u.w),f.x*=o.x/2,f.y*=o.y/2,u.x*=o.x/2,u.y*=o.y/2,p.start.copy(f),p.start.z=0,p.end.copy(u),p.end.z=0;const y=p.closestPointToPointParameter(W,!0);p.at(y,K);const U=re.lerp(f.z,u.z,y),L=U>=-1&&U<=1,D=W.distanceTo(K)<z*.5;if(L&&D){p.start.fromBufferAttribute(a,g),p.end.fromBufferAttribute(d,g),p.start.applyMatrix4(l),p.end.applyMatrix4(l);const _=new E,w=new E;b.distanceSqToSegment(p.start,p.end,w,_),n.push({point:w,pointOnLine:_,distance:b.origin.distanceTo(w),object:h,face:null,faceIndex:g,uv:null,uv1:null})}}}class we extends se{constructor(e=new Q,n=new N({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,t=new Float32Array(2*n.count);for(let l=0,s=0,a=n.count;l<a;l++,s+=2)X.fromBufferAttribute(n,l),q.fromBufferAttribute(i,l),t[s]=s===0?0:t[s-1],t[s+1]=t[s]+X.distanceTo(q);const o=new G(t,2,1);return e.setAttribute("instanceDistanceStart",new M(o,1,0)),e.setAttribute("instanceDistanceEnd",new M(o,1,1)),this}raycast(e,n){const i=this.material.worldUnits,t=e.camera;if(t===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),i===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;const o=e.params.Line2!==void 0&&e.params.Line2.threshold||0;b=e.ray;const l=this.matrixWorld,s=this.geometry,a=this.material;z=a.linewidth+o,s.boundingSphere===null&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(l);let d;if(i)d=z*.5;else{const c=Math.max(t.near,C.distanceToPoint(b.origin));d=Z(t,c,a.resolution)}if(C.radius+=d,b.intersectsSphere(C)===!1)return;s.boundingBox===null&&s.computeBoundingBox(),T.copy(s.boundingBox).applyMatrix4(l);let m;if(i)m=z*.5;else{const c=Math.max(t.near,T.distanceToPoint(b.origin));m=Z(t,c,a.resolution)}T.expandByScalar(m),b.intersectsBox(T)!==!1&&(i?ve(this,n):ye(this,t,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(H),this.material.uniforms.resolution.value.set(H.z,H.w))}}class Y extends Q{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setPositions(i),this}setColors(e){const n=e.length-3,i=new Float32Array(2*n);for(let t=0;t<n;t+=3)i[2*t]=e[t],i[2*t+1]=e[t+1],i[2*t+2]=e[t+2],i[2*t+3]=e[t+3],i[2*t+4]=e[t+4],i[2*t+5]=e[t+5];return super.setColors(i),this}setFromPoints(e){const n=e.length-1,i=new Float32Array(6*n);for(let t=0;t<n;t++)i[6*t]=e[t].x,i[6*t+1]=e[t].y,i[6*t+2]=e[t].z||0,i[6*t+3]=e[t+1].x,i[6*t+4]=e[t+1].y,i[6*t+5]=e[t+1].z||0;return super.setPositions(i),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class xe extends we{constructor(e=new Y,n=new N({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}class A{constructor(e){this.layer=e,this.group.name="traces"}static LINE_WIDTH_PX=2.5;static MARKER_SIZE_PX=9;static LABEL_HEIGHT_PX=15;static STEP_M=15;static LIFT_M=.3;group=new le;materials=[];pointsMaterials=[];labels=[];viewportHeightPx=720;fovDeg=60;set(e,n,i,t,o,l){this.empty();for(const s of e){const a=this.positions(s,i,t,o,l),d=new ce(s.color??de),m=n.get(s.id);if(m&&a.length>=3&&this.addLabel(m,this.labelAnchor(a,s.kind)),s.kind==="point"){const c=new fe;c.setAttribute("position",new F(a.slice(0,3),3));const g=new ue({color:d,size:A.MARKER_SIZE_PX,sizeAttenuation:!1,depthTest:!1,fog:!1});this.pointsMaterials.push(g);const r=new pe(c,g);r.name="trace point",r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}else if(a.length>=6){const c=new Y;c.setPositions(s.kind==="polygon"?[...a,a[0],a[1],a[2]]:a);const g=new N({color:d.getHex(),linewidth:A.LINE_WIDTH_PX,worldUnits:!1,transparent:!0,opacity:.92,depthTest:!1,fog:!1});this.materials.push(g);const r=new xe(c,g);r.name=`trace ${s.kind}`,r.frustumCulled=!1,r.layers.set(this.layer),this.group.add(r)}}}setView(e,n){for(const i of this.materials)i.resolution.copy(e);e.y===this.viewportHeightPx&&n===this.fovDeg||(this.viewportHeightPx=e.y,this.fovDeg=n,this.scaleLabels())}get any(){return this.group.children.length>0}dispose(){this.empty()}labelAnchor(e,n){let i=0;if(n==="line"){let t=-1;for(let o=0;o+2<e.length;o+=3){const l=Math.hypot(e[o],e[o+2]);l>t&&(t=l,i=o)}}return[e[i],e[i+1],e[i+2]]}addLabel(e,n){const i=document.createElement("canvas"),t=i.getContext("2d");if(!t)return;const o="bold 30px sans-serif";t.font=o;const l=10;i.width=Math.ceil(t.measureText(e).width)+l*2,i.height=44,t.font=o,t.fillStyle="rgba(0, 0, 0, 0.6)",t.beginPath(),t.roundRect(0,0,i.width,i.height,10),t.fill(),t.fillStyle="#ffffff",t.textBaseline="middle",t.fillText(e,l,i.height/2+2);const s=new he({map:new me(i),depthTest:!1,depthWrite:!1,fog:!1,sizeAttenuation:!1}),a=new V(s);a.name="trace name",a.center.set(0,0),a.position.set(n[0],n[1],n[2]),a.frustumCulled=!1,a.layers.set(this.layer),this.labels.push({sprite:a,aspect:i.width/i.height}),this.group.add(a),this.scaleLabels()}scaleLabels(){const e=A.LABEL_HEIGHT_PX/(this.viewportHeightPx/2)*Math.tan(this.fovDeg*Math.PI/360);for(const{sprite:n,aspect:i}of this.labels)n.scale.set(e*i,e,1)}empty(){for(const e of[...this.group.children])this.group.remove(e),e instanceof V?(e.material.map?.dispose(),e.material.dispose()):e.geometry.dispose();this.labels.length=0;for(const e of this.materials.splice(0))e.dispose();for(const e of this.pointsMaterials.splice(0))e.dispose()}positions(e,n,i,t,o){const l=e.altitude??"ground",s=e.points.map(r=>{const{x:v,z:y}=ge(r.lat,r.lng,n,i);return{x:v,z:y,altM:r.altM??0}}),a=l!=="absolute",d=[],m=(r,v,y)=>l==="absolute"?y-t:o(r,v)+(l==="relative"?y:0)+A.LIFT_M,c=e.kind==="polygon",g=c?s.length:s.length-1;for(let r=0;r<Math.max(g,1);r++){const v=s[r],y=s[(r+1)%s.length],U=a&&e.kind!=="point"?Math.max(1,Math.ceil(Math.hypot(y.x-v.x,y.z-v.z)/A.STEP_M)):1;for(let L=0;L<U;L++){const D=L/U,_=v.x+(y.x-v.x)*D,w=v.z+(y.z-v.z)*D;d.push(_,m(_,w,v.altM+(y.altM-v.altM)*D),w)}}if(!c&&e.kind!=="point"){const r=s[s.length-1];d.push(r.x,m(r.x,r.z,r.altM),r.z)}return d}}export{A as TraceSystem};
@@ -1 +1 @@
1
- import{G as O,M as w,C as A,g as M,e as R,f as v,h as D,i as F,F as L}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 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 l of s){const f=l.rings.map(i=>r.clip(i.map(h=>M(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 R(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(E=>r.contains(E,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 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,d]=[f[c],f[x],f[i]],E=(z.y-h.y)*(d.x-h.x)-(z.x-h.x)*(d.y-h.y)>0;for(const m of E?[h,z,d]:[h,d,z])a.push(m.x,n,m.y)}const g=new F;g.setAttribute("position",new L(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 L(u,3)),g.computeBoundingSphere(),g}}export{r as WaterSystem};
1
+ import{G as O,g as w,C as A,h as R,i as M,j as v,k as D,m as F,F as L}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 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 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(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 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,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])a.push(E.x,n,E.y)}const g=new F;g.setAttribute("position",new L(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 L(u,3)),g.computeBoundingSphere(),g}}export{r as WaterSystem};