@rr0/ufoathome 0.140.0 → 0.141.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed-scene/AdsbLolArchiveProvider-CO4IRthj.js +1 -0
- package/dist-embed-scene/GLTFLoader-wJ0bjCoG.js +1 -0
- package/dist-embed-scene/ReferenceSystem-BdF5Ptvm.js +1 -0
- package/dist-embed-scene/SceneNames_es-v7tJmsVK.js +1 -0
- package/dist-embed-scene/SceneNames_fr-CgU7Ms5_.js +1 -0
- package/dist-embed-scene/SceneNames_it-DljjUVi8.js +1 -0
- package/dist-embed-scene/rr0-scene.mjs +291 -291
- package/dist-embed-sighting/AdsbLolArchiveProvider-SLZYD2p1.js +1 -0
- package/dist-embed-sighting/GLTFLoader-BGUT3v5v.js +1 -0
- package/dist-embed-sighting/ReferenceSystem-CEn7MuVP.js +1 -0
- package/dist-embed-sighting/SightingMessages_es-BL3yAPR5.js +1 -0
- package/dist-embed-sighting/SightingMessages_fr-DYXapaAN.js +1 -0
- package/dist-embed-sighting/SightingMessages_it-3b421_Dl.js +1 -0
- package/dist-embed-sighting/rr0-sighting.mjs +298 -298
- package/dist-embed-sighting-editor/AdsbLolArchiveProvider-CtHllfL6.js +1 -0
- package/dist-embed-sighting-editor/{BeamEditor-CCsp2xr2.js → BeamEditor-Bko8HBqB.js} +1 -1
- package/dist-embed-sighting-editor/BeamSystem-DibQnDQt.js +1 -0
- package/dist-embed-sighting-editor/{BodyEditor-DtBz9fVX.js → BodyEditor-3Pv5hYe4.js} +1 -1
- package/dist-embed-sighting-editor/ContrailSystem-CnMn7-P3.js +1 -0
- package/dist-embed-sighting-editor/{CoverageAssessor-DbLjQSsv.js → CoverageAssessor-ZPfl-pIr.js} +1 -1
- package/dist-embed-sighting-editor/GLTFLoader-BwKeFCRw.js +1 -0
- package/dist-embed-sighting-editor/GhostSearchView-wZJh23C7.js +1 -0
- package/dist-embed-sighting-editor/HeadlightSystem-CoBP2hn0.js +34 -0
- package/dist-embed-sighting-editor/{HynekAssessor-C6Lge7G-.js → HynekAssessor-kTvEbabz.js} +1 -1
- package/dist-embed-sighting-editor/{LaserBeam-B6u7y0-E.js → LaserBeam-BuHV0CAP.js} +1 -1
- package/dist-embed-sighting-editor/LaunchEditor-B-i5uD19.js +18 -0
- package/dist-embed-sighting-editor/ModelSource-DvO3GvYu.js +1 -0
- package/dist-embed-sighting-editor/ModelThumbnails-T8FwtOCM.js +1 -0
- package/dist-embed-sighting-editor/ModelViewer-s4OyekVX.js +1 -0
- package/dist-embed-sighting-editor/PanoramaxPictures-CELY3Ecc.js +1 -0
- package/dist-embed-sighting-editor/PictureRegistration-ZngZKmqH.js +1 -0
- package/dist-embed-sighting-editor/RailwaySystem-BgkkxR-M.js +41 -0
- package/dist-embed-sighting-editor/ReferenceSystem-8Nl1IFkX.js +1 -0
- package/dist-embed-sighting-editor/{RoadMarkings-xnEtzMn8.js → RoadMarkings-BME7pFh2.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_es-BJ791O35.js → SceneNames_es-CYEwepgA.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_fr-B7V4VIzu.js → SceneNames_fr-DcmXYPbm.js} +1 -1
- package/dist-embed-sighting-editor/{SceneNames_it-Bvd-wMlt.js → SceneNames_it-Doviz6zH.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_es-CYIx9rC9.js → SightingEditorMessages_es-DtYML4wO.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_fr-Cj4oAsL_.js → SightingEditorMessages_fr-Bt-2qm0Z.js} +1 -1
- package/dist-embed-sighting-editor/{SightingEditorMessages_it-CzlDZwso.js → SightingEditorMessages_it-DK9cF3wW.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-CArVw3Pm.js → TraceSystem-BGF0P9zl.js} +2 -2
- package/dist-embed-sighting-editor/WaterSystem-BKoFKdK_.js +1 -0
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +364 -347
- package/dist-embed-sighting-editor/{trafficRuntime-BAGbGiVc.js → trafficRuntime-BoN9h4Uo.js} +2 -2
- package/package.json +1 -1
- package/dist-embed-scene/AdsbLolArchiveProvider-HY3iCExA.js +0 -1
- package/dist-embed-scene/GLTFLoader-WAZoNABx.js +0 -1
- package/dist-embed-scene/SceneNames_es-N44Pf1L2.js +0 -1
- package/dist-embed-scene/SceneNames_fr-CjP77vdN.js +0 -1
- package/dist-embed-scene/SceneNames_it-BwKgT2Yi.js +0 -1
- package/dist-embed-sighting/AdsbLolArchiveProvider-Bhh3sXD9.js +0 -1
- package/dist-embed-sighting/GLTFLoader-Zsr9YBrz.js +0 -1
- package/dist-embed-sighting/SightingMessages_es-Dh2PWDVp.js +0 -1
- package/dist-embed-sighting/SightingMessages_fr-CC8wrc-A.js +0 -1
- package/dist-embed-sighting/SightingMessages_it-DlF58PB6.js +0 -1
- package/dist-embed-sighting-editor/AdsbLolArchiveProvider-De-_PiBH.js +0 -1
- package/dist-embed-sighting-editor/BeamSystem-B3qYVuHd.js +0 -1
- package/dist-embed-sighting-editor/ContrailSystem-D9rPfOBE.js +0 -1
- package/dist-embed-sighting-editor/GLTFLoader-Clgrcwp4.js +0 -1
- package/dist-embed-sighting-editor/HeadlightSystem-wFRogS2e.js +0 -34
- package/dist-embed-sighting-editor/LaunchEditor-CPa-pltK.js +0 -18
- package/dist-embed-sighting-editor/ModelSource-D9Q4lorr.js +0 -1
- package/dist-embed-sighting-editor/ModelThumbnails-DO6uXzoW.js +0 -1
- package/dist-embed-sighting-editor/ModelViewer-Ct9JM_Rx.js +0 -1
- package/dist-embed-sighting-editor/RailwaySystem-CNhqPQHR.js +0 -41
- package/dist-embed-sighting-editor/WaterSystem-B-MThsCt.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={color:"Couleur",transparency:"Transparence",halo:"Halo",blur:"Flou",brightness:"Éclat",shapeTitle:"Nom",utcOffset:"Fuseau horaire",cloudBase:"Base des nuages",elevation:"Altitude",heightAboveGround:"Hauteur au-dessus du sol",duration:"Durée",placeName:"Lieu",latitude:"Latitude",longitude:"Longitude",heading:"Orientation",pitch:"Inclinaison",roll:"Roulis",sway:"Bougé au repos",swayTitle:"Combien le corps qui tient l'instrument fait bouger la vue hors de la marche : 1 pour une personne debout, 0 pour un trépied. Vide : 1 (0 si le compte rendu dit l'observateur paralysé)",lensGlass:"À travers",lensGlassNone:"l'objectif seul",lensGlassFilter:"un filtre sur l'objectif",lensGlassWindow:"une vitre",lensGlassWindscreen:"un pare-brise",lensDrops:"Gouttes sur le verre",lensDropsTitle:"0 à 1 : quelle part du verre extérieur les gouttes d'eau couvrent. Vide : d'après la pluie ou la neige qui tombe, sauf si le verre est à l'abri",lensCondensation:"Buée",lensCondensationTitle:"0 à 1 : buée sur le verre, comme sur un objectif passé du chaud au froid. Vide : aucune",lensDirt:"Saleté",lensDirtTitle:"0 à 1 : saleté, gras ou traces de doigts sur le verre. Vide : aucune",lensSheltered:"À l'abri de la pluie",lensShelteredTitle:"Le verre extérieur était hors de la pluie ou de la neige : sous un toit, ou derrière un pare-brise dont les essuie-glaces marchent",lightPollution:"Ciel nocturne",lightPollutionTitle:"Le zénith d'une nuit sans Lune en ce lieu, en magnitudes par seconde d'arc carrée, tel qu'un Sky Quality Meter le lit ou que l'atlas mondial de la brillance artificielle du ciel (Falchi et al. 2016, lightpollutionmap.info, « SQM ») le donne. 22 est un ciel naturel ; une banlieue est vers 19, un centre-ville vers 17. Vide : un ciel naturel",observationTime:"Début de l'observation",observationEndTime:"Fin de l'observation",assessmentGroup:"Évaluation",assessmentNames:{coverage:"Infos de l'observateur"},assessmentVerdicts:{"hynek.nl":"NL — lumière nocturne","hynek.dd":"DD — disque diurne","hynek.rv":"RV — radar-visuel","hynek.ce1":"RR1 — rencontre rapprochée","hynek.ce2":"RR2 — avec trace physique","hynek.ce3":"RR3 — avec occupants"},timeQualifierApproximate:"Approximative",timeQualifierUncertain:"Incertaine",timeQualifierBoth:"Incertaine et approximative",timeSeasonSpring:"Printemps",timeSeasonSummer:"Été",timeSeasonAutumn:"Automne",timeSeasonWinter:"Hiver",summaryGroups:{observation:"Observation",location:"Position",temporal:"Moment",weather:"Météo",sound:"Son"},summaryGroup:"Résumé",summaryDescription:"Description",closeDescription:"Fermer la description",observerGroup:"Observateur",observerId:"ID",observerTitle:"Titre",observerLastName:"Nom de famille",observerFirstNames:"Prénoms",sightingId:"ID",tags:"Mots-clés",cloudCover:"Couverture nuageuse",highCloudCover:"Nuages de glace (cirrus)",focalLength:"Focale",fieldOfView:"Champ de vision",aperture:"Diaphragme",exposure:"Temps de pose",focusDistance:"Mise au point à",iceCrystalAlignment:"Alignement des cristaux",rareIceCrystals:"Cristaux rares",cloudDarkness:"Obscurité des nuages",precipitationType:"Précipitations",precipitationNone:"Aucune",precipitationRain:"Pluie",precipitationSnow:"Neige",precipitationHail:"Grêle",precipitationIntensity:"Intensité",windDirection:"Direction du vent",windSpeed:"Force du vent",storm:"Orage",cloudsGroup:"Nuages",precipitationGroup:"Précipitations",windGroup:"Vent",soundKind:"Son",soundNone:"Aucun (silencieux)",soundHum:"Bourdonnement",soundWhistle:"Sifflement",soundRumble:"Grondement",soundCrackle:"Crépitement",soundVolume:"Intensité sonore",soundPitch:"Hauteur",soundSrc:"Enregistrement",instrument:"Observé avec",filter:"Devant lui",filterNone:"rien",filterSolarVisual:"un filtre solaire pour l'œil (lunettes d'éclipse, densité 5)",filterSolarPhoto:"un film solaire pour appareil photo (densité 3,8)",decorAircraft:"Aéronef",decorEntity:"Être",decorAltitude:"Altitude",decorLights:"Feux",decorLightsNone:"aucun",decor:"Décor",decorBuilding:"Bâtiment",decorTree:"Arbre",decorShrub:"Buisson",decorBridge:"Pont",decorWire:"Ligne aérienne",decorCrop:"Rang de culture",decorTerrace:"Restanque (terrasse)",decorMound:"Tas de pierres",decorWall:"Muret de pierres sèches",decorStreetlight:"Lampadaire",decorTrafficLight:"Feu de circulation",decorCrossing:"Passage piéton",decorRoadSign:"Panneau de signalisation",decorVehicle:"Véhicule",decorObserver:"Autre observateur",decorEast:"Distance à l'est",decorNorth:"Distance au nord",decorHeading:"Orientation",decorColor:"Couleur",decorLit:"Allumé",decorTitle:"Nom",milestones:"Moments",milestoneLabel:"Repère",milestoneNote:"Ce qui se passe",addMilestone:"Nommer cet instant",deleteMilestone:"Supprimer le moment",goToMilestone:"Aller à ce moment",decorWidth:"Largeur",decorLength:"Longueur",decorHeight:"Hauteur",decorModel:"Modèle 3D",decorModelAdvanced:"Modèle depuis une adresse",decorModelUrl:"Adresse glTF/GLB",decorModelTitle:"Nom du modèle",decorModelAuthor:"Auteur",decorModelLicense:"Licence",decorModelSource:"Provenance",decorObserverSide:"Emplacement de l'observateur",decorObserverSideNone:"Non présent",decorSideFront:"Avant",decorSideBehind:"Arrière",decorSideLeft:"Gauche",decorSideRight:"Droite",decorSideFrontLeft:"Avant-gauche",decorSideFrontRight:"Avant-droit",decorSideBehindLeft:"Arrière-gauche",decorSideBehindRight:"Arrière-droit"},r={...e,accountBy:"Compte rendu de",unnamedObserver:"Observateur {n}",about:"À propos",close:"Fermer",observation:"Observation",date:"Date",location:"Lieu",case:"Dossier",description:"Description",source:"Source",basis:{measured:"mesuré",stated:"énoncé",derived:"déduit",assumed:"supposé"},credits:"Crédits",editThisObservation:"Éditer cette observation",share:"Partager",embedObservation:"Intégrer l'observation",back:"Retour",shareScope:"Partager",shareScopeCase:"Le dossier entier",shareOpensOn:"S'ouvre sur",shareStartAt:"Commencer à",shareOptionLabels:"Afficher les chips",shareOptionMap:"Ouvrir la carte",shareOptionMilestones:"Afficher les moments",shareOptionCompare:"Comparer au compte rendu",showLabels:"Afficher ce qu'elle indique",interpretation:"Interprétation",account:"Compte rendu",interpretationBy:"{title}, par {by}",confrontation:"Face au compte rendu",confrontationDirection:"écart de {deg}°",confrontationWidth:"largeur ×{ratio}",confrontationHeight:"hauteur ×{ratio}",showComparison:"Comparer au compte rendu",hideComparison:"Ne plus comparer au compte rendu",hideLabels:"Masquer ce qu'elle indique",variant:"Variante : {name}",verdicts:{consolidated:"compatible avec des biais consolidés",contested:"seulement en invoquant des biais contestés",incompatible:"incompatible même aux bornes"},variantFields:{time:"Heure",heading:"Direction",elevation:"Hauteur",size:"Taille",duration:"Durée",sweep:"Balayage dans le ciel"},variantReadings:{grouped:"des lumières lues comme un seul corps","still-seen-moving":"une lumière fixe vue en mouvement","moving-seen-still":"une lumière en mouvement vue immobile","brightening-as-approach":"un éclat croissant lu comme un rapprochement"}};export{r as sightingMessages_fr};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={color:"Colore",transparency:"Trasparenza",halo:"Alone",blur:"Sfocatura",brightness:"Brillantezza",shapeTitle:"Nome",utcOffset:"Fuso orario",cloudBase:"Base delle nuvole",elevation:"Altitudine",heightAboveGround:"Altezza dal suolo",duration:"Durata",placeName:"Luogo",latitude:"Latitudine",longitude:"Longitudine",heading:"Orientamento",pitch:"Inclinazione",roll:"Rollio",sway:"Oscillazione a riposo",swayTitle:"Quanto il corpo che regge lo strumento muove la vista quando non cammina: 1 per una persona in piedi, 0 per un treppiede. Vuoto: 1 (0 se il resoconto dice che l'osservatore era paralizzato)",lensGlass:"Attraverso",lensGlassNone:"il solo obiettivo",lensGlassFilter:"un filtro sull'obiettivo",lensGlassWindow:"una finestra",lensGlassWindscreen:"un parabrezza",lensDrops:"Gocce sul vetro",lensDropsTitle:"Da 0 a 1: quanta parte del vetro esterno coprono le gocce d'acqua. Vuoto: secondo la pioggia o la neve che cade, salvo se il vetro è al riparo",lensCondensation:"Condensa",lensCondensationTitle:"Da 0 a 1: condensa sul vetro, come su un obiettivo passato dal caldo al freddo. Vuoto: nessuna",lensDirt:"Sporco",lensDirtTitle:"Da 0 a 1: sporco, unto o impronte sul vetro. Vuoto: nessuno",lensSheltered:"Al riparo dalla pioggia",lensShelteredTitle:"Il vetro esterno era fuori dalla pioggia o dalla neve: sotto un tetto, o dietro un parabrezza con i tergicristalli in funzione",lightPollution:"Cielo notturno",lightPollutionTitle:"Lo zenit di una notte senza Luna in questo luogo, in magnitudini per secondo d'arco quadrato, come lo legge uno Sky Quality Meter o lo dà l'atlante mondiale della brillanza artificiale del cielo (Falchi et al. 2016, lightpollutionmap.info, «SQM»). 22 è un cielo naturale; una periferia è intorno a 19, un centro città a 17. Vuoto: un cielo naturale",observationTime:"Inizio dell'osservazione",observationEndTime:"Fine dell'osservazione",assessmentGroup:"Valutazione",assessmentNames:{coverage:"Dati dell'osservatore"},assessmentVerdicts:{"hynek.nl":"NL — luce notturna","hynek.dd":"DD — disco diurno","hynek.rv":"RV — radar-visivo","hynek.ce1":"IR1 — incontro ravvicinato","hynek.ce2":"IR2 — con traccia fisica","hynek.ce3":"IR3 — con entità"},timeQualifierApproximate:"Approssimativa",timeQualifierUncertain:"Incerta",timeQualifierBoth:"Incerta e approssimativa",timeSeasonSpring:"Primavera",timeSeasonSummer:"Estate",timeSeasonAutumn:"Autunno",timeSeasonWinter:"Inverno",summaryGroups:{observation:"Osservazione",location:"Posizione",temporal:"Tempo",weather:"Meteo",sound:"Suono"},summaryGroup:"Riepilogo",summaryDescription:"Descrizione",closeDescription:"Chiudi la descrizione",observerGroup:"Osservatore",observerId:"ID",observerTitle:"Titolo",observerLastName:"Cognome",observerFirstNames:"Nomi",sightingId:"ID",tags:"Etichette",cloudCover:"Copertura nuvolosa",highCloudCover:"Nubi di ghiaccio (cirri)",focalLength:"Lunghezza focale",fieldOfView:"Campo visivo",aperture:"Apertura",exposure:"Esposizione",focusDistance:"Messa a fuoco a",iceCrystalAlignment:"Allineamento dei cristalli",rareIceCrystals:"Cristalli rari",cloudDarkness:"Oscurità delle nuvole",precipitationType:"Precipitazioni",precipitationNone:"Nessuna",precipitationRain:"Pioggia",precipitationSnow:"Neve",precipitationHail:"Grandine",precipitationIntensity:"Intensità",windDirection:"Direzione del vento",windSpeed:"Velocità del vento",storm:"Temporale",cloudsGroup:"Nuvole",precipitationGroup:"Precipitazioni",windGroup:"Vento",soundKind:"Suono",soundNone:"Nessuno (silenzioso)",soundHum:"Ronzio",soundWhistle:"Fischio",soundRumble:"Rombo",soundCrackle:"Crepitio",soundVolume:"Volume",soundPitch:"Tono",soundSrc:"Registrazione",instrument:"Osservato con",filter:"Davanti",filterNone:"niente",filterSolarVisual:"un filtro solare per l'occhio (occhiali da eclissi, densità 5)",filterSolarPhoto:"una pellicola solare per fotocamera (densità 3,8)",decorAircraft:"Aeromobile",decorEntity:"Essere",decorAltitude:"Altitudine",decorLights:"Luci",decorLightsNone:"nessuna",decor:"Ambiente",decorBuilding:"Edificio",decorTree:"Albero",decorShrub:"Cespuglio",decorBridge:"Ponte",decorWire:"Linea aerea",decorCrop:"Filare di coltura",decorTerrace:"Terrazzamento",decorMound:"Mucchio di pietre",decorWall:"Muretto a secco",decorStreetlight:"Lampione",decorTrafficLight:"Semaforo",decorCrossing:"Attraversamento pedonale",decorRoadSign:"Segnale stradale",decorVehicle:"Veicolo",decorObserver:"Altro osservatore",decorEast:"Distanza a est",decorNorth:"Distanza a nord",decorHeading:"Orientamento",decorColor:"Colore",decorLit:"Acceso",decorTitle:"Nome",milestones:"Momenti",milestoneLabel:"Etichetta",milestoneNote:"Cosa succede",addMilestone:"Dai un nome a questo momento",deleteMilestone:"Elimina momento",goToMilestone:"Vai a questo momento",decorWidth:"Larghezza",decorLength:"Lunghezza",decorHeight:"Altezza",decorModel:"Modello 3D",decorModelAdvanced:"Modello da un indirizzo",decorModelUrl:"Indirizzo glTF/GLB",decorModelTitle:"Nome del modello",decorModelAuthor:"Autore",decorModelLicense:"Licenza",decorModelSource:"Provenienza",decorObserverSide:"Posizione dell'osservatore",decorObserverSideNone:"Non presente",decorSideFront:"Davanti",decorSideBehind:"Dietro",decorSideLeft:"Sinistra",decorSideRight:"Destra",decorSideFrontLeft:"Davanti a sinistra",decorSideFrontRight:"Davanti a destra",decorSideBehindLeft:"Dietro a sinistra",decorSideBehindRight:"Dietro a destra"},o={...e,accountBy:"Resoconto di",unnamedObserver:"Osservatore {n}",about:"Informazioni",close:"Chiudi",observation:"Osservazione",date:"Data",location:"Luogo",case:"Caso",description:"Descrizione",source:"Fonte",basis:{measured:"misurato",stated:"dichiarato",derived:"dedotto",assumed:"supposto"},credits:"Crediti",editThisObservation:"Modifica questa osservazione",share:"Condividi",embedObservation:"Incorpora l'osservazione",back:"Indietro",shareScope:"Condividi",shareScopeCase:"Il caso intero",shareOpensOn:"Si apre su",shareStartAt:"Inizia a",shareOptionLabels:"Mostra i chip",shareOptionMap:"Apri la mappa",shareOptionMilestones:"Mostra i momenti",shareOptionCompare:"Confronta col resoconto",showLabels:"Mostra ciò che indica",interpretation:"Interpretazione",account:"Resoconto",interpretationBy:"{title}, di {by}",confrontation:"A confronto con il resoconto",confrontationDirection:"scarto di {deg}°",confrontationWidth:"larghezza ×{ratio}",confrontationHeight:"altezza ×{ratio}",showComparison:"Confronta con il resoconto",hideComparison:"Smetti di confrontare con il resoconto",hideLabels:"Nascondi ciò che indica",variant:"Variante: {name}",verdicts:{consolidated:"compatibile con distorsioni consolidate",contested:"solo invocando distorsioni contestate",incompatible:"incompatibile anche ai limiti"},variantFields:{time:"Ora",heading:"Direzione",elevation:"Altezza",size:"Dimensione",duration:"Durata",sweep:"Percorso nel cielo"},variantReadings:{grouped:"luci lette come un solo corpo","still-seen-moving":"una luce ferma vista muoversi","moving-seen-still":"una luce in moto vista immobile","brightening-as-approach":"una luminosità crescente letta come un avvicinamento"}};export{o as sightingMessages_it};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as M,Q as y,G as I}from"./rr0-sighting-editor.mjs";class d{static RECORD_BYTES=20;static NON_ICAO_FLAG=1<<24;static UNKNOWN=65535;static MAX_DT=35999;static decode(t){if(t.length%d.RECORD_BYTES!==0)throw new Error(`An aircraft tile is a multiple of ${d.RECORD_BYTES} bytes, not ${t.length}`);const e=new DataView(t.buffer,t.byteOffset,t.byteLength),c=[];for(let n=0;n<t.length;n+=d.RECORD_BYTES){const a=e.getUint32(n,!0),s=e.getUint16(n+16,!0),r=e.getUint16(n+18,!0);c.push({icao:a&16777215,nonIcao:(a&d.NON_ICAO_FLAG)!==0,secondsInHour:e.getUint16(n+4,!0)/10,lat:e.getInt32(n+6,!0)/1e5,lng:e.getInt32(n+10,!0)/1e5,altitudeFt:e.getInt16(n+14,!0)*25,groundSpeedKt:s===d.UNKNOWN?void 0:s/10,trackDeg:r===d.UNKNOWN?void 0:r/10})}return c}}const w="https://ufoathome.org/aircraft/index.json";class f{citation=M;static DEFAULT_RADIUS_KM=150;static FLAG_MILITARY=1;static FLAG_PIA=4;static FLAG_LADD=8;static KM_PER_DEG=111.32;static HOUR_MS=36e5;fetchImpl;indexUrls;index;hours=new Map;tiles=new Map;shards=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.indexUrls=t.indexUrls??f.defaultIndexUrls()}static defaultIndexUrls(){const t=[];return typeof location<"u"&&/^https?:$/.test(location.protocol)&&t.push(new URL("/aircraft/index.json",location.href).href),t.includes(w)||t.push(w),t}mayCover(t){return y.mayCover(t)}async between(t,e,c,n=f.DEFAULT_RADIUS_KM){const a=await this.loadIndex();if(!a)return{status:"failed"};const s=[];for(let o=Math.floor(e/f.HOUR_MS);o<=Math.floor(c/f.HOUR_MS);o++)s.push(o);if(!s.every(o=>a.index.days.includes(f.dayOf(o))))return{status:"outside"};const r=f.tilesAround(t,n);try{const o=(await Promise.all(s.flatMap(u=>r.map(i=>this.tileOf(a.base,u,i))))).flat();return{status:"found",tracks:f.merge(o,t,e,c,n)}}catch{return{status:"failed"}}}async describe(t,e){const c=await this.loadIndex();if(!c)return;const n=t.icao.toString(16).padStart(6,"0"),a=t.nonIcao?"non-icao":n.slice(0,2),s=`${e}/${a}`;let r=this.shards.get(s);r||(r=this.fetchImpl(new URL(`${e}/aircraft/${a}.json`,c.base).href).then(g=>g.ok?g.json():{}).catch(()=>({})),this.shards.set(s,r));const o=(await r)[t.nonIcao?`~${n}`:n];if(!o)return;const[u,i,l,h=0]=o,p={registration:u||void 0,type:i||void 0,category:l||void 0,military:(h&f.FLAG_MILITARY)!==0||void 0,restricted:(h&(f.FLAG_PIA|f.FLAG_LADD))!==0||void 0};return Object.values(p).some(g=>g!==void 0)?p:void 0}static tilesAround(t,e){const c=e/f.KM_PER_DEG,n=Math.max(-90,t.lat-c),a=Math.min(90,t.lat+c),s=Math.cos(Math.max(Math.abs(n),Math.abs(a))*Math.PI/180),r=s<1e-6?180:e/(f.KM_PER_DEG*s),o=new Set;if(r>=180)for(let i=-180;i<180;i++)o.add(i);else for(let i=Math.floor(t.lng-r);i<=Math.floor(t.lng+r);i++)o.add(I.wrapLongitude(i));const u=[];for(let i=Math.floor(n);i<=Math.min(89,Math.floor(a));i++)for(const l of o)u.push(`${i}_${l}`);return u}static dayOf(t){return new Date(t*f.HOUR_MS).toISOString().slice(0,10)}static merge(t,e,c,n,a){const s=new Map;for(const o of t){const u=o.points.filter(h=>h.t>=c&&h.t<=n&&I.groundDistanceKm(e,h)<=a);if(u.length===0)continue;const i=`${o.nonIcao?"~":""}${o.icao}`,l=s.get(i);l?l.points.push(...u):s.set(i,{icao:o.icao,nonIcao:o.nonIcao,points:u})}const r=[...s.values()];for(const o of r)o.points.sort((u,i)=>u.t-i.t);return r.sort((o,u)=>o.icao-u.icao)}loadIndex(){return this.index??=(async()=>{for(const t of this.indexUrls)try{const e=await this.fetchImpl(t);if(e.ok)return{index:await e.json(),base:t}}catch{}})(),this.index}tileOf(t,e,c){const n=f.dayOf(e),a=String(e%24).padStart(2,"0"),s=`${n}/${a}/${c}`;let r=this.tiles.get(s);return r||(r=this.hourIndex(t,n,a).then(async o=>{const u=o[c];if(!u)return[];const[i,l]=u,h=await this.fetchImpl(new URL(`${n}/${a}.pack`,t).href,{headers:{Range:`bytes=${i}-${i+l-1}`}});if(!h.ok)throw new Error(`The pack of ${n} ${a} h answered ${h.status}`);const p=new Uint8Array(await h.arrayBuffer()),g=h.status===206?p:p.subarray(i,i+l);return f.tracksOf(await f.gunzip(g),e)}),r.catch(()=>this.tiles.delete(s)),this.tiles.set(s,r)),r}hourIndex(t,e,c){const n=`${e}/${c}`;let a=this.hours.get(n);return a||(a=this.fetchImpl(new URL(`${e}/${c}.json`,t).href).then(s=>{if(s.status===404)return{};if(!s.ok)throw new Error(`The index of ${e} ${c} h answered ${s.status}`);return s.json()}),a.catch(()=>this.hours.delete(n)),this.hours.set(n,a)),a}static async gunzip(t){const e=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));return new Uint8Array(await new Response(e).arrayBuffer())}static tracksOf(t,e){const c=new Map;for(const n of d.decode(t)){const a=`${n.nonIcao?"~":""}${n.icao}`;let s=c.get(a);s||c.set(a,s={icao:n.icao,nonIcao:n.nonIcao,points:[]}),s.points.push({t:e*f.HOUR_MS+n.secondsInHour*1e3,lat:n.lat,lng:n.lng,altitudeFt:n.altitudeFt,groundSpeedKt:n.groundSpeedKt,trackDeg:n.trackDeg})}return[...c.values()]}}export{f as AdsbLolArchiveProvider,w as UFOATHOME_AIRCRAFT_INDEX_URL};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as P,aj as V,al as H,a0 as W,aF as X,aG as D,aH as F}from"./rr0-sighting-editor.mjs";import{L as f}from"./LaserBeam-B6u7y0-E.js";class M{static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new P;mesh;positions=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);colors=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new V;s.setAttribute("position",new H(this.positions,3)),s.setAttribute("color",new H(this.colors,3)),s.setDrawRange(0,0),this.mesh=new W(s,new X({vertexColors:!0,transparent:!0,blending:F,depthWrite:!1,fog:!1,side:D})),this.mesh.frustumCulled=!1,this.mesh.renderOrder=8,this.mesh.name="beams",this.group.name="beams",this.group.add(this.mesh)}get segmentCount(){return this.segments}update(s,t,o){const c=this.viewsOf(s,t,o);let r=0;this.segments=0,this.drawn=[];for(const i of c){const l=f.colourOf(i.wavelengthNm),h=this.place(i,o);this.drawn.push({id:i.id,points:h});for(let u=0;u+1<h.length&&!(this.segments>=M.MAX_SEGMENTS);u++){const A=this.pushSegment(r,h[u],h[u+1],i.wavelengthNm,l,o);A>r&&this.segments++,r=A}}const n=this.mesh.geometry;n.setDrawRange(0,r);for(const i of["position","color"]){const l=n.getAttribute(i);l.clearUpdateRanges(),r>0&&l.addUpdateRange(0,r*3),l.needsUpdate=!0}}viewsOf(s,t,o){const{lat:c,lng:r}=o.reference;(!this.cut||this.cut.lat!==c||this.cut.lng!==r||this.cut.air!==o.air)&&(this.cut={lat:c,lng:r,air:o.air,views:new Map});const n=this.cut.views;return f.onAt(s,t).map(i=>{let l=n.get(i);return l||n.set(i,l={id:i.id,wavelengthNm:i.wavelengthNm,samples:f.samplesOf(i,o.reference,o.air)}),l})}place(s,t){const o=[];for(const c of s.samples){const r=t.origin.x+c.eastM*t.eastScale,n=t.origin.z-c.northM,i=c.upM-t.siteElevationM;if(o.length>0&&i<t.groundYAt(r,n))break;o.push({x:r,y:i,z:n,altitudeM:c.altitudeM,widthM:c.widthM,powerW:c.powerW})}return o}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,o,c,r,n,i=0){const l={x:o.x-t.x,y:o.y-t.y,z:o.z-t.z},h=Math.hypot(l.x,l.y,l.z);if(h<1e-6)return s;const u={x:l.x/h,y:l.y/h,z:l.z/h};if(Math.hypot((t.x+o.x)/2-n.eye.x,(t.y+o.y)/2-n.eye.y,(t.z+o.z)/2-n.eye.z)<.001)return s;const A=e=>{const y={x:n.eye.x-e.x,y:n.eye.y-e.y,z:n.eye.z-e.z},z=Math.hypot(y.x,y.y,y.z)||.001,p=(u.x*y.x+u.y*y.y+u.z*y.z)/z,a=Math.sqrt(Math.max(0,1-p*p)),w=f.phasedScattering(f.coefficientsAt(n.air,c,e.altitudeM),p);return{sinTurn:a,scattered:w,through:n.transmittanceTo(e.x,e.y,e.z)}},T=e=>M.MIN_PIXELS*n.pixelRad*Math.hypot(e.x-n.eye.x,e.y-n.eye.y,e.z-n.eye.z),m=e=>Math.hypot(e.x-n.eye.x,e.y-n.eye.y,e.z-n.eye.z),R=e=>Math.max(e.widthM,M.HALO_RAD*m(e)),g=e=>{const y=R(e)/T(e),z=Math.min(1,Math.max(0,y-1));return M.HALO_SHARE*z*z*(3-2*z)},I=new Map([t,o].map(e=>[e,A(e)])),x=(e,y,z)=>{const p=Math.max(y,T(e)),{sinTurn:a,scattered:w,through:E}=I.get(e),O=2*z*f.luminanceCdM2(e.powerW,c,w,p,a),N=r.map((v,C)=>Math.min(M.BRIGHTEST_RELATIVE,O*n.relativeScale*v*E[C])),L={x:n.eye.x-e.x,y:n.eye.y-e.y,z:n.eye.z-e.z},_=this.normalise(this.cross(u,L));return{point:e,half:p/2,level:N,across:_}},d=[[x(t,t.widthM,1-g(t)),x(o,o.widthM,1-g(o))],[x(t,R(t),g(t)),x(o,R(o),g(o))]],[G,S]=d[0].map(e=>Math.max(...e.level));if(i<M.MAX_HALVINGS&&Math.max(G,S)>M.SMOOTH_RATIO*Math.max(Math.min(G,S),1e-12)){const e={x:(t.x+o.x)/2,y:(t.y+o.y)/2,z:(t.z+o.z)/2,altitudeM:(t.altitudeM+o.altitudeM)/2,widthM:(t.widthM+o.widthM)/2,powerW:Math.sqrt(t.powerW*o.powerW)};return this.pushSegment(this.pushSegment(s,t,e,c,r,n,i+1),e,o,c,r,n,i+1)}if((s+M.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const e of d){if(e.every(a=>Math.max(...a.level)<=0))continue;const y=(a,w)=>{const E=s*3;this.positions[E]=a.point.x+a.across.x*a.half*w,this.positions[E+1]=a.point.y+a.across.y*a.half*w,this.positions[E+2]=a.point.z+a.across.z*a.half*w;const O=w===0?1:0;this.colors[E]=a.level[0]*O,this.colors[E+1]=a.level[1]*O,this.colors[E+2]=a.level[2]*O,s++},[z,p]=e;for(const a of[-1,1])y(z,a),y(z,0),y(p,a),y(z,0),y(p,0),y(p,a)}return s}pickAt(s,t,o){let c;for(const r of this.drawn)for(let n=0;n+1<r.points.length;n++){const i=r.points[n],l=r.points[n+1],h={x:l.x-i.x,y:l.y-i.y,z:l.z-i.z},u={x:i.x-s.x,y:i.y-s.y,z:i.z-s.z},A=h.x*h.x+h.y*h.y+h.z*h.z,T=h.x*t.x+h.y*t.y+h.z*t.z,m=h.x*u.x+h.y*u.y+h.z*u.z,R=t.x*u.x+t.y*u.y+t.z*u.z,g=A-T*T,I=g>1e-9?Math.min(1,Math.max(0,(T*R-m)/g)):0,x={x:i.x+h.x*I,y:i.y+h.y*I,z:i.z+h.z*I},d=(x.x-s.x)*t.x+(x.y-s.y)*t.y+(x.z-s.z)*t.z;if(d<=0)continue;const G=Math.hypot(x.x-s.x-t.x*d,x.y-s.y-t.y*d,x.z-s.z-t.z*d),S=Math.atan2(G,d);S<=o&&(!c||S<c.angle)&&(c={id:r.id,distanceM:Math.hypot(x.x-s.x,x.y-s.y,x.z-s.z),angle:S})}return c&&{id:c.id,distanceM:c.distanceM}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{M as BeamSystem};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as F,aj as m,al as I,a0 as X,aF as D,aG as L}from"./rr0-sighting-editor.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new F;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new m;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new X(t,new D({vertexColors:!0,transparent:!0,depthWrite:!1,side:L})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aK as Le,aL as Q,aM as he,aN as Me,aO as v,aP as de,ae as b,ah as pe,af as F,aQ as w,aR as U,aI as Se,aS as ye,a7 as be,ax as K,aT as we,a9 as C,aU as me,aV as Ne,aW as ge,aX as Ie,aY as Oe,al as V,aZ as Ce,a_ as Te,a$ as Fe,b0 as Pe,b1 as He,b2 as J,b3 as Re,b4 as Z,b5 as ke,b6 as De,aA as Ge,b7 as X,b8 as ve,a2 as Ee,aG as Ue,aF as G,b9 as Ke,aj as Be,ba as je,a0 as Ve,bb as Xe,bc as ze,bd as qe,aB as We,Y as z,a8 as Ye,ay as Qe,be as Je,bf as Ze,bg as $e,bh as en,bi as nn,bj as tn,bk as xe,ap as sn,bl as ne,bm as te,bn as se,bo as ie,bp as re,bq as rn,br as on,a3 as an,a4 as cn}from"./rr0-sighting-editor.mjs";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class jn extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new Sn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new yn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===Ae){try{r[g.KHR_BINARY_GLTF]=new bn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function _(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new be(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ye(u),c.distance=l;break;case"spot":c=new Se(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),y(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],w),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],w)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class Sn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class yn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,A=new C(1,1,1),x=new we(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&A.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,A));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const Ae="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class bn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ae)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,w,h)})})}}class Nn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class _e extends on{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,A=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=A*L+x*N+m*S+T*k}return i}}const On=new me;class Cn extends _e{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:tn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:rn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function y(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),y(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),A="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(A);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(A,x)),m=new sn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,A=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new A(r[1],x,t.sparse.count*T),N=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,k=L.length;S<k;S++){const P=L[S];if(m.setX(P,N[S*o]),o>=2&&m.setY(P,N[S*o+1]),o>=3&&m.setZ(P,N[S*o+2]),o>=4&&m.setW(P,N[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),y(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],w),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],w)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),y(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const A=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,A):new Ve(R,A),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,A);else if(m.mode===M.LINE_STRIP)T=new ze(R,A);else if(m.mode===M.LINE_LOOP)T=new qe(R,A);else if(m.mode===M.POINTS)T=new We(R,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),y(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),y(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,A=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",A)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],N=d[x],S=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const A=new $e(i,void 0,T);return y(A,t),A})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),y(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),y(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(nn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:_e;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new an;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new cn;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),y(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{aI as b,a0 as g,a9 as P,aJ as m,aj as C,al as E,ar as L,af as x,aG as I,aH as R}from"./rr0-sighting-editor.mjs";class i{constructor(e){this.scene=e}static REAL_BEAMS=4;static LAMPS=2;static DISTANCE_M=500;static AIR_LENGTH_M=90;static CLEAR_AIR_SCATTER_PER_M=2e-4;static SHADOW_MAP_PX=1024;beams=new Map;static airGeometry;has(e){return this.beams.has(e)}get size(){return this.beams.size}lamps(e){return this.beams.get(e)?.lamps??[]}airMeshes(e){return this.beams.get(e)?.air??[]}add(e){if(this.beams.has(e))return!0;if(this.beams.size>=i.REAL_BEAMS)return!1;const t=[],r=[];for(let n=0;n<i.LAMPS;n++){const a=new b(16777215,0,i.DISTANCE_M,Math.PI/8,.5,2);a.castShadow=e==="observer",a.shadow.mapSize.set(i.SHADOW_MAP_PX,i.SHADOW_MAP_PX),a.shadow.camera.near=.4,a.shadow.camera.far=110,a.shadow.bias=-4e-4,a.shadow.normalBias=.04,a.shadow.radius=2,this.scene.add(a),this.scene.add(a.target),t.push(a);const o=new g(i.airCone(),i.airMaterial());o.visible=!1,o.frustumCulled=!1,o.renderOrder=8,o.castShadow=!1,o.receiveShadow=!1,o.name="headlight air",this.scene.add(o),r.push(o)}return this.beams.set(e,{lamps:t,air:r}),!0}remove(e){const t=this.beams.get(e);if(t){for(const r of t.lamps)r.removeFromParent(),r.target.removeFromParent(),r.dispose();for(const r of t.air)r.removeFromParent(),r.material.dispose();this.beams.delete(e)}}clear(e){for(const t of[...this.beams.keys()])e&&t==="observer"||this.remove(t)}dispose(){this.clear(!1),i.airGeometry?.dispose(),i.airGeometry=void 0}aim(e,t,r,n,a,o,u){const c=this.beams.get(e),w=Math.max(u,i.CLEAR_AIR_SCATTER_PER_M);if(!c)return;const l=m.BEAMS[t],f=new P(-n.z,0,n.x),A=e==="observer"&&l!==void 0;c.lamps.forEach((s,d)=>{if(!l){s.intensity=0,c.air[d].visible=!1,s.shadow.autoUpdate=!1;return}const v=d===0?-1:1,h=l.pitchDeg*Math.PI/180,p=l.candela*m.DISPLAY_GAIN*o/c.lamps.length;s.color.set(l.color),s.intensity=p,s.angle=l.halfAngleDeg*Math.PI/180,s.penumbra=l.penumbra,A?(s.shadow.autoUpdate||(s.shadow.needsUpdate=!0),s.shadow.autoUpdate=!0):s.shadow.autoUpdate=!1,s.position.copy(r).addScaledVector(f,v*a);const M=n.clone().addScaledVector(f,-v*Math.tan(m.TOE_IN_DEG*Math.PI/180)).normalize();s.target.position.set(s.position.x+M.x*Math.cos(h)*50,s.position.y-Math.sin(h)*50,s.position.z+M.z*Math.cos(h)*50),s.target.updateMatrixWorld(),this.aimAir(c.air[d],s,l.color,p,w)})}aimAir(e,t,r,n,a){if(e.visible=a*n>1e-4,!e.visible)return;const o=i.AIR_LENGTH_M,u=o*Math.tan(t.angle);e.position.copy(t.position),e.scale.set(u,u,o),e.lookAt(t.target.position),e.updateMatrixWorld();const c=e.material.uniforms;c.uColor.value.set(r),c.uCandela.value=n,c.uScatter.value=a,c.uLength.value=o,c.uRadius.value=u}static airCone(){if(i.airGeometry)return i.airGeometry;const e=24,t=new Float32Array((e+1)*3);for(let a=0;a<e;a++){const o=a/e*Math.PI*2;t.set([Math.cos(o),Math.sin(o),1],(a+1)*3)}const r=[];for(let a=0;a<e;a++)r.push(0,1+a,1+(a+1)%e);const n=new C;return n.setAttribute("position",new E(t,3)),n.setIndex(r),i.airGeometry=n,n}static airMaterial(){return new L({transparent:!0,depthWrite:!1,depthTest:!0,blending:R,side:I,uniforms:{uColor:{value:new x(1,1,1)},uCandela:{value:0},uScatter:{value:0},uLength:{value:90},uRadius:{value:20}},vertexShader:`
|
|
2
|
-
varying vec3 vLocal;
|
|
3
|
-
varying vec3 vNormalView;
|
|
4
|
-
varying vec3 vViewDir;
|
|
5
|
-
void main() {
|
|
6
|
-
vLocal = position;
|
|
7
|
-
vec4 viewPosition = modelViewMatrix * vec4(position, 1.0);
|
|
8
|
-
// The side's normal, out of the axis: the apex has none (its length is nought), and a normal of nought there would spread NaN over the whole cone.
|
|
9
|
-
float ring = length(position.xy);
|
|
10
|
-
vec3 outward = ring > 1e-5 ? vec3(position.xy / ring, 0.0) : vec3(0.0, 0.0, 1.0);
|
|
11
|
-
vNormalView = normalize(normalMatrix * outward);
|
|
12
|
-
vViewDir = -viewPosition.xyz;
|
|
13
|
-
gl_Position = projectionMatrix * viewPosition;
|
|
14
|
-
}`,fragmentShader:`
|
|
15
|
-
uniform vec3 uColor;
|
|
16
|
-
uniform float uCandela;
|
|
17
|
-
uniform float uScatter;
|
|
18
|
-
uniform float uLength;
|
|
19
|
-
uniform float uRadius;
|
|
20
|
-
varying vec3 vLocal;
|
|
21
|
-
varying vec3 vNormalView;
|
|
22
|
-
varying vec3 vViewDir;
|
|
23
|
-
void main() {
|
|
24
|
-
float t = clamp(vLocal.z, 0.0, 1.0);
|
|
25
|
-
float distanceM = max(t * uLength, 1.5);
|
|
26
|
-
// The chord a ray makes through a cone of this thickness: long going along the beam, short going across its edge.
|
|
27
|
-
float facing = abs(dot(normalize(vNormalView), normalize(vViewDir + vec3(0.0, 0.0, 1e-4))));
|
|
28
|
-
float chord = 2.0 * uRadius * t * (0.25 + 0.75 * facing);
|
|
29
|
-
// The beam's own profile averaged over the chord: strongest on the axis, none at the edge of the cone.
|
|
30
|
-
float profile = 0.55;
|
|
31
|
-
float radiance = uScatter * uCandela * chord * profile / (distanceM * distanceM + 9.0);
|
|
32
|
-
float ends = (1.0 - smoothstep(0.75, 1.0, t)) * smoothstep(0.0, 0.04, t);
|
|
33
|
-
gl_FragColor = vec4(uColor * radiance * ends, 1.0);
|
|
34
|
-
}`})}}export{i as HeadlightSystem};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{L as h,q as c,U as g,v as f,o as d,n as u,p,u as v}from"./rr0-sighting-editor.mjs";import{launchEditorMessages_en as m}from"./LaunchEditorMessages_en-DH8gI1vo.js";class s{static plumeValue(e){return t=>h.plumeOf(t)[e]}static plume(e,t){return{type:"number",key:`plume.${e}`,effective:s.plumeValue(e),...t}}static burn(e,t){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t.label,hint:t.hint,group:{en:"Engine",fr:"Moteur",es:"Motor",it:"Motore"},effective:i=>t.ends(i.track??[])?.t}}static nextPlace(e){const t=e[e.length-1]??{t:0,lat:0,lng:0,altitudeKm:0},i=e[e.length-2]??t,a=(n,l=0)=>e.length>1?t[n]-i[n]:l;return{t:t.t+(e.length>1?a("t"):1e4),lat:t.lat+a("lat"),lng:t.lng+a("lng"),altitudeKm:Math.max(0,t.altitudeKm+a("altitudeKm"))}}static SET={kind:"launch",title:{en:"Launch",fr:"Lancement",es:"Lanzamiento",it:"Lancio"},parameters:[{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"},group:{en:"Vehicle",fr:"Lanceur",es:"Lanzador",it:"Lanciatore"}},{type:"text",key:"vehicle.mission",label:{en:"Mission",fr:"Mission",es:"Misión",it:"Missione"},placeholder:"Starlink Group 10-49",group:{en:"Vehicle",fr:"Lanceur",es:"Lanzador",it:"Lanciatore"}},{type:"number",key:"vehicle.engine.thrustKN",min:1,max:1e5,step:1,unit:"kN",label:{en:"Thrust (vacuum)",fr:"Poussée (dans le vide)",es:"Empuje (en el vacío)",it:"Spinta (nel vuoto)"},hint:{en:"Merlin Vacuum 934, RL10 110, a solid booster several thousand. With the specific impulse, it sets how much exhaust leaves each second.",fr:"Merlin Vacuum 934, RL10 110, un booster à poudre plusieurs milliers. Avec l'impulsion spécifique, elle fixe le débit d'échappement.",es:"Merlin Vacuum 934, RL10 110, un propulsor sólido varios miles. Con el impulso específico, fija el caudal de escape.",it:"Merlin Vacuum 934, RL10 110, un booster solido diverse migliaia. Con l'impulso specifico, fissa la portata dello scarico."},group:{en:"Engine",fr:"Moteur",es:"Motor",it:"Motore"}},{type:"number",key:"vehicle.engine.specificImpulseS",min:100,max:500,step:1,unit:"s",label:{en:"Specific impulse (vacuum)",fr:"Impulsion spécifique (dans le vide)",es:"Impulso específico (en el vacío)",it:"Impulso specifico (nel vuoto)"},hint:{en:"Times 9.81 m/s² it is the exhaust velocity, which sets how fast the exhaust spreads round the stage: 348 s is 3.4 km/s.",fr:"Multipliée par 9,81 m/s², c'est la vitesse d'éjection, qui fixe la vitesse à laquelle l'échappement s'étale autour de l'étage : 348 s font 3,4 km/s.",es:"Multiplicado por 9,81 m/s² es la velocidad de escape, que fija la rapidez con que el escape se extiende alrededor de la etapa: 348 s son 3,4 km/s.",it:"Moltiplicato per 9,81 m/s² è la velocità di scarico, che fissa quanto in fretta lo scarico si allarga attorno allo stadio: 348 s sono 3,4 km/s."},group:{en:"Engine",fr:"Moteur",es:"Motor",it:"Motore"}},{type:"choice",key:"vehicle.engine.propellant",label:{en:"Propellant",fr:"Ergols",es:"Propelentes",it:"Propellenti"},hint:{en:"What the exhaust is made of decides how much of it turns into particles that scatter light.",fr:"Ce dont l'échappement est fait décide quelle part devient des particules qui diffusent la lumière.",es:"De qué está hecho el escape decide qué parte se vuelve partículas que difunden la luz.",it:"Di cosa è fatto lo scarico decide quanta parte diventa particelle che diffondono la luce."},choices:[{value:"rp1-lox",label:{en:"Kerosene and oxygen",fr:"Kérosène et oxygène",es:"Queroseno y oxígeno",it:"Cherosene e ossigeno"}},{value:"methane-lox",label:{en:"Methane and oxygen",fr:"Méthane et oxygène",es:"Metano y oxígeno",it:"Metano e ossigeno"}},{value:"hydrogen-lox",label:{en:"Hydrogen and oxygen",fr:"Hydrogène et oxygène",es:"Hidrógeno y oxígeno",it:"Idrogeno e ossigeno"}},{value:"hypergolic",label:{en:"Hypergolic",fr:"Hypergolique",es:"Hipergólico",it:"Ipergolico"}},{value:"solid",label:{en:"Solid",fr:"Poudre",es:"Sólido",it:"Solido"}}],group:{en:"Engine",fr:"Moteur",es:"Motor",it:"Motore"}},s.burn("burnFromT",{label:{en:"Engine start",fr:"Allumage du moteur",es:"Encendido del motor",it:"Accensione del motore"},hint:{en:"When the engine started, in seconds of the recording; it may be before it. Empty: the first point of the path.",fr:"Quand le moteur s'est allumé, en secondes de l'enregistrement ; avant lui si besoin. Vide : le premier point du chemin.",es:"Cuándo se encendió el motor, en segundos de la grabación; puede ser antes. Vacío: el primer punto de la trayectoria.",it:"Quando si è acceso il motore, in secondi della registrazione; può essere prima. Vuoto: il primo punto del percorso."},ends:e=>e[0]}),s.burn("burnUntilT",{label:{en:"Engine cut-off",fr:"Extinction du moteur",es:"Apagado del motor",it:"Spegnimento del motore"},hint:{en:"When the engine stopped, in seconds of the recording. Empty: the last point of the path. Nothing is let go after it.",fr:"Quand le moteur s'est éteint, en secondes de l'enregistrement. Vide : le dernier point du chemin. Rien n'est lâché après.",es:"Cuándo se apagó el motor, en segundos de la grabación. Vacío: el último punto de la trayectoria. Nada se suelta después.",it:"Quando si è spento il motore, in secondi della registrazione. Vuoto: l'ultimo punto del percorso. Dopo non si rilascia nulla."},ends:e=>e[e.length-1]}),s.plume("exhaustKgPerS",{min:.1,max:1e5,step:.1,unit:"kg/s",label:{en:"Exhaust flow",fr:"Débit d'échappement",es:"Caudal de escape",it:"Portata di scarico"},hint:{en:"How much exhaust leaves the engine each second: how bright the plume is. Thrust over exhaust velocity when the engine is stated.",fr:"La masse d'échappement qui sort du moteur chaque seconde : la luminosité du panache. La poussée sur la vitesse d'éjection quand le moteur est donné.",es:"La masa de escape que sale del motor cada segundo: el brillo de la estela. El empuje sobre la velocidad de escape cuando se da el motor.",it:"La massa di scarico che esce dal motore ogni secondo: la luminosità della scia. La spinta sulla velocità di scarico quando il motore è dato."},group:{en:"Plume",fr:"Panache",es:"Estela",it:"Scia"}}),s.plume("condensedShare",{min:0,max:1,step:.01,label:{en:"Share that scatters",fr:"Part qui diffuse",es:"Parte que difunde",it:"Parte che diffonde"},hint:{en:"The share of the exhaust that ends up as particles that scatter the Sun's light. Nobody has measured it for a launch: the one number to fit against a photograph.",fr:"La part de l'échappement qui devient des particules diffusant la lumière du Soleil. Personne ne l'a mesurée pour un lancement : le seul nombre à caler sur une photographie.",es:"La parte del escape que acaba como partículas que difunden la luz del Sol. Nadie la ha medido para un lanzamiento: el único número que ajustar con una fotografía.",it:"La parte dello scarico che diventa particelle che diffondono la luce del Sole. Nessuno l'ha misurata per un lancio: l'unico numero da tarare su una fotografia."},group:{en:"Plume",fr:"Panache",es:"Estela",it:"Scia"}}),s.plume("particleRadiusUm",{min:.05,max:5,step:.05,unit:"µm",label:{en:"Particle radius",fr:"Rayon des particules",es:"Radio de las partículas",it:"Raggio delle particelle"},group:{en:"Plume",fr:"Panache",es:"Estela",it:"Scia"}}),s.plume("lifetimeS",{min:10,max:3600,step:10,unit:"s",label:{en:"Trail lifetime",fr:"Durée de la traînée",es:"Duración de la estela",it:"Durata della scia"},hint:{en:"How long the narrow trail lasts before the particles have gone.",fr:"Combien de temps la traînée étroite dure avant que les particules aient disparu.",es:"Cuánto dura la estela estrecha antes de que las partículas hayan desaparecido.",it:"Quanto dura la scia stretta prima che le particelle siano sparite."},group:{en:"Plume",fr:"Panache",es:"Estela",it:"Scia"}}),s.plume("expansionKmPerS",{min:0,max:5,step:.01,unit:"km/s",label:{en:"Trail spreading",fr:"Étalement de la traînée",es:"Expansión de la estela",it:"Espansione della scia"},group:{en:"Plume",fr:"Panache",es:"Estela",it:"Scia"}}),s.plume("initialRadiusKm",{min:0,max:50,step:.1,unit:"km",label:{en:"Radius at release",fr:"Rayon au lâcher",es:"Radio al soltar",it:"Raggio al rilascio"},group:{en:"Plume",fr:"Panache",es:"Estela",it:"Scia"}}),s.plume("collarShare",{min:0,max:1,step:.01,label:{en:"Share in the collar",fr:"Part dans la collerette",es:"Parte en el collar",it:"Parte nel collare"},hint:{en:"The collar is the exhaust just let go, which spreads fast into a wide short-lived shell round the stage; the rest stays behind as the narrow trail.",fr:"La collerette est l'échappement qui vient d'être lâché, qui s'étale vite en une coque large et brève autour de l'étage ; le reste demeure derrière en traînée étroite.",es:"El collar es el escape recién soltado, que se extiende rápido en una envoltura ancha y breve alrededor de la etapa; el resto queda detrás como estela estrecha.",it:"Il collare è lo scarico appena rilasciato, che si allarga in fretta in un guscio largo e breve attorno allo stadio; il resto resta dietro come scia stretta."},group:{en:"Collar",fr:"Collerette",es:"Collar",it:"Collare"}}),s.plume("collarExpansionKmPerS",{min:0,max:10,step:.05,unit:"km/s",label:{en:"Collar spreading",fr:"Étalement de la collerette",es:"Expansión del collar",it:"Espansione del collare"},hint:{en:"How fast the collar widens: three quarters of the exhaust velocity when the engine is stated.",fr:"La vitesse à laquelle la collerette s'élargit : les trois quarts de la vitesse d'éjection quand le moteur est donné.",es:"La rapidez con que el collar se ensancha: tres cuartos de la velocidad de escape cuando se da el motor.",it:"Quanto in fretta il collare si allarga: tre quarti della velocità di scarico quando il motore è dato."},group:{en:"Collar",fr:"Collerette",es:"Collar",it:"Collare"}}),s.plume("collarLifetimeS",{min:1,max:300,step:1,unit:"s",label:{en:"Collar lifetime",fr:"Durée de la collerette",es:"Duración del collar",it:"Durata del collare"},group:{en:"Collar",fr:"Collerette",es:"Collar",it:"Collare"}})]};static PLACE={kind:"launch-place",title:{en:"Place of the path",fr:"Point du chemin",es:"Punto de la trayectoria",it:"Punto del percorso"},parameters:[{type:"number",key:"t",min:-3600,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:{en:"Time",fr:"Instant",es:"Instante",it:"Istante"},hint:{en:"Seconds of the recording; negative before it began: a stage seen minutes after its launch was already high when the recording started.",fr:"Secondes de l'enregistrement ; négatives avant son début : un étage vu des minutes après son lancement était déjà haut quand l'enregistrement a commencé.",es:"Segundos de la grabación; negativos antes de que empezara: una etapa vista minutos después de su lanzamiento ya estaba alta cuando empezó la grabación.",it:"Secondi della registrazione; negativi prima del suo inizio: uno stadio visto minuti dopo il lancio era già alto quando la registrazione è iniziata."}},{type:"number",key:"lat",min:-90,max:90,step:1e-4,unit:"°",required:!0,label:{en:"Latitude",fr:"Latitude",es:"Latitud",it:"Latitudine"}},{type:"number",key:"lng",min:-180,max:180,step:1e-4,unit:"°",required:!0,label:{en:"Longitude",fr:"Longitude",es:"Longitud",it:"Longitudine"}},{type:"number",key:"altitudeKm",min:0,max:2e3,step:.1,unit:"km",required:!0,label:{en:"Altitude",fr:"Altitude",es:"Altitud",it:"Altitudine"}}]};static jetContext(e,t){return{launch:e,index:t}}static jetValue(e){return(t,i)=>{const{launch:a,index:n}=i??{};return a?e(h.releaseOf(a,t,n)):void 0}}static JET_GROUP={en:"Jet",fr:"Jet",es:"Chorro",it:"Getto"};static JET={kind:"launch-jet",title:{en:"Jet",fr:"Jet",es:"Chorro",it:"Getto"},parameters:[{type:"choice",key:"kind",required:!0,label:{en:"What",fr:"Quoi",es:"Qué",it:"Cosa"},choices:[{value:"burn",label:{en:"Engine burn",fr:"Allumage du moteur",es:"Encendido del motor",it:"Accensione del motore"}},{value:"vent",label:{en:"Propellant vented",fr:"Ergols vidangés",es:"Propelentes purgados",it:"Propellenti scaricati"}}],group:s.JET_GROUP},{type:"number",key:"fromT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:{en:"From",fr:"Début",es:"Desde",it:"Da"},hint:{en:"Seconds of the recording; negative before it began.",fr:"Secondes de l'enregistrement ; négatives avant son début.",es:"Segundos de la grabación; negativos antes de que empezara.",it:"Secondi della registrazione; negativi prima del suo inizio."},group:s.JET_GROUP},{type:"number",key:"untilT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:{en:"Until",fr:"Fin",es:"Hasta",it:"Fino a"},group:s.JET_GROUP},{type:"number",key:"angleDeg",min:0,max:180,step:1,unit:"°",effective:()=>0,label:{en:"Direction from aft",fr:"Direction depuis l'arrière",es:"Dirección desde atrás",it:"Direzione da dietro"},hint:{en:"0 straight back along the stage's motion (an engine pushing it on), 90 sideways, 180 straight ahead (an engine braking it).",fr:"0 droit vers l'arrière du mouvement de l'étage (un moteur qui le pousse), 90 sur le côté, 180 droit devant (un moteur qui le freine).",es:"0 hacia atrás del movimiento de la etapa (un motor que la empuja), 90 de lado, 180 hacia delante (un motor que la frena).",it:"0 dritto all'indietro rispetto al moto dello stadio (un motore che lo spinge), 90 di lato, 180 dritto in avanti (un motore che lo frena)."},group:s.JET_GROUP},{type:"number",key:"azimuthDeg",min:-360,max:360,step:1,unit:"°",effective:()=>0,label:{en:"Side",fr:"Côté",es:"Lado",it:"Lato"},hint:{en:"Round the line of motion, which side it leaves on at the start: 0 away from the Earth, 90 to the right of the motion.",fr:"Autour de la ligne du mouvement, le côté par lequel il part au début : 0 à l'opposé de la Terre, 90 à droite du mouvement.",es:"Alrededor de la línea del movimiento, el lado por el que sale al principio: 0 opuesto a la Tierra, 90 a la derecha del movimiento.",it:"Attorno alla linea del moto, il lato da cui esce all'inizio: 0 opposto alla Terra, 90 a destra del moto."},group:s.JET_GROUP},{type:"number",key:"spinPeriodS",min:-3600,max:3600,step:.1,unit:"s",label:{en:"Spin period",fr:"Période de rotation",es:"Período de giro",it:"Periodo di rotazione"},hint:{en:"How long the stage takes to turn once round its line of motion; the jet turns with it and vented propellant draws a spiral. Negative turns the other way. Empty: it does not turn.",fr:"Le temps que met l'étage à faire un tour autour de sa ligne de mouvement ; le jet tourne avec lui et les ergols vidangés dessinent une spirale. Négative : dans l'autre sens. Vide : il ne tourne pas.",es:"Lo que tarda la etapa en dar una vuelta alrededor de su línea de movimiento; el chorro gira con ella y los propelentes purgados dibujan una espiral. Negativo: en el otro sentido. Vacío: no gira.",it:"Il tempo che lo stadio impiega a fare un giro attorno alla sua linea di moto; il getto gira con lui e i propellenti scaricati disegnano una spirale. Negativo: nell'altro verso. Vuoto: non gira."},group:s.JET_GROUP},{type:"number",key:"speedKmPerS",min:0,max:10,step:.01,unit:"km/s",effective:s.jetValue(e=>e.speedKmPerS),label:{en:"Speed",fr:"Vitesse",es:"Velocidad",it:"Velocità"},hint:{en:"How fast it leaves the stage. A burn: the engine's exhaust velocity.",fr:"La vitesse à laquelle il quitte l'étage. Un allumage : la vitesse d'éjection du moteur.",es:"La velocidad con que sale de la etapa. Un encendido: la velocidad de escape del motor.",it:"La velocità con cui lascia lo stadio. Un'accensione: la velocità di scarico del motore."},group:s.JET_GROUP},{type:"number",key:"massKgPerS",min:0,max:1e5,step:.1,unit:"kg/s",effective:s.jetValue(e=>e.massKgPerS),label:{en:"Flow",fr:"Débit",es:"Caudal",it:"Portata"},group:s.JET_GROUP},{type:"number",key:"condensedShare",min:0,max:1,step:.01,effective:s.jetValue(e=>e.condensedShare),label:{en:"Share that scatters",fr:"Part qui diffuse",es:"Parte que difunde",it:"Parte che diffonde"},group:s.JET_GROUP},{type:"number",key:"particleRadiusUm",min:.05,max:5,step:.05,unit:"µm",effective:s.jetValue(e=>e.particleRadiusUm),label:{en:"Particle radius",fr:"Rayon des particules",es:"Radio de las partículas",it:"Raggio delle particelle"},group:s.JET_GROUP},{type:"number",key:"expansionKmPerS",min:0,max:5,step:.01,unit:"km/s",effective:s.jetValue(e=>e.populations[0].expansionKmPerS),label:{en:"Spreading",fr:"Étalement",es:"Expansión",it:"Espansione"},hint:{en:"How fast each puff of it widens: a narrow jet keeps the arms of a spiral apart.",fr:"La vitesse à laquelle chaque bouffée s'élargit : un jet étroit garde les bras d'une spirale séparés.",es:"La rapidez con que se ensancha cada bocanada: un chorro estrecho mantiene separados los brazos de una espiral.",it:"Quanto in fretta si allarga ogni sbuffo: un getto stretto tiene separati i bracci di una spirale."},group:s.JET_GROUP},{type:"number",key:"initialRadiusKm",min:0,max:50,step:.1,unit:"km",effective:s.jetValue(e=>e.initialRadiusKm),label:{en:"Radius at release",fr:"Rayon au lâcher",es:"Radio al soltar",it:"Raggio al rilascio"},group:s.JET_GROUP},{type:"number",key:"lifetimeS",min:1,max:7200,step:1,unit:"s",effective:s.jetValue(e=>e.populations[0].lifetimeS),label:{en:"Lifetime",fr:"Durée",es:"Duración",it:"Durata"},group:s.JET_GROUP}]};static publish(){c.publish(s.SET)}}class r{constructor(e,t,i){this.container=e,this.host=t,this.language=i,c.of("launch")||s.publish(),this.render(),this.setLanguage(i)}messages=m;languageToken=0;currentId;form;list;places;placeForm;placeIndex=0;jets;jetForm;jetIndex=0;language;shown=[];async setLanguage(e){const t=++this.languageToken;this.language=e;const i=g.includes(e)?e:"en",a=i==="en"?m:await f(i);t===this.languageToken&&(this.messages=a,this.render(),this.sync())}sync(){const e=this.launches;this.shown=[...e],e.some(a=>a.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(a=>({id:a.id,label:this.labelOf(a)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("launch-fields").hidden=t===void 0,!t)return;this.syncPlaces(t),this.syncJets(t);const i=c.of("launch");this.form??=new d(this.element("launch-parameters"),this.language,"",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i,t,()=>this.written())}refresh(){this.syncAddState();const e=this.launches;e.length===this.shown.length&&e.every((t,i)=>t===this.shown[i])||this.sync()}syncAddState(){const e=this.startOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}show(e){this.currentId=e,this.placeIndex=0,this.sync()}render(){const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
|
-
<p class="launch-intro">${e.intro}</p>
|
|
3
|
-
<div id="launch-list"></div>
|
|
4
|
-
<div id="launch-fields" class="launch-fields">
|
|
5
|
-
<fieldset id="launch-path" class="launch-path">
|
|
6
|
-
<legend>${e.path}</legend>
|
|
7
|
-
<div id="launch-places"></div>
|
|
8
|
-
<div id="launch-place-parameters" class="launch-parameters"></div>
|
|
9
|
-
</fieldset>
|
|
10
|
-
<fieldset id="launch-jets" class="launch-path">
|
|
11
|
-
<legend>${e.jets}</legend>
|
|
12
|
-
<div id="launch-jet-list"></div>
|
|
13
|
-
<div id="launch-jet-parameters" class="launch-parameters"></div>
|
|
14
|
-
</fieldset>
|
|
15
|
-
<div id="launch-parameters" class="launch-parameters"></div>
|
|
16
|
-
<p class="launch-intro">${e.derivedNote}</p>
|
|
17
|
-
</div>
|
|
18
|
-
</div>`;const t=this.element("launch-list");this.list=new u({header:t,body:this.element("launch-fields"),ids:{list:"launch-select",remove:"launch-delete",add:"launch-add",kinds:"launch-add-kind",kind:a=>`launch-add-${a}`},onSelect:a=>{this.currentId=a,this.placeIndex=0,this.sync()},onAdd:a=>this.addLaunch(a??r.VEHICLES[0].id),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.launch,remove:e.deleteLaunch,add:e.addLaunch,empty:e.none}),this.list.setKinds(r.VEHICLES.map(a=>({value:a.id,label:a.vehicle.name??a.id})));const i=this.element("launch-places");this.places=new u({header:i,body:this.element("launch-place-parameters"),ids:{list:"launch-place",remove:"launch-place-delete",add:"launch-place-add"},navigation:{scope:this.container,onStep:a=>this.selectPlace(this.placeIndex+a)},onSelect:a=>this.selectPlace(Number(a)),onAdd:()=>this.addPlace(),onRemove:()=>this.removePlace()}),this.places.setLabels({list:e.place,remove:e.deletePlace,add:e.addPlace,previous:e.previousPlace,next:e.nextPlace}),this.placeForm=void 0,this.jets=new u({header:this.element("launch-jet-list"),body:this.element("launch-jet-parameters"),ids:{list:"launch-jet",remove:"launch-jet-delete",add:"launch-jet-add",kinds:"launch-jet-add-kind",kind:a=>`launch-jet-add-${a}`},onSelect:a=>{this.jetIndex=Number(a),this.syncJets(this.current,!0)},onAdd:a=>this.addJet(a==="vent"?"vent":"burn"),onRemove:()=>this.removeJet()}),this.jets.setLabels({list:e.jet,remove:e.deleteJet,add:e.addJet,empty:e.noJet}),this.jets.setKinds([{value:"burn",label:e.jetBurn},{value:"vent",label:e.jetVent}]),this.jetForm=void 0}written(){this.host.changed();const e=this.current;e&&this.list?.rename(e.id,this.labelOf(e))}syncPlaces(e,t=!1){const i=e.track??[];this.placeIndex=Math.max(0,Math.min(this.placeIndex,i.length-1)),this.places?.setItems(i.map((a,n)=>({id:String(n),label:this.seconds(a.t)})),String(this.placeIndex)),this.places?.setStepState(this.placeIndex>0,this.placeIndex<i.length-1),this.places?.setRemoveEnabled(i.length>r.MIN_PLACES),this.placeForm?this.placeForm.sync(t):(this.placeForm=new d(this.element("launch-place-parameters"),this.language,"launchPlace."),this.placeForm.show(s.PLACE,new p(()=>this.current?.track[this.placeIndex],a=>this.editPlace(a)),()=>{}))}syncJets(e,t=!1){const i=e.jets??[];this.jetIndex=Math.max(0,Math.min(this.jetIndex,i.length-1));const a=this.messages;this.jets?.setItems(i.map((n,l)=>({id:String(l),label:`${n.kind==="vent"?a.jetVent:a.jetBurn} ${this.seconds(n.fromT)}`})),i.length?String(this.jetIndex):void 0),this.jetForm?this.jetForm.sync(t):(this.jetForm=new d(this.element("launch-jet-parameters"),this.language,"launchJet."),this.jetForm.show(s.JET,new p(()=>this.current?.jets?.[this.jetIndex],n=>this.editJet(n),()=>this.current?s.jetContext(this.current,this.jetIndex):void 0),()=>{}))}editJet(e){const t=this.current;if(!t?.jets)return;const i={...t.jets[this.jetIndex]};e(i),t.jets=t.jets.map((n,l)=>l===this.jetIndex?i:n);const a=this.messages;this.jets?.rename(String(this.jetIndex),`${i.kind==="vent"?a.jetVent:a.jetBurn} ${this.seconds(i.fromT)}`),this.written()}addJet(e){const t=this.current;if(!t)return;const i=t.track,a=Math.round((i[0].t+i[i.length-1].t)/2),n=e==="vent"?{kind:e,fromT:a,untilT:a+3e4,angleDeg:90}:{kind:e,fromT:a,untilT:a+3e4};!t.jets?.length&&t.burnFromT===void 0&&t.burnUntilT===void 0&&(t.burnFromT=i[0].t,t.burnUntilT=i[i.length-1].t),t.jets=[...t.jets??[],n],this.jetIndex=t.jets.length-1,this.syncJets(t,!0),this.form?.sync(!0),this.host.changed()}removeJet(){const e=this.current;if(!e?.jets?.length)return;const t=e.jets.filter((i,a)=>a!==this.jetIndex);t.length?e.jets=t:delete e.jets,this.syncJets(e,!0),this.host.changed()}static MIN_PLACES=2;seconds(e){return`${Math.round(e/100)/10} s`}selectPlace(e){const t=this.current?.track??[];e<0||e>=t.length||(this.placeIndex=e,this.syncPlaces(this.current,!0))}editPlace(e){const t=this.current;if(!t)return;const i={...t.track[this.placeIndex]};e(i);const a=t.track.map((n,l)=>l===this.placeIndex?i:n).sort((n,l)=>n.t-l.t);this.replaceTrack(t,a),this.placeIndex=a.indexOf(i),this.syncPlaces(this.current),this.written()}addPlace(){const e=this.current;if(!e)return;const t=e.track,i=s.nextPlace(t),a=[...e.track,i].sort((n,l)=>n.t-l.t);this.replaceTrack(e,a),this.placeIndex=a.indexOf(i),this.syncPlaces(this.current),this.host.changed()}removePlace(){const e=this.current;!e||e.track.length<=r.MIN_PLACES||(this.replaceTrack(e,e.track.filter((t,i)=>i!==this.placeIndex)),this.syncPlaces(this.current),this.host.changed())}replaceTrack(e,t){e.track=t}startOfNew(){const e=this.host.sighting(),t=e.event?.place?.[0];if(t?.lat===void 0||t.lng===void 0)return;const i=(e.observerTrack?.getInterpolatedPoseAt(0)?.headingDeg??0)*Math.PI/180,a=n=>({lat:t.lat+n*Math.cos(i)/111.32,lng:t.lng+n*Math.sin(i)/(111.32*Math.max(.05,Math.cos(t.lat*Math.PI/180)))});return[{t:0,...a(300),altitudeKm:80},{t:6e4,...a(450),altitudeKm:160}]}static VEHICLES=[{id:"falcon-9",vehicle:{name:"Falcon 9"}}];addLaunch(e){const t=this.startOfNew();if(!t)return;const i=r.VEHICLES.find(o=>o.id===e)??r.VEHICLES[0];let a=this.launches.length+1;for(;this.launches.some(o=>o.id===`launch-${a}`);)a++;const n={id:`launch-${a}`,vehicle:{...i.vehicle},track:t},l=this.host.sighting();l.skyEvents={...l.skyEvents,launches:[...this.launches,n]},this.currentId=n.id,this.host.changed(),this.sync()}deleteCurrent(){const e=this.current;if(!e)return;this.currentId=void 0;const t=this.host.sighting();t.skyEvents=v.written({...t.skyEvents,launches:this.launches.filter(i=>i!==e)}),this.host.changed(),this.sync()}labelOf(e){const t=this.host.said().read(e.title)??e.vehicle?.mission??e.vehicle?.name;return t?`${t} (${e.id})`:e.id}get launches(){return this.host.sighting().skyEvents?.launches??[]}element(e){return this.container.querySelector(`#${e}`)}}export{r as LaunchEditor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as d,Z as c,$ as l,a0 as f,a1 as m,a2 as u,a3 as w,a4 as g,a5 as y,a6 as M,a7 as S,a8 as v,a9 as O}from"./rr0-sighting-editor.mjs";class h{static key(e){return"url"in e?`url:${e.url}|${e.headingOffsetDeg??0}`:"shape"in e?`shape:${e.shape}`:`decor:${e.decorKind}`}static async build(e){const a=new d;if("url"in e){const s=await c(e.url);s.rotation.y=-(e.headingOffsetDeg??0)*Math.PI/180,a.add(s)}else"shape"in e?a.add(h.shapeOf(e.shape)):a.add(l.build({id:"preview",kind:e.decorKind,eastM:0,northM:0},!1));return a}static shapeOf(e){if(e==="figure")return l.build({id:"preview",kind:"entity",eastM:0,northM:0},!1);const a=new f(m.unitGeometry(e),new u({color:13158608,roughness:.5,metalness:0}));return e==="ellipsoid"&&a.scale.set(1,.55,1),a}static dispose(e){e.traverse(a=>{const s=a;if(s.isMesh){s.geometry?.dispose();for(const t of[s.material].flat())t.dispose()}})}static stage(e,a){const s=new w().setFromObject(e);if(s.isEmpty())return;const t=s.getBoundingSphere(new g),r=new d;e.position.sub(t.center),r.add(e);const n=new y;n.add(r),n.add(new M(16777215,6715272,1.6));const o=new S(16777215,2.5);o.position.set(1,2,1.5),n.add(o);const i=new v(30,a,t.radius*.05,t.radius*20),p=t.radius/Math.sin(i.fov*Math.PI/360)*1.05;return i.position.copy(new O(.55,.3,-.78).normalize().multiplyScalar(p)),i.lookAt(0,0,0),{scene:n,camera:i,pivot:r}}}export{h as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{X as c}from"./rr0-sighting-editor.mjs";import{M as i}from"./ModelSource-D9Q4lorr.js";class l{static SIZE_PX={width:192,height:144};static cache=new Map;static queue=Promise.resolve();static pending=0;static renderer;static of(r){const t=i.key(r);let e=this.cache.get(t);return e||(this.pending++,e=this.queue.then(()=>this.draw(r)).catch(()=>{}).finally(()=>{--this.pending===0&&this.release()}),this.queue=e,this.cache.set(t,e)),e}static async draw(r){const t=await i.build(r);try{const{width:e,height:n}=this.SIZE_PX,a=i.stage(t,e/n);if(!a)return;const s=this.renderer??=new c({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});return s.setSize(e,n,!1),s.setClearColor(0,0),s.render(a.scene,a.camera),s.domElement.toDataURL("image/png")}finally{i.dispose(t)}}static release(){this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=void 0}}export{l as ModelThumbnails};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{X as h}from"./rr0-sighting-editor.mjs";import{M as c}from"./ModelSource-D9Q4lorr.js";class a{constructor(t,e){this.container=t,this.source=e,this.canvas=document.createElement("canvas"),this.canvas.className="model-live",this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab;display:none",this.canvas.addEventListener("pointerdown",s=>this.press(s)),this.canvas.addEventListener("pointermove",s=>this.move(s)),this.canvas.addEventListener("pointerup",()=>this.release()),this.canvas.addEventListener("pointercancel",()=>this.release())}static renderer;static SPIN_RAD_PER_S=.7;static DRAG_RAD_PER_PX=.012;static CLICK_TOLERANCE_PX=4;static current;object;stage;frame=0;stopped=!1;last=0;dragging;draggedPastClick=!1;canvas;static show(t,e){a.current?.stop();const s=new a(t,e);return a.current=s,s.start(),s}static end(){a.current?.stop(),a.current=void 0,a.renderer?.dispose(),a.renderer?.forceContextLoss(),a.renderer=void 0}consumeDrag(){const t=this.draggedPastClick;return this.draggedPastClick=!1,t}get active(){return!this.stopped}stop(){this.stopped=!0,cancelAnimationFrame(this.frame),this.canvas.remove(),this.object&&c.dispose(this.object),this.object=void 0,a.current===this&&(a.current=void 0)}async start(){try{const t=await c.build(this.source);if(this.stopped){c.dispose(t);return}this.object=t;const{width:e,height:s}=this.container.getBoundingClientRect(),i=e>0&&s>0?e/s:4/3;if(this.stage=c.stage(t,i),!this.stage)return;(a.renderer??=new h({antialias:!0,alpha:!0})).setClearColor(0,0),this.container.append(this.canvas),this.canvas.style.display="block",this.last=performance.now(),this.tick()}catch{}}tick=()=>{if(this.stopped||!this.stage)return;const t=performance.now(),e=Math.min(.1,(t-this.last)/1e3);this.last=t,this.dragging||(this.stage.pivot.rotation.y+=a.SPIN_RAD_PER_S*e);const s=a.renderer,{width:i,height:n}=this.canvas.getBoundingClientRect(),r=Math.min(2,window.devicePixelRatio||1);(this.canvas.width!==Math.round(i*r)||this.canvas.height!==Math.round(n*r))&&(s.setPixelRatio(r),s.setSize(i,n,!1),this.canvas.width=Math.round(i*r),this.canvas.height=Math.round(n*r),this.stage.camera.aspect=i/Math.max(1,n),this.stage.camera.updateProjectionMatrix()),s.render(this.stage.scene,this.stage.camera);const o=this.canvas.getContext("2d");o?.clearRect(0,0,this.canvas.width,this.canvas.height),o?.drawImage(s.domElement,0,0,this.canvas.width,this.canvas.height),this.frame=requestAnimationFrame(this.tick)};press(t){this.dragging={x:t.clientX,y:t.clientY,moved:!1},this.canvas.setPointerCapture(t.pointerId),this.canvas.style.cursor="grabbing"}move(t){const e=this.dragging;if(!e||!this.stage)return;const s=t.clientX-e.x,i=t.clientY-e.y;!e.moved&&Math.hypot(s,i)<a.CLICK_TOLERANCE_PX||(e.moved=!0,this.draggedPastClick=!0,this.stage.pivot.rotation.y+=s*a.DRAG_RAD_PER_PX,this.stage.pivot.rotation.x=Math.max(-1.4,Math.min(1.4,this.stage.pivot.rotation.x-i*a.DRAG_RAD_PER_PX)),e.x=t.clientX,e.y=t.clientY)}release(){this.dragging=void 0,this.canvas.style.cursor="grab"}}export{a as ModelViewer};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{Y as F,a2 as P,af as H,ag as w,aj as K,al as N,a0 as U,am as k}from"./rr0-sighting-editor.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,n,e){const s=t.map(a=>a.level===0),o=t.map((a,l)=>s[l]?b.targets(a,n,e):[]),c=t.map((a,l)=>s[l]?b.samples(a,o[l]):[]),r=new Map;t.forEach((a,l)=>{if(s[l])for(const M of b.ends(a)){const h=b.key(M),d=r.get(h);d?d.push(l):r.set(h,[l])}});const p=a=>{const l=r.get(b.key(a));if(l)return b.median(l.flatMap(M=>c[M]),a)};return t.map((a,l)=>{if(s[l]){const M=[...new Set([l,...b.ends(a).flatMap(g=>r.get(b.key(g))??[])])].flatMap(g=>c[g]),h=a.centre.map((g,D)=>b.median(M,g)??o[l][D]),[d,L]=b.ends(a);return h[0]=p(d)??h[0],h[h.length-1]=p(L)??h[h.length-1],b.graded(h,a.along,a.highSpeed?b.MAX_GRADE.highSpeed:b.MAX_GRADE[a.kind])}return b.carried(a,n,e,p)})}static targets(t,n,e){return t.centre.map(s=>{const o=n(s.x,s.z);if(e===void 0||s.altitudeM===void 0)return o;const c=s.altitudeM+e;return c-o>b.HOLLOW_M||o-c>b.COVERED_M?c:o})}static samples(t,n){const e=[];let s=0;return t.centre.forEach((o,c)=>{t.along[c]+1e-6<s&&c<t.centre.length-1||(e.push({x:o.x,z:o.z,y:n[c]}),s=t.along[c]+b.SAMPLE_M)}),e}static median(t,n){const e=[];for(const o of t)Math.hypot(o.x-n.x,o.z-n.z)<=b.WINDOW_M&&e.push(o.y);if(e.length===0)return;e.sort((o,c)=>o-c);const s=e.length>>1;return e.length%2===1?e[s]:(e[s-1]+e[s])/2}static graded(t,n,e){if(!Number.isFinite(e)||t.length<3)return t;const s=[...t],o=s.length-1,c=n[o];if(Math.abs(s[o]-s[0])>e*c)return n.map(r=>s[0]+(s[o]-s[0])*r/c);for(let r=1;r<o;r++){const p=e*(n[r]-n[r-1]);s[r]=Math.min(s[r-1]+p,Math.max(s[r-1]-p,s[r]))}for(let r=o-1;r>0;r--){const p=e*(n[r+1]-n[r]);s[r]=Math.min(s[r+1]+p,Math.max(s[r+1]-p,s[r]))}return s}static carried(t,n,e,s){const[o,c]=b.ends(t),r=t.along[t.along.length-1],p=s(o),a=s(c);if(e!==void 0&&t.centre.every(h=>h.altitudeM!==void 0)){const h=t.centre.map(g=>g.altitudeM+e),d=p!==void 0?p-h[0]:0,L=a!==void 0?a-h[h.length-1]:0;return h.map((g,D)=>g+d+(L-d)*t.along[D]/r)}const l=p??n(o.x,o.z),M=a??n(c.x,c.z);return t.along.map(h=>l+(M-l)*h/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,n,e){const s=this.vertexCount;for(let o=0;o<t.length;o++)this.positions.push(t[o].x,t[o].y,t[o].z,n[o].x,n[o].y,n[o].z),e&&this.along.push(e[o],e[o]);for(let o=0;o<t.length-1;o++){const c=s+o*2;this.indices.push(c,c+2,c+1,c+1,c+2,c+3)}}beam(t,n,e,s=!0){const o=n.x-t.x,c=n.y-t.y,r=n.z-t.z,p=Math.hypot(o,c,r);if(p<1e-6)return;const a={x:o/p,y:c/p,z:r/p},l=Math.abs(a.y)>.9?{x:1,y:0,z:0}:{x:0,y:1,z:0},M=a.y*l.z-a.z*l.y,h=a.z*l.x-a.x*l.z,d=a.x*l.y-a.y*l.x,L=Math.hypot(M,h,d),g={x:M/L*e/2,y:h/L*e/2,z:d/L*e/2},D={x:a.y*g.z-a.z*g.y,y:a.z*g.x-a.x*g.z,z:a.x*g.y-a.y*g.x},E=(u,A,f)=>({x:u.x+g.x*A+D.x*f,y:u.y+g.y*A+D.y*f,z:u.z+g.z*A+D.z*f}),O=[[1,1],[-1,1],[-1,-1],[1,-1]];for(let u=0;u<4;u++){const[A,f]=O[u],[v,x]=O[(u+1)%4];this.quad(E(t,A,f),E(t,v,x),E(n,v,x),E(n,A,f))}s&&(this.quad(...[...O].reverse().map(([u,A])=>E(t,u,A))),this.quad(...O.map(([u,A])=>E(n,u,A))))}quad(t,n,e,s){const o=this.vertexCount;this.positions.push(t.x,t.y,t.z,n.x,n.y,n.z,e.x,e.y,e.z,s.x,s.y,s.z),this.indices.push(o,o+1,o+2,o,o+2,o+3)}}class i{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=i.STEP_M;drawn=0;laid=[];ballastMaterial=i.pebbled(i.lambert(i.BALLAST_ALBEDO,!0));earthMaterial=i.lambert(i.BANK_ALBEDO,!0);deckMaterial=i.lambert(i.DECK_ALBEDO,!1);concreteSleepers=i.sleeperMaterial(i.CONCRETE_ALBEDO);woodSleepers=i.sleeperMaterial(i.WOOD_ALBEDO);rustMaterial=i.lambert(i.RUST_ALBEDO,!0);headMaterial=new P({color:new H(.62,.62,.62),metalness:1,roughness:.28,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});steelMaterial=i.lambert(i.STEEL_ALBEDO,!1);wireMaterial=i.lambert(i.COPPER_ALBEDO,!1);constructor(){this.group.name="railways"}get count(){return this.drawn}setGroundSpacing(t){this.stepM=Number.isFinite(t)&&t>0?Math.min(i.STEP_M,Math.max(1.5,t/2)):i.STEP_M}set(t,n,e,s,o=1/0){this.clear();const r=t.map(d=>({line:d,path:d.points.map(L=>({...w(L.lat,L.lng,n,e),altitudeM:L.altitudeM}))})).filter(({line:d,path:L})=>d.level>=0&&i.within(L,o)),p=i.altitudeOffset(r,s),a=r.flatMap(({line:d,path:L})=>{const g=this.layoutOf(d,L);return g?[{line:d,layout:g}]:[]}),l=b.heights(a.map(({layout:d})=>d),s,p),M={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:d,layout:L},g)=>{this.lay(d,{...L,y:l[g]},s,M),this.laid.push({line:d,centre:L.centre}),this.drawn++});const h=[[M.ballast,this.ballastMaterial,"ballast",!1],[M.earth,this.earthMaterial,"embankments",!1],[M.deck,this.deckMaterial,"decks",!0],[M.concrete,this.concreteSleepers,"sleepers",!1],[M.wood,this.woodSleepers,"sleepers wood",!1],[M.rust,this.rustMaterial,"rails",!1],[M.head,this.headMaterial,"rail heads",!1],[M.steel,this.steelMaterial,"catenary masts",!0],[M.wire,this.wireMaterial,"catenary wires",!1]];for(const[d,L,g,D]of h){const E=i.meshOf(d,L);E&&(E.name=`railways ${g}`,E.castShadow=D,E.receiveShadow=!0,this.group.add(E))}}clear(){for(const t of[...this.group.children])this.group.remove(t),t.geometry?.dispose();this.drawn=0,this.laid=[]}lineAt(t,n){let e;for(const{line:s,centre:o}of this.laid)for(let c=0;c<o.length-1;c++){const r=o[c],p=o[c+1],a=p.x-r.x,l=p.z-r.z,M=a*a+l*l,h=M===0?0:Math.max(0,Math.min(1,((t-r.x)*a+(n-r.z)*l)/M)),d=Math.hypot(t-(r.x+a*h),n-(r.z+l*h));d<=i.LINE_REACH_M&&(!e||d<e.distance)&&(e={line:s,distance:d})}return e?.line}contactHeightM(t){if(!(t.electrification!=="overhead"||t.kind==="subway"||t.kind==="funicular"))return i.catenaryOf(t).contactM}static catenaryOf(t){return t.kind==="tram"?i.CATENARY.tram:t.highSpeed?i.CATENARY.highSpeed:t.service?i.CATENARY.service:i.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,n){if(!Number.isFinite(n))return!0;const e=n*1.1+100;return t.some((s,o)=>Math.hypot(s.x,s.z)<=e||o>0&&Math.hypot((s.x+t[o-1].x)/2,(s.z+t[o-1].z)/2)<=e)}static altitudeOffset(t,n){const e=[];for(const{line:s,path:o}of t)if(s.level===0)for(const c of o)c.altitudeM!==void 0&&e.push(n(c.x,c.z)-c.altitudeM);if(!(e.length<5))return e.sort((s,o)=>s-o),e[Math.floor(e.length/2)]}layoutOf(t,n){const e=[];for(let c=0;c<n.length-1;c++){const r=n[c],p=n[c+1],a=Math.max(1,Math.ceil(Math.hypot(p.x-r.x,p.z-r.z)/this.stepM));for(let l=0;l<a;l++){const M=l/a,h=r.altitudeM!==void 0&&p.altitudeM!==void 0?r.altitudeM+(p.altitudeM-r.altitudeM)*M:void 0;e.push({x:r.x+(p.x-r.x)*M,z:r.z+(p.z-r.z)*M,altitudeM:h})}}if(e.push(n[n.length-1]),e.length<2)return;const s=[0];for(let c=1;c<e.length;c++)s.push(s[c-1]+Math.hypot(e[c].x-e[c-1].x,e[c].z-e[c-1].z));if(s[s.length-1]<.5)return;const o=e.map((c,r)=>{const p=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],l=a.x-p.x,M=a.z-p.z,h=Math.hypot(l,M);return h<1e-6?{x:1,z:0}:{x:l/h,z:M/h}});return{kind:t.kind,...t.highSpeed?{highSpeed:!0}:{},level:t.level,centre:e,along:s,dir:o}}lay(t,n,e,s){const o=t.highSpeed?i.TRACK_SPACING_M.highSpeed:i.TRACK_SPACING_M[t.kind],c=Math.min(8,Math.max(1,t.tracks)),r=Array.from({length:c},(E,O)=>(O-(c-1)/2)*o),p=t.kind==="tram",a=p?0:i.BALLAST_HEIGHT_M,l=i.LIFT_M,M=(E,O,u)=>({x:n.centre[E].x-n.dir[E].z*O,y:n.y[E]+u,z:n.centre[E].z+n.dir[E].x*O}),h=n.centre.map((E,O)=>O);if(!p){const E=i.SLEEPER_LENGTH_M/2+i.BALLAST_SHOULDER_M+(r[r.length-1]??0),O=h.map(A=>M(A,E,a+l)),u=h.map(A=>M(A,-E,a+l));if(s.ballast.strip(O,u),t.level===0){const A=E+a*i.BALLAST_SLOPE;for(const f of[1,-1]){const v=[],x=[];let m=!1;for(const z of h){const S=M(z,f*A,l),C=e(S.x,S.z)+l,T=S.y-C;T<0&&(S.y=Math.min(C,n.y[z]+a-.05+l)),v.push(S);const I=M(z,f*(A+Math.max(0,T)*i.BANK_SLOPE),l);I.y=Math.min(e(I.x,I.z)+l,S.y),S.y-I.y>.02&&(m=!0),x.push(I)}const _=f>0?O:u;f>0?s.ballast.strip(v,_):s.ballast.strip(_,v),m&&(f>0?s.earth.strip(x,v):s.earth.strip(v,x))}}else{const A=-i.DECK_DEPTH_M,f=E+.15,v=h.map(z=>M(z,f,a+l+.1)),x=h.map(z=>M(z,-f,a+l+.1)),m=h.map(z=>M(z,f,A)),_=h.map(z=>M(z,-f,A));s.deck.strip(m,v),s.deck.strip(x,_),s.deck.strip(_,m),s.deck.strip(v,h.map(z=>M(z,E,a+l+.1))),s.deck.strip(h.map(z=>M(z,-E,a+l+.1)),x)}}const d=t.service?s.wood:s.concrete,L=t.gaugeMm/2e3+i.RAIL_HEAD_M/2,g=p?i.TRAM_RAIL_HEIGHT_M:i.RAIL_HEIGHT_M,D=a+l;for(const E of r){if(!p){const O=i.SLEEPER_LENGTH_M/2;d.strip(h.map(u=>M(u,E+O,D+.004)),h.map(u=>M(u,E-O,D+.004)),n.along)}for(const O of[1,-1]){const u=E+O*L,A=i.RAIL_HEAD_M/2,f=h.map(x=>M(x,u+A,D+g)),v=h.map(x=>M(x,u-A,D+g));s.head.strip(f,v),s.rust.strip(h.map(x=>M(x,u+A,D)),f),s.rust.strip(v,h.map(x=>M(x,u-A,D)))}}t.electrification==="overhead"&&t.kind!=="subway"&&t.kind!=="funicular"&&this.catenary(t,n,r,D+g,M,e,s)}catenary(t,n,e,s,o,c,r){const p=i.catenaryOf(t),a=n.along[n.along.length-1],l=Math.max(1,Math.round(a/p.spanM)),M=a/l,h=Array.from({length:l},(f,v)=>(v+.5)*M),d=s+p.contactM,L=d+p.systemM,g=(p.systemM>0?L:d)+i.MAST_ABOVE_M,D=e[e.length-1],E=e.length>2,O=e.length===1?[1]:[1,-1],u=(f,v,x)=>{let m=0,_=n.along.length-2;for(;m<_;){const T=m+_+1>>1;n.along[T]<=f?m=T:_=T-1}const z=Math.min(1,Math.max(0,(f-n.along[m])/Math.max(1e-6,n.along[m+1]-n.along[m]))),S=o(m,v,x),C=o(m+1,v,x);return{x:S.x+(C.x-S.x)*z,y:S.y+(C.y-S.y)*z,z:S.z+(C.z-S.z)*z}};for(const f of h){const v=u(f,0,d);if(!(t.level===0&&c(v.x,v.z)>v.y)){for(const x of O){const m=x*(D+i.MAST_OFFSET_M),_=u(f,m,0);t.level===0&&(_.y=Math.min(_.y,c(_.x,_.z)));const z=u(f,m,g);if(r.steel.beam(_,z,i.MAST_SIDE_M),E)continue;const C=(O.length===1?e[0]:x*D)-x*.6,T=p.systemM>0?L:d+.3;r.steel.beam(u(f,m,T),u(f,C,T),i.ARM_SIDE_M),r.steel.beam(u(f,m,d-.4),u(f,C,T),i.ARM_SIDE_M)}if(E){const x=D+i.MAST_OFFSET_M;r.steel.beam(u(f,x,g-.2),u(f,-x,g-.2),i.MAST_SIDE_M*.8)}}}const A=[0,...h,a];for(const[f,v]of e.entries()){const x=m=>m===0||m===A.length-1?0:((m+f)%2===0?1:-1)*p.staggerM;for(let m=0;m<A.length-1;m++){const _=A[m],z=A[m+1];if(z-_<.1||(r.wire.beam(u(_,v+x(m),d),u(z,v+x(m+1),d),i.CONTACT_DIAMETER_M,!1),p.systemM<=0))continue;const S=4,C=T=>{const I=m===0?.5+T/2:m===A.length-2?T/2:T;return L-i.MESSENGER_SAG_M*4*I*(1-I)};for(let T=0;T<S;T++){const I=T/S,G=(T+1)/S;r.wire.beam(u(_+(z-_)*I,v,C(I)),u(_+(z-_)*G,v,C(G)),i.MESSENGER_DIAMETER_M,!1)}}}}static meshOf(t,n){if(t.indices.length===0)return;const e=new K;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,n)}static lambert(t,n){return new k({color:new H(...t),...n?{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}:{}})}static pebbled(t){return t.onBeforeCompile=n=>{n.vertexShader=n.vertexShader.replace("#include <common>",`#include <common>
|
|
2
|
-
varying vec3 vBallast;`).replace("#include <begin_vertex>",`#include <begin_vertex>
|
|
3
|
-
vBallast = position;`),n.fragmentShader=n.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 n=new k({color:new H(1,1,1),polygonOffset:!0,polygonOffsetFactor:-3,polygonOffsetUnits:-3}),e=new H(...t),s=new H(...i.BALLAST_ALBEDO);return n.onBeforeCompile=o=>{o.uniforms.uSleeper={value:e},o.uniforms.uCrib={value:s},o.uniforms.uSpacing={value:i.SLEEPER_SPACING_M},o.uniforms.uDuty={value:i.SLEEPER_WIDTH_M/i.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
|
-
}`)},n.customProgramCacheKey=()=>"rr0-railway-sleepers",n}}export{i as RailwaySystem};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as O,ae as w,af as A,ag as R,a0 as M,ah as v,ai as D,aj as N,ak 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 M(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(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 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 v(c.x,c.z),t=s.map(p),o=e.map(c=>c.map(p)),a=D.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]],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])l.push(m.x,n,m.y)}const g=new N;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};
|